public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Nick Piggin <npiggin@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: percpu allocator vs reclaim
Date: Thu, 05 Mar 2009 17:11:06 +0900	[thread overview]
Message-ID: <49AF891A.30200@kernel.org> (raw)
In-Reply-To: <1236185363.5330.8121.camel@laptop>

Peter Zijlstra wrote:
> On Thu, 2009-03-05 at 01:40 +0900, Tejun Heo wrote:
>> Peter Zijlstra wrote:
>>> Hi Tejun,
>>>
>>> Thomas hit the below on recent -tip kernels.
>>>
>>> Which basically states that we could deadlock due to reclaim lock
>>> recursion.
>>>
>>> Looking at the code I don't see a quick solution, other than using
>>> GFP_NOFS, which is a bit of a bother (as I suspect it might easily grow
>>> __GFP_IO inversion too, if it doesn't already have it).
>> Ah... maybe percpu allocator should just swallow @gfp.  Any better
>> ideas? :-(
> 
> Could you somehow break that lock so that you get something like:
> 
>   alloc_lock
>     kmalloc(GFP_KERNEL)
>     free_lock
> 
> Where
> 
>  percpu_free()
>    lock(free_lock)
>      put area on free list
> 
>  percpu_alloc()
>    lock(free_list)
>      collect free list
>    kmalloc()
> 
> Then the free code can be used from reclaim, because there's never an
> allocation done while holding it, and the alloc path can first
> check/cleanup whatever mess the last free left behind before trying an
> allocation.

Yeap, I think I can do that.  Will work on it.

Thanks.

-- 
tejun

      reply	other threads:[~2009-03-05  8:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 16:36 percpu allocator vs reclaim Peter Zijlstra
2009-03-04 16:40 ` Tejun Heo
2009-03-04 16:49   ` Peter Zijlstra
2009-03-05  8:11     ` Tejun Heo [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=49AF891A.30200@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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