mm: make __GFP_BITS_SHIFT independent of CONFIG_LOCKDEP
Subsystems (2)
PATCH 1/1 mm: make __GFP_BITS_SHIFT independent of CONFIG_LOCKDEP
The list of GFP flags is sparse already (see 0x200u and flags defined based on CONFIG_KASAN_HW_TAGS), so it makes little sense to save one bit at the end of it if CONFIG_LOCKDEP is undefined.
The dependence of __GFP_BITS_SHIFT on CONFIG_LOCKDEP also does not let us add new flags after ___GFP_NOLOCKDEP.
Signed-off-by Alexander Potapenko <[email protected]>
---
An alternative to this patch would be putting all ___GFP_ flags into enum, so that we they occupy as few bits as possible.
My understanding is that this is doable, because tools/perf/builtin-kmem.c does not depend on the flag values, but maybe I am missing something?
--- include/linux/gfp_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/gfp_types.h +1 -1
@@ -249,7 +249,7 @@ typedef unsigned int __bitwise gfp_t;#define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)/* Room for N __GFP_FOO bits */ -#define __GFP_BITS_SHIFT (26 + IS_ENABLED(CONFIG_LOCKDEP)) +#define __GFP_BITS_SHIFT (27)#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))/**
Signature · 1 line
2.42.0.459.ge4e396fd5e-goog