Subversion Repositories Kolibri OS

Rev

Rev 6102 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6102 Rev 6936
Line 1... Line 1...
1
#ifndef __LINUX_GFP_H
1
#ifndef __LINUX_GFP_H
2
#define __LINUX_GFP_H
2
#define __LINUX_GFP_H
Line 3... Line 3...
3
 
3
 
4
#include 
4
#include 
5
#include 
5
#include 
6
#include 
6
#include 
Line 7... Line 7...
7
#include 
7
#include 
Line 27... Line 27...
27
#define ___GFP_ZERO		0x8000u
27
#define ___GFP_ZERO		0x8000u
28
#define ___GFP_NOMEMALLOC	0x10000u
28
#define ___GFP_NOMEMALLOC	0x10000u
29
#define ___GFP_HARDWALL		0x20000u
29
#define ___GFP_HARDWALL		0x20000u
30
#define ___GFP_THISNODE		0x40000u
30
#define ___GFP_THISNODE		0x40000u
31
#define ___GFP_ATOMIC		0x80000u
31
#define ___GFP_ATOMIC		0x80000u
32
#define ___GFP_NOACCOUNT	0x100000u
32
#define ___GFP_ACCOUNT		0x100000u
33
#define ___GFP_NOTRACK		0x200000u
33
#define ___GFP_NOTRACK		0x200000u
34
#define ___GFP_DIRECT_RECLAIM	0x400000u
34
#define ___GFP_DIRECT_RECLAIM	0x400000u
35
#define ___GFP_OTHER_NODE	0x800000u
35
#define ___GFP_OTHER_NODE	0x800000u
36
#define ___GFP_WRITE		0x1000000u
36
#define ___GFP_WRITE		0x1000000u
37
#define ___GFP_KSWAPD_RECLAIM	0x2000000u
37
#define ___GFP_KSWAPD_RECLAIM	0x2000000u
Line 70... Line 70...
70
 *
70
 *
71
 * __GFP_HARDWALL enforces the cpuset memory allocation policy.
71
 * __GFP_HARDWALL enforces the cpuset memory allocation policy.
72
 *
72
 *
73
 * __GFP_THISNODE forces the allocation to be satisified from the requested
73
 * __GFP_THISNODE forces the allocation to be satisified from the requested
74
 *   node with no fallbacks or placement policy enforcements.
74
 *   node with no fallbacks or placement policy enforcements.
-
 
75
 *
-
 
76
 * __GFP_ACCOUNT causes the allocation to be accounted to kmemcg (only relevant
-
 
77
 *   to kmem allocations).
75
 */
78
 */
76
#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)
79
#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)
77
#define __GFP_WRITE	((__force gfp_t)___GFP_WRITE)
80
#define __GFP_WRITE	((__force gfp_t)___GFP_WRITE)
78
#define __GFP_HARDWALL   ((__force gfp_t)___GFP_HARDWALL)
81
#define __GFP_HARDWALL   ((__force gfp_t)___GFP_HARDWALL)
79
#define __GFP_THISNODE	((__force gfp_t)___GFP_THISNODE)
82
#define __GFP_THISNODE	((__force gfp_t)___GFP_THISNODE)
-
 
83
#define __GFP_ACCOUNT	((__force gfp_t)___GFP_ACCOUNT)
Line 80... Line 84...
80
 
84
 
81
/*
85
/*
82
 * Watermark modifiers -- controls access to emergency reserves
86
 * Watermark modifiers -- controls access to emergency reserves
83
 *
87
 *
Line 101... Line 105...
101
 */
105
 */
102
#define __GFP_ATOMIC	((__force gfp_t)___GFP_ATOMIC)
106
#define __GFP_ATOMIC	((__force gfp_t)___GFP_ATOMIC)
103
#define __GFP_HIGH	((__force gfp_t)___GFP_HIGH)
107
#define __GFP_HIGH	((__force gfp_t)___GFP_HIGH)
104
#define __GFP_MEMALLOC	((__force gfp_t)___GFP_MEMALLOC)
108
#define __GFP_MEMALLOC	((__force gfp_t)___GFP_MEMALLOC)
105
#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC)
109
#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC)
106
#define __GFP_NOACCOUNT	((__force gfp_t)___GFP_NOACCOUNT)
-
 
Line 107... Line 110...
107
 
110
 
108
/*
111
/*
109
 * Reclaim modifiers
112
 * Reclaim modifiers
110
 *
113
 *
Line 194... Line 197...
194
 *   watermark is applied to allow access to "atomic reserves"
197
 *   watermark is applied to allow access to "atomic reserves"
195
 *
198
 *
196
 * GFP_KERNEL is typical for kernel-internal allocations. The caller requires
199
 * GFP_KERNEL is typical for kernel-internal allocations. The caller requires
197
 *   ZONE_NORMAL or a lower zone for direct access but can direct reclaim.
200
 *   ZONE_NORMAL or a lower zone for direct access but can direct reclaim.
198
 *
201
 *
-
 
202
 * GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is
-
 
203
 *   accounted to kmemcg.
-
 
204
 *
199
 * GFP_NOWAIT is for kernel allocations that should not stall for direct
205
 * GFP_NOWAIT is for kernel allocations that should not stall for direct
200
 *   reclaim, start physical IO or use any filesystem callback.
206
 *   reclaim, start physical IO or use any filesystem callback.
201
 *
207
 *
202
 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages
208
 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages
203
 *   that do not require the starting of any physical IO.
209
 *   that do not require the starting of any physical IO.
Line 233... Line 239...
233
 *   that will fail quickly if memory is not available and will not wake
239
 *   that will fail quickly if memory is not available and will not wake
234
 *   kswapd on failure.
240
 *   kswapd on failure.
235
 */
241
 */
236
#define GFP_ATOMIC	(__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
242
#define GFP_ATOMIC	(__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
237
#define GFP_KERNEL	(__GFP_RECLAIM | __GFP_IO | __GFP_FS)
243
#define GFP_KERNEL	(__GFP_RECLAIM | __GFP_IO | __GFP_FS)
-
 
244
#define GFP_KERNEL_ACCOUNT (GFP_KERNEL | __GFP_ACCOUNT)
238
#define GFP_NOWAIT	(__GFP_KSWAPD_RECLAIM)
245
#define GFP_NOWAIT	(__GFP_KSWAPD_RECLAIM)
239
#define GFP_NOIO	(__GFP_RECLAIM)
246
#define GFP_NOIO	(__GFP_RECLAIM)
240
#define GFP_NOFS	(__GFP_RECLAIM | __GFP_IO)
247
#define GFP_NOFS	(__GFP_RECLAIM | __GFP_IO)
241
#define GFP_TEMPORARY	(__GFP_RECLAIM | __GFP_IO | __GFP_FS | \
248
#define GFP_TEMPORARY	(__GFP_RECLAIM | __GFP_IO | __GFP_FS | \
242
			 __GFP_RECLAIMABLE)
249
			 __GFP_RECLAIMABLE)
Line 247... Line 254...
247
#define GFP_HIGHUSER_MOVABLE	(GFP_HIGHUSER | __GFP_MOVABLE)
254
#define GFP_HIGHUSER_MOVABLE	(GFP_HIGHUSER | __GFP_MOVABLE)
248
#define GFP_TRANSHUGE	((GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
255
#define GFP_TRANSHUGE	((GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
249
			 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) & \
256
			 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) & \
250
			 ~__GFP_KSWAPD_RECLAIM)
257
			 ~__GFP_KSWAPD_RECLAIM)
Line 251... Line -...
251
 
-
 
252
/* Convert GFP flags to their corresponding migrate type */
-
 
253
#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
-
 
254
#define GFP_MOVABLE_SHIFT 3
-
 
255
 
-
 
256
#undef GFP_MOVABLE_MASK
-
 
257
#undef GFP_MOVABLE_SHIFT
-
 
258
 
258
 
259
static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
259
static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
260
{
260
{
261
	return (bool __force)(gfp_flags & __GFP_DIRECT_RECLAIM);
261
	return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
Line 262... Line 262...
262
}
262
}
263
 
263
 
264
#ifdef CONFIG_HIGHMEM
264
#ifdef CONFIG_HIGHMEM