MentOS
0.8.0
The Mentoring Operating System
|
Useful GFP flag combinations. More...
Macros | |
#define | GFP_ATOMIC (__GFP_HIGH | __GFP_ATOMIC | __GFP_KSWAPD_RECLAIM) |
Users can not sleep and need the allocation to succeed. A lower watermark is applied to allow access to "atomic reserves". | |
#define | GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS) |
is typical for kernel-internal allocations. The caller requires ZONE_NORMAL or a lower zone for direct access but can direct reclaim. | |
#define | GFP_NOWAIT (__GFP_KSWAPD_RECLAIM) |
is for kernel allocations that should not stall for direct reclaim, start physical IO or use any filesystem callback. | |
#define | GFP_NOIO (__GFP_RECLAIM) |
will use direct reclaim to discard clean pages or slab pages that do not require the starting of any physical IO. Please try to avoid using this flag directly and instead use memalloc_noio_{save,restore} to mark the whole scope which cannot perform any IO with a short explanation why. All allocation requests will inherit GFP_NOIO implicitly. | |
#define | GFP_NOFS (__GFP_RECLAIM | __GFP_IO) |
will use direct reclaim but will not use any filesystem interfaces. Please try to avoid using this flag directly and instead use memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't recurse into the FS layer with a short explanation why. All allocation requests will inherit GFP_NOFS implicitly. | |
#define | GFP_USER (__GFP_RECLAIM | __GFP_IO | __GFP_FS) |
is for userspace allocations that also need to be directly accessibly by the kernel or hardware. It is typically used by hardware for buffers that are mapped to userspace (e.g. graphics) that hardware still must DMA to. cpuset limits are enforced for these allocations. | |
#define | GFP_DMA (__GFP_DMA) |
exists for historical reasons and should be avoided where possible. The flags indicates that the caller requires that the lowest zone be used (ZONE_DMA or 16M on x86-64). Ideally, this would be removed but it would require careful auditing as some users really require it and others use the flag to avoid lowmem reserves in ZONE_DMA and treat the lowest zone as a type of emergency reserve. | |
#define | GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM) |
is for userspace allocations that may be mapped to userspace, do not need to be directly accessible by the kernel but that cannot move once in use. An example may be a hardware allocation that maps data directly into userspace but has no addressing limitations. | |
Useful GFP flag combinations.
Useful GFP flag combinations that are commonly used. It is recommended that subsystems start with one of these combinations and then set/clear the flags as necessary.