From: Andrew Morton <akpm@osdl.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Mike Waychison <mikew@google.com>,
linux-mm@kvack.org,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>
Subject: Re: [RFC] page fault retry with NOPAGE_RETRY
Date: Tue, 19 Sep 2006 22:26:56 -0700 [thread overview]
Message-ID: <20060919222656.52fadf3c.akpm@osdl.org> (raw)
In-Reply-To: <1158728665.6002.262.camel@localhost.localdomain>
On Wed, 20 Sep 2006 15:04:24 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Tue, 2006-09-19 at 20:05 -0700, Andrew Morton wrote:
>
> > resides in a pagetable page. Once we've dropped mmap_sem, that
> > pagetable page might not be there any more: munmap() might have freed it.
> > We have to retake mmap_sem, do a find_vma() and a new pagetable walk.
> >
> > There are some optimisations we could make to avoid all of that in the
> > common case, but this is the conceptual behaviour.
>
> It's a non-issue anyway the no_page handler in Mike's patch _does_
> re-take mmap_sem before returning RETRY thus my whole idea still stands
> perfectly fine unless I've missed something, which means we can make it
> without changing no_page arguments. Let me re-describe it:
>
> - somebody->no_page() returns RETRY. It may have dropped the mmap sem,
> but if it did, like in Mike's patch, it will have re-taken it before
> returning.
>
> - upon return (in handle_pte_fault typically) if we get something else
> than that retry, we return
> as usual.
>
> - if we got RETRY we do something like
>
> if (signal_pending(current) || need_resched() || pte_present(*pte))
> return VM_FAULT_MINOR;
> else
> return VM_FAULT_RETRY;
>
> Thus we still have to change arch to test for VM_FAULT_RETRY and loop on
> it (or return to userland if they want but that's less optimal) but we
> don't have to carry around a "MAY_RETRY" thing nor change no_page()
> arguments.
>
> The idea is that we can't livelock since we'll always schedule and we
> can take signals so the process can always be killed.
>
> We'll also avoid the loop and coming back if the PTE has been filled up
> in the meantime (just a cheap optimisation avoiding a new find_vma()
> etc...).
>
> And it's simpler :)
>
> Now, I may have missed something of course, but I'd like to know what.
> So far, I don't see what won't work with the above.
>
It's a choice between two behaviours:
a) get stuck in the kernel until someone kills you and
b) fault the page in and proceed as expected.
Option b) is better, no?
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@osdl.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Mike Waychison <mikew@google.com>,
linux-mm@kvack.org,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>
Subject: Re: [RFC] page fault retry with NOPAGE_RETRY
Date: Tue, 19 Sep 2006 22:26:56 -0700 [thread overview]
Message-ID: <20060919222656.52fadf3c.akpm@osdl.org> (raw)
In-Reply-To: <1158728665.6002.262.camel@localhost.localdomain>
On Wed, 20 Sep 2006 15:04:24 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Tue, 2006-09-19 at 20:05 -0700, Andrew Morton wrote:
>
> > resides in a pagetable page. Once we've dropped mmap_sem, that
> > pagetable page might not be there any more: munmap() might have freed it.
> > We have to retake mmap_sem, do a find_vma() and a new pagetable walk.
> >
> > There are some optimisations we could make to avoid all of that in the
> > common case, but this is the conceptual behaviour.
>
> It's a non-issue anyway the no_page handler in Mike's patch _does_
> re-take mmap_sem before returning RETRY thus my whole idea still stands
> perfectly fine unless I've missed something, which means we can make it
> without changing no_page arguments. Let me re-describe it:
>
> - somebody->no_page() returns RETRY. It may have dropped the mmap sem,
> but if it did, like in Mike's patch, it will have re-taken it before
> returning.
>
> - upon return (in handle_pte_fault typically) if we get something else
> than that retry, we return
> as usual.
>
> - if we got RETRY we do something like
>
> if (signal_pending(current) || need_resched() || pte_present(*pte))
> return VM_FAULT_MINOR;
> else
> return VM_FAULT_RETRY;
>
> Thus we still have to change arch to test for VM_FAULT_RETRY and loop on
> it (or return to userland if they want but that's less optimal) but we
> don't have to carry around a "MAY_RETRY" thing nor change no_page()
> arguments.
>
> The idea is that we can't livelock since we'll always schedule and we
> can take signals so the process can always be killed.
>
> We'll also avoid the loop and coming back if the PTE has been filled up
> in the meantime (just a cheap optimisation avoiding a new find_vma()
> etc...).
>
> And it's simpler :)
>
> Now, I may have missed something of course, but I'd like to know what.
> So far, I don't see what won't work with the above.
>
It's a choice between two behaviours:
a) get stuck in the kernel until someone kills you and
b) fault the page in and proceed as expected.
Option b) is better, no?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-09-20 5:27 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-14 22:55 [RFC] page fault retry with NOPAGE_RETRY Benjamin Herrenschmidt
2006-09-14 22:55 ` Benjamin Herrenschmidt
2006-09-15 0:19 ` Linus Torvalds
2006-09-15 0:19 ` Linus Torvalds
2006-09-15 7:11 ` Andrew Morton
2006-09-15 7:11 ` Andrew Morton
2006-09-15 7:35 ` Andrew Morton
2006-09-15 7:35 ` Andrew Morton
2006-09-15 13:30 ` Hugh Dickins
2006-09-15 13:30 ` Hugh Dickins
2006-09-16 1:03 ` Benjamin Herrenschmidt
2006-09-16 1:03 ` Benjamin Herrenschmidt
2006-09-19 23:35 ` Mike Waychison
2006-09-19 23:50 ` Benjamin Herrenschmidt
2006-09-19 23:50 ` Benjamin Herrenschmidt
2006-09-19 23:59 ` Andrew Morton
2006-09-19 23:59 ` Andrew Morton
2006-09-20 0:06 ` Benjamin Herrenschmidt
2006-09-20 0:06 ` Benjamin Herrenschmidt
2006-09-20 0:05 ` Benjamin Herrenschmidt
2006-09-20 0:05 ` Benjamin Herrenschmidt
2006-09-20 0:21 ` Andrew Morton
2006-09-20 0:21 ` Andrew Morton
2006-09-20 1:57 ` Benjamin Herrenschmidt
2006-09-20 1:57 ` Benjamin Herrenschmidt
2006-09-20 3:05 ` Andrew Morton
2006-09-20 3:05 ` Andrew Morton
2006-09-20 5:04 ` Benjamin Herrenschmidt
2006-09-20 5:04 ` Benjamin Herrenschmidt
2006-09-20 5:26 ` Andrew Morton [this message]
2006-09-20 5:26 ` Andrew Morton
2006-09-20 6:54 ` Benjamin Herrenschmidt
2006-09-20 6:54 ` Benjamin Herrenschmidt
2006-09-20 17:53 ` Andrew Morton
2006-09-20 17:53 ` Andrew Morton
2006-09-21 22:05 ` Benjamin Herrenschmidt
2006-09-21 22:05 ` Benjamin Herrenschmidt
2006-09-21 22:41 ` Andrew Morton
2006-09-21 22:41 ` Andrew Morton
2006-09-21 23:09 ` Benjamin Herrenschmidt
2006-09-21 23:09 ` Benjamin Herrenschmidt
2006-09-23 14:21 ` Hugh Dickins
2006-09-23 14:21 ` Hugh Dickins
2006-09-23 19:46 ` Andrew Morton
2006-09-23 19:46 ` Andrew Morton
2006-09-23 22:35 ` Benjamin Herrenschmidt
2006-09-23 22:35 ` Benjamin Herrenschmidt
2006-09-20 5:06 ` Benjamin Herrenschmidt
2006-09-20 5:06 ` Benjamin Herrenschmidt
2006-09-20 1:14 ` Mike Waychison
2006-09-20 1:14 ` Mike Waychison
2006-09-20 2:02 ` Benjamin Herrenschmidt
2006-09-20 2:02 ` Benjamin Herrenschmidt
2006-09-15 21:35 ` Arnd Bergmann
2006-09-15 21:35 ` Arnd Bergmann
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=20060919222656.52fadf3c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mikew@google.com \
--cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.