@@ -21,44 +21,78 @@ typedef unsigned int __bitwise gfp_t;
21
21
* include/trace/events/mmflags.h and tools/perf/builtin-kmem.c
22
22
*/
23
23
24
+ enum {
25
+ ___GFP_DMA_BIT ,
26
+ ___GFP_HIGHMEM_BIT ,
27
+ ___GFP_DMA32_BIT ,
28
+ ___GFP_MOVABLE_BIT ,
29
+ ___GFP_RECLAIMABLE_BIT ,
30
+ ___GFP_HIGH_BIT ,
31
+ ___GFP_IO_BIT ,
32
+ ___GFP_FS_BIT ,
33
+ ___GFP_ZERO_BIT ,
34
+ ___GFP_UNUSED_BIT , /* 0x200u unused */
35
+ ___GFP_DIRECT_RECLAIM_BIT ,
36
+ ___GFP_KSWAPD_RECLAIM_BIT ,
37
+ ___GFP_WRITE_BIT ,
38
+ ___GFP_NOWARN_BIT ,
39
+ ___GFP_RETRY_MAYFAIL_BIT ,
40
+ ___GFP_NOFAIL_BIT ,
41
+ ___GFP_NORETRY_BIT ,
42
+ ___GFP_MEMALLOC_BIT ,
43
+ ___GFP_COMP_BIT ,
44
+ ___GFP_NOMEMALLOC_BIT ,
45
+ ___GFP_HARDWALL_BIT ,
46
+ ___GFP_THISNODE_BIT ,
47
+ ___GFP_ACCOUNT_BIT ,
48
+ ___GFP_ZEROTAGS_BIT ,
49
+ #ifdef CONFIG_KASAN_HW_TAGS
50
+ ___GFP_SKIP_ZERO_BIT ,
51
+ ___GFP_SKIP_KASAN_BIT ,
52
+ #endif
53
+ #ifdef CONFIG_LOCKDEP
54
+ ___GFP_NOLOCKDEP_BIT ,
55
+ #endif
56
+ ___GFP_LAST_BIT
57
+ };
58
+
24
59
/* Plain integer GFP bitmasks. Do not use this directly. */
25
- #define ___GFP_DMA 0x01u
26
- #define ___GFP_HIGHMEM 0x02u
27
- #define ___GFP_DMA32 0x04u
28
- #define ___GFP_MOVABLE 0x08u
29
- #define ___GFP_RECLAIMABLE 0x10u
30
- #define ___GFP_HIGH 0x20u
31
- #define ___GFP_IO 0x40u
32
- #define ___GFP_FS 0x80u
33
- #define ___GFP_ZERO 0x100u
60
+ #define ___GFP_DMA BIT(___GFP_DMA_BIT)
61
+ #define ___GFP_HIGHMEM BIT(___GFP_HIGHMEM_BIT)
62
+ #define ___GFP_DMA32 BIT(___GFP_DMA32_BIT)
63
+ #define ___GFP_MOVABLE BIT(___GFP_MOVABLE_BIT)
64
+ #define ___GFP_RECLAIMABLE BIT(___GFP_RECLAIMABLE_BIT)
65
+ #define ___GFP_HIGH BIT(___GFP_HIGH_BIT)
66
+ #define ___GFP_IO BIT(___GFP_IO_BIT)
67
+ #define ___GFP_FS BIT(___GFP_FS_BIT)
68
+ #define ___GFP_ZERO BIT(___GFP_ZERO_BIT)
34
69
/* 0x200u unused */
35
- #define ___GFP_DIRECT_RECLAIM 0x400u
36
- #define ___GFP_KSWAPD_RECLAIM 0x800u
37
- #define ___GFP_WRITE 0x1000u
38
- #define ___GFP_NOWARN 0x2000u
39
- #define ___GFP_RETRY_MAYFAIL 0x4000u
40
- #define ___GFP_NOFAIL 0x8000u
41
- #define ___GFP_NORETRY 0x10000u
42
- #define ___GFP_MEMALLOC 0x20000u
43
- #define ___GFP_COMP 0x40000u
44
- #define ___GFP_NOMEMALLOC 0x80000u
45
- #define ___GFP_HARDWALL 0x100000u
46
- #define ___GFP_THISNODE 0x200000u
47
- #define ___GFP_ACCOUNT 0x400000u
48
- #define ___GFP_ZEROTAGS 0x800000u
70
+ #define ___GFP_DIRECT_RECLAIM BIT(___GFP_DIRECT_RECLAIM_BIT)
71
+ #define ___GFP_KSWAPD_RECLAIM BIT(___GFP_KSWAPD_RECLAIM_BIT)
72
+ #define ___GFP_WRITE BIT(___GFP_WRITE_BIT)
73
+ #define ___GFP_NOWARN BIT(___GFP_NOWARN_BIT)
74
+ #define ___GFP_RETRY_MAYFAIL BIT(___GFP_RETRY_MAYFAIL_BIT)
75
+ #define ___GFP_NOFAIL BIT(___GFP_NOFAIL_BIT)
76
+ #define ___GFP_NORETRY BIT(___GFP_NORETRY_BIT)
77
+ #define ___GFP_MEMALLOC BIT(___GFP_MEMALLOC_BIT)
78
+ #define ___GFP_COMP BIT(___GFP_COMP_BIT)
79
+ #define ___GFP_NOMEMALLOC BIT(___GFP_NOMEMALLOC_BIT)
80
+ #define ___GFP_HARDWALL BIT(___GFP_HARDWALL_BIT)
81
+ #define ___GFP_THISNODE BIT(___GFP_THISNODE_BIT)
82
+ #define ___GFP_ACCOUNT BIT(___GFP_ACCOUNT_BIT)
83
+ #define ___GFP_ZEROTAGS BIT(___GFP_ZEROTAGS_BIT)
49
84
#ifdef CONFIG_KASAN_HW_TAGS
50
- #define ___GFP_SKIP_ZERO 0x1000000u
51
- #define ___GFP_SKIP_KASAN 0x2000000u
85
+ #define ___GFP_SKIP_ZERO BIT(___GFP_SKIP_ZERO_BIT)
86
+ #define ___GFP_SKIP_KASAN BIT(___GFP_SKIP_KASAN_BIT)
52
87
#else
53
88
#define ___GFP_SKIP_ZERO 0
54
89
#define ___GFP_SKIP_KASAN 0
55
90
#endif
56
91
#ifdef CONFIG_LOCKDEP
57
- #define ___GFP_NOLOCKDEP 0x4000000u
92
+ #define ___GFP_NOLOCKDEP BIT(___GFP_NOLOCKDEP_BIT)
58
93
#else
59
94
#define ___GFP_NOLOCKDEP 0
60
95
#endif
61
- /* If the above are modified, __GFP_BITS_SHIFT may need updating */
62
96
63
97
/*
64
98
* Physical address zone modifiers (see linux/mmzone.h - low four bits)
@@ -249,7 +283,7 @@ typedef unsigned int __bitwise gfp_t;
249
283
#define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
250
284
251
285
/* Room for N __GFP_FOO bits */
252
- #define __GFP_BITS_SHIFT (26 + IS_ENABLED(CONFIG_LOCKDEP))
286
+ #define __GFP_BITS_SHIFT ___GFP_LAST_BIT
253
287
#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
254
288
255
289
/**
0 commit comments