Re: [PATCH 07/13] powerpc: Preemptible mmu_gather

Peter Zijlstra
2010-04-14T13:34:36Z

On Tue, 2010-04-13 at 11:23 +1000, Benjamin Herrenschmidt wrote:
> > + * A comment here about on why we have RCU freed page tables might be
> > + * interesting, also explaining why we don't need any sort of grace
> > + * period for mm_users == 1, and have some home brewn smp_call_func()
> > + * for single frees.
>
> iirc, we are synchronizing with CPUs walking page tables in their hash
> or TLB miss code, which is lockless. The mm_users test is a -little- bit
> dubious indeed. It may have to be mm_users < 2 && mm ==
> current->active_mm, ie, we know for sure nobody else is currently
> walking those page tables ...
>
> Tho even than is fishy nowadays. We -can- walk page tables on behave of
> another process. In fact, we do it in the Cell SPU code for faulting
> page table entries as a result of SPEs taking faults for example. So I'm
> starting to suspect that this mm_users optimisation is bogus.
>
> We -do- want to optimize out the case where there is no user left
> though, ie, the MM is dead. IE. The typical exit case.

Can't you fix that by having the SPE code take a reference on these
mm_structs they're playing with?

Poking at one without a ref seems fishy anyway.