Re: [PATCHSET] block, mempool, percpu: implement percpu mempool andfix blkcg percpu alloc deadlock
From: Andrew Morton
Date: Tue Dec 27 2011 - 16:58:38 EST
On Tue, 27 Dec 2011 13:44:21 -0800
Tejun Heo <tj@xxxxxxxxxx> 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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/