Re: [PATCH] mm:memcg: add __GFP_NOWARN in __memcg_schedule_kmem_cache_create

From: David Rientjes
Date: Wed Apr 18 2018 - 00:16:49 EST


On Tue, 17 Apr 2018, Matthew Wilcox wrote:

> Not arguing against this patch. But how many places do we want to use
> GFP_NOWAIT without __GFP_NOWARN? Not many, and the few which do do this
> seem like they simply haven't added it yet. Maybe this would be a good idea?
>
> -#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM)
> +#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM | __GFP_NOWARN)
>

I don't think that's a good idea, slab allocators use GFP_NOWAIT during
init, for example, followed up with a BUG_ON() if it fails. With an
implicit __GFP_NOWARN we wouldn't be able to see the state of memory when
it crashes (likely memory that wasn't freed to the allocator). I think
whether the allocation failure should trigger a warning is up to the
caller.