ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
gfp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk).
4 *
5 * (C) SGI 2006, Christoph Lameter
6 * Cleaned up and restructured to ease the addition of alternative
7 * implementations of SLAB allocators.
8 * (C) Linux Foundation 2008-2013
9 * Unified interface for all slab allocators
10 */
11
12// TODO: Replace hardcoded MAX_ALLOC_SIZE with a dynamically obtained value
13#define MAX_ALLOC_SIZE 1024*1024 // Maximum allocatable size set to 1MB for example
14
15
16#define ZERO_SIZE_PTR ((void *)16)
17
18/* Maximum allocatable size */
19#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
20/* Maximum size for which we actually use a slab cache */
21#define KMALLOC_MAX_CACHE_SIZE 1024
22/* Maximum order allocatable via the slab allocator */
23#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_MAX - PAGE_SHIFT)
24
25/*
26 * Kmalloc subsystem.
27 */
28#ifndef KMALLOC_MIN_SIZE
29#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
30#endif
31
32
33
34#define __GFP_DMA 0x01u
35#define __GFP_HIGHMEM 0x02u
36#define __GFP_DMA32 0x04u
37#define __GFP_ZERO 0x40u
38#define __GFP_NOWARN 0x80u
39#define __GFP_REPEAT 0x400u
40#define __GFP_NOFAIL 0x800u
41#define __GFP_NORETRY 0x1000u
42#define __GFP_MEMALLOC 0x2000u
43#define __GFP_COMP 0x4000u
44#define __GFP_NO_KSWAPD 0x8000u
45#define __GFP_OTHER_NODE 0x10000u
46#define __GFP_WRITE 0x20000u
47#define __GFP_HARDWALL 0x40000u
48#define __GFP_THISNODE 0x80000u
49#define __GFP_ATOMIC 0x100000u
50#define __GFP_ACCOUNT 0x200000u
51#define __GFP_RECLAIM 0x01u
52#define __GFP_IO 0x02u
53#define __GFP_FS 0x04u
54
55#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
56#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
57#define GFP_KERNEL_ACCOUNT (GFP_KERNEL | __GFP_ACCOUNT)
58#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM)
59#define GFP_NOIO (__GFP_RECLAIM)
60#define GFP_NOFS (__GFP_RECLAIM | __GFP_IO)
61#define GFP_USER (__GFP_RECLAIM | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
62#define GFP_DMA __GFP_DMA
63#define GFP_DMA32 __GFP_DMA32
64#define GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM)
65#define GFP_HIGHUSER_MOVABLE (GFP_HIGHUSER | __GFP_MOVABLE | \
66 __GFP_SKIP_KASAN_POISON)
67#define GFP_TRANSHUGE_LIGHT ((GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
68 __GFP_NOMEMALLOC | __GFP_NOWARN) & ~__GFP_RECLAIM)
69#define GFP_TRANSHUGE (GFP_TRANSHUGE_LIGHT | __GFP_DIRECT_RECLAIM)
70
71/* Convert GFP flags to their corresponding migrate type */
72#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
73#define GFP_MOVABLE_SHIFT 3
74
75// Define size_t if it's not already defined. This is often
76// done in stddef.h or sys/types.h, so you might #include one of those instead.
77
78// Define gfp_t and a few example flags.
79typedef unsigned int gfp_t;
unsigned int gfp_t
Definition gfp.h:79