linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: akpm@linux-foundation.org, mingo@kernel.org, adobriyan@gmail.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/4 v2] Define killable version for access_remote_vm() and use it in fs/proc
Date: Mon, 26 Feb 2018 17:47:47 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1802261742400.24072@chino.kir.corp.google.com> (raw)
In-Reply-To: <4ec32e5b-af63-f412-2213-e52bdbcc9585@linux.alibaba.com>

On Mon, 26 Feb 2018, Yang Shi wrote:

> > Rather than killable, we have patches that introduce down_read_unfair()
> > variants for the files you've modified (cmdline and environ) as well as
> > others (maps, numa_maps, smaps).
> 
> You mean you have such functionality used by google internally?
> 

Yup, see https://lwn.net/Articles/387720.

> > When another thread is holding down_read() and there are queued
> > down_write()'s, down_read_unfair() allows for grabbing the rwsem without
> > queueing for it.  Additionally, when another thread is holding
> > down_write(), down_read_unfair() allows for queueing in front of other
> > threads trying to grab it for write as well.
> 
> It sounds the __unfair variant make the caller have chance to jump the gun to
> grab the semaphore before other waiters, right? But when a process holds the
> semaphore, i.e. mmap_sem, for a long time, it still has to sleep in
> uninterruptible state, right?
> 

Right, it's solving two separate things which I think may be able to be 
merged together.  Killable is solving an issue where the rwsem is blocking 
for a long period of time in uninterruptible sleep, and unfair is solving 
an issue where reading the procfs files gets stalled for a long period of 
time.  We haven't run into an issue (yet) where killable would have solved 
it; we just have the unfair variants to grab the rwsem asap and then, if 
killable, gracefully return.

> > Ingo would know more about whether a variant like that in upstream Linux
> > would be acceptable.
> > 
> > Would you be interested in unfair variants instead of only addressing
> > killable?
> 
> Yes, I'm although it still looks overkilling to me for reading /proc.
> 

We make certain inferences on the readablility of procfs files for other 
threads to determine how much its mm's mmap_sem is contended.

  reply	other threads:[~2018-02-27  1:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27  0:25 [RFC PATCH 0/4 v2] Define killable version for access_remote_vm() and use it in fs/proc Yang Shi
2018-02-27  0:25 ` [PATCH 1/4 v2] mm: add access_remote_vm_killable APIs Yang Shi
2018-02-27  0:25 ` [PATCH 2/4 v2] fs: proc: use down_read_killable in proc_pid_cmdline_read() Yang Shi
2018-02-27  0:25 ` [PATCH 3/4 v2] fs: proc: use down_read_killable() in environ_read() Yang Shi
2018-02-27  7:15   ` Alexey Dobriyan
2018-02-27 16:59     ` Yang Shi
2018-02-27  0:25 ` [PATCH 4/4 v2] mm: use access_remote_vm() in get_cmdline() Yang Shi
2018-02-27  1:02 ` [RFC PATCH 0/4 v2] Define killable version for access_remote_vm() and use it in fs/proc David Rientjes
2018-02-27  1:25   ` Yang Shi
2018-02-27  1:47     ` David Rientjes [this message]
2018-03-01  0:17       ` Yang Shi
2018-03-06 18:45 ` Yang Shi
2018-03-06 20:45 ` Andrew Morton
2018-03-06 21:17   ` Yang Shi
2018-03-06 21:41     ` Andrew Morton
2018-03-07  0:47       ` Yang Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1802261742400.24072@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=yang.shi@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).