Re: [PATCHSET] block, mempool, percpu: implement percpu mempool and
fix blkcg percpu alloc deadlock
[Posted January 4, 2012 by corbet]
| From: |
| Andrew Morton <akpm-AT-linux-foundation.org> |
| To: |
| Tejun Heo <tj-AT-kernel.org> |
| Subject: |
| Re: [PATCHSET] block, mempool, percpu: implement percpu mempool and
fix blkcg percpu alloc deadlock |
| Date: |
| Tue, 27 Dec 2011 13:58:36 -0800 |
| Message-ID: |
| <20111227135836.7102f41b.akpm@linux-foundation.org> |
| Cc: |
| avi-AT-redhat.com, nate-AT-cpanel.net, cl-AT-linux-foundation.org,
oleg-AT-redhat.com, axboe-AT-kernel.dk, vgoyal-AT-redhat.com,
linux-kernel-AT-vger.kernel.org, jaxboe-AT-fusionio.com |
| Archive‑link: | |
Article |
On Tue, 27 Dec 2011 13:44:21 -0800
Tejun Heo <tj@kernel.org> wrote:
> I'm not convinced trying to put this into GFP_KERNEL context would
> work. Short of that, the next best thing would be making percpu
> allocator useable from memory reclaim path, right?
Well.. All allocations which are weaker than GFP_KERNEL are to be
discouraged. That being said...
> But that would
> involved a lot more churn and complexity without much added benefit,
> given that this type of use cases aren't expected to be common - and
> I'm fairly sure it isn't given track record of past few years.
I don't think it would be too hard to add an alloc_percpu_gfp(). Add
the gfp_t to a small number of functions (two or three?) then change
pcpu_mem_zalloc() to always use kzalloc() if (flags & GFP_KERNEL !=
GFP_KERNEL). And that's it?
But the question is: is this a *good* thing to do? It would be nice if
kernel developers understood that GFP_KERNEL is strongly preferred and
that they should put in effort to use it. But there's a strong
tendency for people to get themselves into a sticky corner then take
the easy way out, resulting in less robust code. Maybe calling the
function alloc_percpu_i_really_suck() would convey the hint.