linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] slab/mempolicy: always use local policy from interrupt context v2
Date: Mon, 7 May 2012 15:24:06 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1205071522450.6029@router.home> (raw)
In-Reply-To: <CAOJsxLE36GNJBmdrJqFfoyEve8swVsaBSq_oVgkgXSMEC3oBfA@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1464 bytes --]

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@firstfloor.org> wrote:
> > From: Andi Kleen <ak@linux.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 || .... ?

      reply	other threads:[~2012-05-07 20:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1334499755-4399-1-git-send-email-andi@firstfloor.org>
2012-05-03  7:18 ` Pekka Enberg
2012-05-07 20:24   ` Christoph Lameter [this message]

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=alpine.DEB.2.00.1205071522450.6029@router.home \
    --to=cl@linux.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.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