XenevaOS
Loading...
Searching...
No Matches
XenevaOS
BaseHdr
linux
gfp.h
Go to the documentation of this file.
1
#ifndef __LINUX_GFP_H__
2
#define __LINUX_GFP_H__
3
4
/*
5
* DCL <linux/gfp.h> -- allocation flags. mainline's is 16.8 KB and brings
6
* mmzone.h -> nodemask.h -> numa.h -> percpu behind it, i.e. the entire NUMA
7
* surface, in exchange for two constants.
8
*
9
* DCL already owns both, in <linux/kernel.h>:
10
* :55 typedef unsigned int gfp_t;
11
* :111 #define GFP_KERNEL 0
12
* :112 #define GFP_ATOMIC 1
13
* and <linux/slab.h> already accepts mainline's two-argument kmalloc(size,
14
* gfp) by dropping the flag (`#define kmalloc(size, flags) dcl_kmalloc(size)`).
15
* So there is nothing to *define* here -- this header exists so a mainline
16
* source that writes `#include <linux/gfp.h>` resolves, and it routes rather
17
* than redefines: a second gfp_t and a second GFP_KERNEL in one translation
18
* unit would be a redefinition error, and mainline's GFP_KERNEL is a bitmask
19
* of __GFP_RECLAIM|__GFP_IO|__GFP_FS that nothing here interprets.
20
*
21
* Routing the two constants is not the same as having no vocabulary, though,
22
* and the include below is the difference: mainline's gfp.h includes
23
* gfp_types.h, which carries the individual __GFP_* flags. drm_managed.h
24
* needs one of them -- drmm_kzalloc() and drmm_kzalloc_array() write
25
* `flags | __GFP_ZERO`. Without the include those two inline functions fail
26
* in the *header* that declares them, so no drm caller ever reaches the
27
* -ENOSYS path gfpflags_allow_blocking() sits beside.
28
*/
29
#include <linux/kernel.h>
30
#include <
linux/gfp_types.h
>
31
32
/*
33
* gfpflags_allow_blocking(gfp) -- "may this allocation sleep?". DCL's
34
* allocator never sleeps and never refuses, so the honest answer for every
35
* flag word this tree builds (GFP_KERNEL is 0, see kernel.h:111) is yes;
36
* the one caller, xarray.c:339, takes either arm to the same
37
* kmem_cache_alloc_lru() and only wants the lock dropped before it. The
38
* parameter is still read at the call site, so it stays a real parameter
39
* of a real function rather than a macro that would vanish it.
40
*/
41
static
inline
int
gfpflags_allow_blocking(
gfp_t
gfp)
42
{
43
(void)gfp;
44
return
1;
45
}
46
47
#endif
/* __LINUX_GFP_H__ */
gfp_types.h
gfp_t
unsigned int gfp_t
Definition
kernel.h:56
Generated by
1.9.8