Re: tlb_gather_mmu() and semantics of "fullmm"

Benjamin Herrenschmidt
2009-03-27T06:03:47Z

On Thu, 2009-03-26 at 22:57 -0700, David Miller wrote:

> Good point.
>
> Maybe it would work out correctly if I used current->mm?
>
> Because if I tested it that way, only something really executing
> in userland could force the cpumask bit clears.
>
> Any kernel thread would flush the TLB if and when it switched
> back into a real task using that mm.
>
> Sound good?

/me thinks (not as late here but I'm getting tired regardless ;-)

So if you test current->mm, you effectively account for mm_users == 1,
so the only way the mm can be active on another processor is as a lazy
mm for a kernel thread. So your test should work properly as long
as you don't have a HW that will do speculative TLB reloads into the
TLB on that other CPU (and even if you do, you flush-on-switch-in should
get rid of any crap here).

Ben.