mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: eranian@hpl.hp.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 8/18] 2.6.17.9 perfmon2 patch for review: event sets and multiplexing support
Date: Wed, 6 Sep 2006 19:21:35 -0700	[thread overview]
Message-ID: <20060906192135.83fc4231.akpm@osdl.org> (raw)
In-Reply-To: <20060906145031.GE13962@frankl.hpl.hp.com>

On Wed, 6 Sep 2006 07:50:31 -0700
Stephane Eranian <eranian@hpl.hp.com> wrote:

> > > +
> > > +	cachep = ctx->flags.mapset ? pfm_set_cachep : pfm_lg_set_cachep;
> > > +
> > > +	new_set = kmem_cache_alloc(cachep, SLAB_ATOMIC);
> > 
> > SLAB_ATOMIC is unreliable.  Is it possible to use SLAB_KERNEL here?  If
> > coms ecallers can sleep and others cannot then passing in the gfp_flags
> > would permit improvement here.
> > 
> 
> I made some changes and now I know I execute this part of the function
> with interrupts disabled, holding only the perfmon context lock. I assume
> SLAB_KERNEL means, we can sleep. I think I can make this change safely.
> 
> 
> > 
> > > +		if (ctx->flags.mapset) {
> > > +			view_size = PAGE_ALIGN(sizeof(struct pfm_set_view));
> > > +			view      = vmalloc(view_size);
> > 
> > vmalloc() sleeps, so this _could_ have used SLAB_ATOMIC.
> > 
> 
> I am not sure I follow you here. Are you talking about eh kmem_cache_alloc()
> above?
> 

My logic was as follows:

a) vmalloc() can sleep

b) Stephane at some time tested this conde with
   CONFIG_DEBUG_SPINLOCK_SLEEP and didn't get sleep-while-atomic warnings out of
   that vmalloc().

c) Hence this code is never called under spinlock, or with local
   interrupts disabled.

d) Hence it is safe to convert the earlier SLAB_ATOMIC into SLAB_KERNEL.


If b) is false then it's the vmalloc() call which is incorrect, not the
SLAB_ATOMIC.


  reply	other threads:[~2006-09-07  2:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23  8:05 Stephane Eranian
2006-08-23 22:51 ` Andrew Morton
2006-09-06 14:50   ` Stephane Eranian
2006-09-07  2:21     ` Andrew Morton [this message]
2006-09-08  6:26       ` Stephane Eranian

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=20060906192135.83fc4231.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=eranian@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome