From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: David Miller <davem@davemloft.net>
Cc: hugh@veritas.com, linux-mm@kvack.org,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
npiggin@suse.de, zach@vmware.com, jeremy@goop.org
Subject: Re: tlb_gather_mmu() and semantics of "fullmm"
Date: Fri, 27 Mar 2009 16:54:27 +1100 [thread overview]
Message-ID: <1238133267.20197.56.camel@pasglop> (raw)
In-Reply-To: <20090326.224433.150749170.davem@davemloft.net>
On Thu, 2009-03-26 at 22:44 -0700, David Miller wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Date: Fri, 27 Mar 2009 16:38:07 +1100
>
> > If you look at context_switch() in kernel/sched.c, it increments
> > mm_count when using the pevious guy's mm as the "active_mm" of a kernel
> > thread, not mm_user.
>
> Yawn...
Yeah it's late over there :-)
> We unconditionally check if the CPU is set in the mask, even
> when the mm isn't changing.
Ok, so you do lazy flushing at context switch time, which is nice,
but I'm still wondering if the code you showed is right. Feel free
to reply tomorrow after a good night of sleep though :-)
The scenario I have in mind is as follow:
CPU 0 is running the context, task->mm == task->active_mm == your
context. The CPU is in userspace happily churning things.
CPU 1 used to run it, not anymore, it's now running fancyfsd which
is a kernel thread, but current->active_mm still points to that
same context.
Because there's only one "real" user, mm_users is 1 (but mm_count is
elevated, it's just that the presence on CPU 1 as active_mm has no
effect on mm_count().
At this point, fancyfsd decides to invalidate a mapping currently mapped
by that context, for example because a networked file has changed
remotely or something like that, using unmap_mapping_ranges().
So CPU 1 goes into the zapping code, which eventually ends up calling
flush_tlb_pending(). Your test will succeed, as current->active_mm is
indeed the target mm for the flush, and mm_users is indeed 1. So you
will -not- send an IPI to the other CPU, and CPU 0 will continue happily
accessing the pages that should have been unmapped.
Or did I miss something ?
Cheers,
Ben.
--
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-03-27 5:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 5:01 Benjamin Herrenschmidt
2009-03-26 14:08 ` Hugh Dickins
2009-03-26 16:38 ` Linus Torvalds
2009-03-26 23:13 ` Benjamin Herrenschmidt
2009-03-26 17:21 ` Jeremy Fitzhardinge
2009-03-26 20:39 ` David Miller
2009-03-26 22:33 ` Benjamin Herrenschmidt
2009-03-27 5:04 ` David Miller
2009-03-27 5:38 ` Benjamin Herrenschmidt
2009-03-27 5:44 ` David Miller
2009-03-27 5:54 ` Benjamin Herrenschmidt [this message]
2009-03-27 5:57 ` David Miller
2009-03-27 6:10 ` Benjamin Herrenschmidt
2009-03-27 8:05 ` David Miller
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=1238133267.20197.56.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=hugh@veritas.com \
--cc=jeremy@goop.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
--cc=zach@vmware.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