From: Michal Hocko <mhocko@suse.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Matthew Wilcox <willy@infradead.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Liam R. Howlett" <liam.howlett@oracle.com>,
Michel Lespinasse <walken.cr@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
David Hildenbrand <david@redhat.com>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: Memory allocation on speculative fastpaths
Date: Wed, 4 May 2022 01:45:11 +0200 [thread overview]
Message-ID: <YnG+h13Mh5b2qo5N@dhcp22.suse.cz> (raw)
In-Reply-To: <CAJuCfpG8mBCV8O=FWwTJj8zfoh68fH9kBraMEjxKUvCyEw2MFw@mail.gmail.com>
On Tue 03-05-22 16:15:46, Suren Baghdasaryan wrote:
> On Tue, May 3, 2022 at 11:28 AM Matthew Wilcox <willy@infradead.org> wrote:
[...]
> > rcu_read_lock();
> > vma = vma_lookup();
> > if (down_read_trylock(&vma->sem)) {
> > rcu_read_unlock();
> > } else {
> > rcu_read_unlock();
> > mmap_read_lock(mm);
> > vma = vma_lookup();
> > down_read(&vma->sem);
> > }
> >
> > ... and we then execute the page table allocation under the protection of
> > the vma->sem.
> >
> > At least, that's what I think we agreed to yesterday.
>
> Honestly, I don't remember discussing vma->sem at all.
This is the rangelocking approach that is effectivelly per-VMA. So that
should help with the most simplistic case where the mmap contention is
not on the same VMAs which should be the most common case (e.g. faulting
from several threads while there is mmap happening in the background).
There are cases where this could be too coarse of course and RCU would
be a long term plan. The above seems easy enough and still probably good
enough for most cases so a good first step.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2022-05-03 23:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 15:59 Paul E. McKenney
2022-05-03 16:04 ` Michal Hocko
2022-05-03 16:39 ` Paul E. McKenney
2022-05-03 18:28 ` Matthew Wilcox
2022-05-03 23:15 ` Suren Baghdasaryan
2022-05-03 23:45 ` Michal Hocko [this message]
2022-05-04 0:22 ` Matthew Wilcox
2022-05-04 16:23 ` Johannes Weiner
2022-05-24 20:37 ` Vlastimil Babka
2022-05-25 13:12 ` Johannes Weiner
2022-05-04 8:20 ` Michel Lespinasse
2022-05-04 16:52 ` Matthew Wilcox
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=YnG+h13Mh5b2qo5N@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=dave@stgolabs.net \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@kernel.org \
--cc=surenb@google.com \
--cc=walken.cr@gmail.com \
--cc=willy@infradead.org \
/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