Re: [PATCH] block,blkcg: use __GFP_NOWARN for best-effort allocations in blkcg

From: Vlastimil Babka
Date: Wed Nov 23 2016 - 03:51:45 EST


On 11/22/2016 11:13 PM, Linus Torvalds wrote:
On Tue, Nov 22, 2016 at 8:48 AM, Tejun Heo <tj@xxxxxxxxxx> wrote:

Hello,

On Tue, Nov 22, 2016 at 04:47:49PM +0100, Vlastimil Babka wrote:
Thanks. Makes me wonder whether we should e.g. add __GFP_NOWARN to
GFP_NOWAIT globally at some point.

Yeah, that makes sense. The caller is explicitly saying that it's
okay to fail the allocation.

I'm not so convinced about the "atomic automatically means you shouldn't warn".

Right, but atomic allocations should be using GFP_ATOMIC, which allows to use the atomic reserves. I meant here just GFP_NOWAIT which does not allow reserves, for allocations that are not in atomic context, but still don't want to reclaim for performance or whatever reasons, and have a suitable fallback. It's their choice to not spend any effort on the allocation and thus they shouldn't spew warnings IMHO.

You'd certainly _hope_ that atomic allocations either have fallbacks
or are harmless if they fail, but I'd still rather see that
__GFP_NOWARN just to make that very much explicit.

A global change to GFP_NOWAIT would of course mean that we should audit its users (there don't seem to be many), whether they are using it consciously and should not rather be using GFP_ATOMIC.

Vlastimil

Because as it is, atomic allocations certainly get to dig deeper into
our memory reserves, but they most definitely can fail, and I
definitely see how some code has no fallback because it thinks that
the deeper reserves mean that it will succeed.

Linus