[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1205071522450.6029@router.home>
Date: Mon, 7 May 2012 15:24:06 -0500 (CDT)
From: Christoph Lameter <cl@...ux.com>
To: Pekka Enberg <penberg@...nel.org>
cc: Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>,
David Rientjes <rientjes@...gle.com>, linux-mm@...ck.org
Subject: Re: [PATCH] slab/mempolicy: always use local policy from interrupt
context v2
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@...stfloor.org> wrote:
> > From: Andi Kleen <ak@...ux.intel.com>
> >
> > 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 || .... ?
Powered by blists - more mailing lists