On Thu, 3 May 2012, Pekka Enberg wrote: > (Adding some CC's.) Uggg... Strange whitespace coming from Pekka again. > On Sun, Apr 15, 2012 at 5:22 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote: > > From: Andi Kleen <ak@xxxxxxxxxxxxxxx> > > > > slab_node() could access current->mempolicy from interrupt context. > > However there's a race condition during exit where the mempolicy > > is first freed and then the pointer zeroed. > > > > Using this from interrupts seems bogus anyways. The interrupt > > will interrupt a random process and therefore get a random > > mempolicy. Many times, this will be idle's, which noone can change. > > > > Just disable this here and always use local for slab > > from interrupts. I also cleaned up the callers of slab_node a bit > > which always passed the same argument. Good idea. > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > > index cfb6c86..da79bbf 100644 > > --- a/mm/mempolicy.c > > +++ b/mm/mempolicy.c > > @@ -1586,8 +1586,9 @@ static unsigned interleave_nodes(struct mempolicy *policy) > > * task can change it's policy. The system default policy requires no > > * such protection. > > */ > > -unsigned slab_node(struct mempolicy *policy) > > +unsigned slab_node(void) > > { > > + struct mempolicy *policy = !in_interrupt() ? current->policy : NULL; > > if (!policy || policy->flags & MPOL_F_LOCAL) Simplify this to if (in_interrupt() || !policy || .... ?