From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Nick Piggin <nickpiggin@yahoo.com.au>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm: disable preemption in apply_to_pte_range
Date: Thu, 12 Feb 2009 17:39:01 -0800 [thread overview]
Message-ID: <4994CF35.60507@goop.org> (raw)
In-Reply-To: <20090212165539.5ce51468.akpm@linux-foundation.org>
Andrew Morton wrote:
> This weakens the apply_to_page_range() utility by newly requiring that
> the callback function be callable under preempt_disable() if the target
> mm is init_mm. I guess we can live with that.
>
> It's OK for the two present in-tree callers. There might of course be
> out-of-tree callers which break, but it is unlikely.
>
> The patch should include a comment explaining why there is a random
> preempt_disable() in this function.
>
I cuddled them up to their corresponding arch_X_lazy_mmu_mode calls to
get this across, but I guess some prose would be helpful here.
> Why is apply_to_page_range() exported to modules, btw? I can find no
> modules which need it. Unexporting that function would make the
> proposed weakening even less serious.
>
I have some yet-to-be upstreamed code that can use it from modules.
> The patch assumes that
> arch_enter_lazy_mmu_mode()/arch_leave_lazy_mmu_mode() must have
> preemption disabled for all architectures. Is this a sensible
> assumption?
>
In general the model for lazy updates is that you're batching the
updates in some queue somewhere, which is almost certainly a piece of
percpu state being maintained by someone. Its therefore broken and/or
meaningless to have the code making the updates wandering between cpus
for the duration of the lazy updates.
> If so, should we do the preempt_disable/enable within those functions?
> Probably not worth the cost, I guess.
The specific rules are that
arch_enter_lazy_mmu_mode()/arch_leave_lazy_mmu_mode() require you to be
holding the appropriate pte locks for the ptes you're updating, so
preemption is naturally disabled in that case.
This all goes a bit strange with init_mm's non-requirement for taking
pte locks. The caller has to arrange for some kind of serialization on
updating the range in question, and that could be a mutex. Explicitly
disabling preemption in enter_lazy_mmu_mode would make sense for this
case, but it would be redundant for the common case of batched updates
to usermode ptes.
J
--
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:[~2009-02-13 1:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4994BCF0.30005@goop.org>
[not found] ` <4994C052.9060907@goop.org>
2009-02-13 0:55 ` Andrew Morton
2009-02-13 1:39 ` Jeremy Fitzhardinge [this message]
2009-02-13 11:48 ` Peter Zijlstra
2009-02-13 13:30 ` Nick Piggin
2009-02-13 14:16 ` Peter Zijlstra
2009-02-13 14:30 ` Nick Piggin
2009-02-13 14:38 ` Peter Zijlstra
2009-02-13 17:41 ` Jeremy Fitzhardinge
2009-02-14 9:46 ` Peter Zijlstra
2009-02-13 17:24 ` Jeremy Fitzhardinge
2009-02-14 9:56 ` Peter Zijlstra
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=4994CF35.60507@goop.org \
--to=jeremy@goop.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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