Re: [RFC PATCH] docs/core-api: add memory allocation guide

From: Michal Hocko
Date: Wed Aug 15 2018 - 05:30:37 EST


On Wed 15-08-18 12:04:29, Mike Rapoport wrote:
[...]
> How about:
>
> * If the allocation is performed from an atomic context, e.g interrupt
> handler, use ``GFP_NOWARN``. This flag prevents direct reclaim and IO or
> filesystem operations. Consequently, under memory pressure ``GFP_NOWARN``
> allocation is likely to fail.

s@NOWARN@NOWAIT@ I guess. Looks good otherwise. I would even go and
mention GFP_NOWARN once you brought it up. Allocations which have a
reasonable fallback should be using NOWARN.

> * If you think that accessing memory reserves is justified and the kernel
> will be stressed unless allocation succeeds, you may use ``GFP_ATOMIC``.

OK otherwise.
--
Michal Hocko
SUSE Labs