From: Peter Zijlstra <peterz@infradead.org>
To: Huang Ying <ying.huang@intel.com>
Cc: Len Brown <lenb@kernel.org>,
linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
linux-acpi@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -v6 2/3] lib, Make gen_pool memory allocator lockless
Date: Mon, 29 Nov 2010 13:11:37 +0100 [thread overview]
Message-ID: <1291032697.32004.28.camel@laptop> (raw)
In-Reply-To: <1291014201-15513-3-git-send-email-ying.huang@intel.com>
On Mon, 2010-11-29 at 15:03 +0800, Huang Ying wrote:
> This version of the gen_pool memory allocator supports lockless
> operation.
>
> This makes it safe to use in NMI handlers and other special
> unblockable contexts that could otherwise deadlock on locks. This is
> implemented by using atomic operations and retries on any conflicts.
> The disadvantage is that there may be livelocks in extreme cases. For
> better scalability, one gen_pool allocator can be used for each CPU.
>
> The lockless operation only works if there is enough memory available.
> If new memory is added to the pool a lock has to be still taken. So
> any user relying on locklessness has to ensure that sufficient memory
> is preallocated.
>
> The basic atomic operation of this allocator is cmpxchg on long. On
> architectures that don't have NMI-safe cmpxchg implementation, a
> spin_trylock_irqsave based fallback is used for gen_pool_alloc, so it
> can be used in NMI handler safely. But gen_pool_free can not be used
> in NMI handler in these architectures, because memory free can not
> fail.
I still don't see a reason to merge this.
It makes the genalloc thing slower for every other user (more LOCK'ed
ops) and there is no new user presented in this series.
next prev parent reply other threads:[~2010-11-29 12:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 7:03 [PATCH -v6 0/3] Lockless memory allocator and list Huang Ying
2010-11-29 7:03 ` [PATCH -v6 2/3] lib, Make gen_pool memory allocator lockless Huang Ying
2010-11-29 12:11 ` Peter Zijlstra [this message]
2010-11-30 1:08 ` Huang Ying
2010-11-29 7:03 ` [PATCH -v6 3/3] lib, Add lock-less NULL terminated single list Huang Ying
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=1291032697.32004.28.camel@laptop \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
--cc=ying.huang@intel.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