Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs/core-api: memory-allocation: GFP_NOWAIT doesn't need __GFP_NOWARN

Since v6.8 the definition of GFP_NOWAIT has implied __GFP_NOWARN,
so it is now redundant to add this flag explicitly.

Update the docs to match, and emphasise the need for a fallback
when using GFP_NOWAIT.

Fixes: 16f5dfbc851b ("gfp: include __GFP_NOWARN in GFP_NOWAIT")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20240729140127.244606-1-Dave.Martin@arm.com

authored by

Dave Martin and committed by
Jonathan Corbet
b745fdef 8400291e

+3 -2
+3 -2
Documentation/core-api/memory-allocation.rst
··· 45 45 * If the allocation is performed from an atomic context, e.g interrupt 46 46 handler, use ``GFP_NOWAIT``. This flag prevents direct reclaim and 47 47 IO or filesystem operations. Consequently, under memory pressure 48 - ``GFP_NOWAIT`` allocation is likely to fail. Allocations which 49 - have a reasonable fallback should be using ``GFP_NOWARN``. 48 + ``GFP_NOWAIT`` allocation is likely to fail. Users of this flag need 49 + to provide a suitable fallback to cope with such failures where 50 + appropriate. 50 51 * If you think that accessing memory reserves is justified and the kernel 51 52 will be stressed unless allocation succeeds, you may use ``GFP_ATOMIC``. 52 53 * Untrusted allocations triggered from userspace should be a subject