include/linux/gfp_types.h

Source file repositories/reference/linux-study-clean/include/linux/gfp_types.h

File Facts

System
Linux kernel
Corpus path
include/linux/gfp_types.h
Extension
.h
Size
17248 bytes
Lines
392
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef __LINUX_GFP_TYPES_H
#define __LINUX_GFP_TYPES_H

#include <linux/bits.h>

/* The typedef is in types.h but we want the documentation here */
#if 0
/**
 * typedef gfp_t - Memory allocation flags.
 *
 * GFP flags are commonly used throughout Linux to indicate how memory
 * should be allocated.  The GFP acronym stands for get_free_pages(),
 * the underlying memory allocation function.  Not every GFP flag is
 * supported by every function which may allocate memory.  Most users
 * will want to use a plain ``GFP_KERNEL``.
 */
typedef unsigned int __bitwise gfp_t;
#endif

/*
 * In case of changes, please don't forget to update
 * include/trace/events/mmflags.h and tools/perf/builtin-kmem.c
 */

enum {
	___GFP_DMA_BIT,
	___GFP_HIGHMEM_BIT,
	___GFP_DMA32_BIT,
	___GFP_MOVABLE_BIT,
	___GFP_RECLAIMABLE_BIT,
	___GFP_HIGH_BIT,
	___GFP_IO_BIT,
	___GFP_FS_BIT,
	___GFP_ZERO_BIT,
	___GFP_UNUSED_BIT,	/* 0x200u unused */
	___GFP_DIRECT_RECLAIM_BIT,
	___GFP_KSWAPD_RECLAIM_BIT,
	___GFP_WRITE_BIT,
	___GFP_NOWARN_BIT,
	___GFP_RETRY_MAYFAIL_BIT,
	___GFP_NOFAIL_BIT,
	___GFP_NORETRY_BIT,
	___GFP_MEMALLOC_BIT,
	___GFP_COMP_BIT,
	___GFP_NOMEMALLOC_BIT,
	___GFP_HARDWALL_BIT,
	___GFP_THISNODE_BIT,
	___GFP_ACCOUNT_BIT,
	___GFP_ZEROTAGS_BIT,
#ifdef CONFIG_KASAN_HW_TAGS
	___GFP_SKIP_ZERO_BIT,
	___GFP_SKIP_KASAN_BIT,
#endif
#ifdef CONFIG_LOCKDEP
	___GFP_NOLOCKDEP_BIT,
#endif
	___GFP_NO_OBJ_EXT_BIT,
	___GFP_LAST_BIT
};

/* Plain integer GFP bitmasks. Do not use this directly. */
#define ___GFP_DMA		BIT(___GFP_DMA_BIT)
#define ___GFP_HIGHMEM		BIT(___GFP_HIGHMEM_BIT)
#define ___GFP_DMA32		BIT(___GFP_DMA32_BIT)
#define ___GFP_MOVABLE		BIT(___GFP_MOVABLE_BIT)
#define ___GFP_RECLAIMABLE	BIT(___GFP_RECLAIMABLE_BIT)
#define ___GFP_HIGH		BIT(___GFP_HIGH_BIT)
#define ___GFP_IO		BIT(___GFP_IO_BIT)
#define ___GFP_FS		BIT(___GFP_FS_BIT)
#define ___GFP_ZERO		BIT(___GFP_ZERO_BIT)
/* 0x200u unused */
#define ___GFP_DIRECT_RECLAIM	BIT(___GFP_DIRECT_RECLAIM_BIT)
#define ___GFP_KSWAPD_RECLAIM	BIT(___GFP_KSWAPD_RECLAIM_BIT)
#define ___GFP_WRITE		BIT(___GFP_WRITE_BIT)
#define ___GFP_NOWARN		BIT(___GFP_NOWARN_BIT)
#define ___GFP_RETRY_MAYFAIL	BIT(___GFP_RETRY_MAYFAIL_BIT)
#define ___GFP_NOFAIL		BIT(___GFP_NOFAIL_BIT)
#define ___GFP_NORETRY		BIT(___GFP_NORETRY_BIT)
#define ___GFP_MEMALLOC		BIT(___GFP_MEMALLOC_BIT)
#define ___GFP_COMP		BIT(___GFP_COMP_BIT)
#define ___GFP_NOMEMALLOC	BIT(___GFP_NOMEMALLOC_BIT)
#define ___GFP_HARDWALL		BIT(___GFP_HARDWALL_BIT)
#define ___GFP_THISNODE		BIT(___GFP_THISNODE_BIT)
#define ___GFP_ACCOUNT		BIT(___GFP_ACCOUNT_BIT)
#define ___GFP_ZEROTAGS		BIT(___GFP_ZEROTAGS_BIT)
#ifdef CONFIG_KASAN_HW_TAGS
#define ___GFP_SKIP_ZERO	BIT(___GFP_SKIP_ZERO_BIT)
#define ___GFP_SKIP_KASAN	BIT(___GFP_SKIP_KASAN_BIT)
#else
#define ___GFP_SKIP_ZERO	0

Annotation

Implementation Notes