Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
gfp.h File Reference
#include <linux/mmzone.h>
#include <linux/stddef.h>
#include <linux/linkage.h>
#include <linux/topology.h>
#include <linux/mmdebug.h>

Go to the source code of this file.

Macros

#define ___GFP_DMA   0x01u
 
#define ___GFP_HIGHMEM   0x02u
 
#define ___GFP_DMA32   0x04u
 
#define ___GFP_MOVABLE   0x08u
 
#define ___GFP_WAIT   0x10u
 
#define ___GFP_HIGH   0x20u
 
#define ___GFP_IO   0x40u
 
#define ___GFP_FS   0x80u
 
#define ___GFP_COLD   0x100u
 
#define ___GFP_NOWARN   0x200u
 
#define ___GFP_REPEAT   0x400u
 
#define ___GFP_NOFAIL   0x800u
 
#define ___GFP_NORETRY   0x1000u
 
#define ___GFP_MEMALLOC   0x2000u
 
#define ___GFP_COMP   0x4000u
 
#define ___GFP_ZERO   0x8000u
 
#define ___GFP_NOMEMALLOC   0x10000u
 
#define ___GFP_HARDWALL   0x20000u
 
#define ___GFP_THISNODE   0x40000u
 
#define ___GFP_RECLAIMABLE   0x80000u
 
#define ___GFP_NOTRACK   0x200000u
 
#define ___GFP_NO_KSWAPD   0x400000u
 
#define ___GFP_OTHER_NODE   0x800000u
 
#define ___GFP_WRITE   0x1000000u
 
#define __GFP_DMA   ((__force gfp_t)___GFP_DMA)
 
#define __GFP_HIGHMEM   ((__force gfp_t)___GFP_HIGHMEM)
 
#define __GFP_DMA32   ((__force gfp_t)___GFP_DMA32)
 
#define __GFP_MOVABLE   ((__force gfp_t)___GFP_MOVABLE) /* Page is movable */
 
#define GFP_ZONEMASK   (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
 
#define __GFP_WAIT   ((__force gfp_t)___GFP_WAIT) /* Can wait and reschedule? */
 
#define __GFP_HIGH   ((__force gfp_t)___GFP_HIGH) /* Should access emergency pools? */
 
#define __GFP_IO   ((__force gfp_t)___GFP_IO) /* Can start physical IO? */
 
#define __GFP_FS   ((__force gfp_t)___GFP_FS) /* Can call down to low-level FS? */
 
#define __GFP_COLD   ((__force gfp_t)___GFP_COLD) /* Cache-cold page required */
 
#define __GFP_NOWARN   ((__force gfp_t)___GFP_NOWARN) /* Suppress page allocation failure warning */
 
#define __GFP_REPEAT   ((__force gfp_t)___GFP_REPEAT) /* See above */
 
#define __GFP_NOFAIL   ((__force gfp_t)___GFP_NOFAIL) /* See above */
 
#define __GFP_NORETRY   ((__force gfp_t)___GFP_NORETRY) /* See above */
 
#define __GFP_MEMALLOC   ((__force gfp_t)___GFP_MEMALLOC)/* Allow access to emergency reserves */
 
#define __GFP_COMP   ((__force gfp_t)___GFP_COMP) /* Add compound page metadata */
 
#define __GFP_ZERO   ((__force gfp_t)___GFP_ZERO) /* Return zeroed page on success */
 
#define __GFP_NOMEMALLOC
 
#define __GFP_HARDWALL   ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */
 
#define __GFP_THISNODE   ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */
 
#define __GFP_RECLAIMABLE   ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
 
#define __GFP_NOTRACK   ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
 
#define __GFP_NO_KSWAPD   ((__force gfp_t)___GFP_NO_KSWAPD)
 
#define __GFP_OTHER_NODE   ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
 
#define __GFP_WRITE   ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
 
#define __GFP_NOTRACK_FALSE_POSITIVE   (__GFP_NOTRACK)
 
#define __GFP_BITS_SHIFT   25 /* Room for N __GFP_FOO bits */
 
#define __GFP_BITS_MASK   ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
 
#define GFP_NOWAIT   (GFP_ATOMIC & ~__GFP_HIGH)
 
#define GFP_ATOMIC   (__GFP_HIGH)
 
#define GFP_NOIO   (__GFP_WAIT)
 
#define GFP_NOFS   (__GFP_WAIT | __GFP_IO)
 
#define GFP_KERNEL   (__GFP_WAIT | __GFP_IO | __GFP_FS)
 
#define GFP_TEMPORARY
 
#define GFP_USER   (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
 
#define GFP_HIGHUSER
 
#define GFP_HIGHUSER_MOVABLE
 
#define GFP_IOFS   (__GFP_IO | __GFP_FS)
 
#define GFP_TRANSHUGE
 
#define GFP_THISNODE   ((__force gfp_t)0)
 
#define GFP_MOVABLE_MASK   (__GFP_RECLAIMABLE|__GFP_MOVABLE)
 
#define GFP_RECLAIM_MASK
 
#define GFP_BOOT_MASK   (__GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS))
 
#define GFP_CONSTRAINT_MASK   (__GFP_HARDWALL|__GFP_THISNODE)
 
#define GFP_SLAB_BUG_MASK   (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)
 
#define GFP_DMA   __GFP_DMA
 
#define GFP_DMA32   __GFP_DMA32
 
#define OPT_ZONE_HIGHMEM   ZONE_NORMAL
 
#define OPT_ZONE_DMA   ZONE_NORMAL
 
#define OPT_ZONE_DMA32   ZONE_NORMAL
 
#define GFP_ZONE_TABLE
 
#define GFP_ZONE_BAD
 
#define alloc_pages(gfp_mask, order)   alloc_pages_node(numa_node_id(), gfp_mask, order)
 
#define alloc_pages_vma(gfp_mask, order, vma, addr, node)   alloc_pages(gfp_mask, order)
 
#define alloc_page(gfp_mask)   alloc_pages(gfp_mask, 0)
 
#define alloc_page_vma(gfp_mask, vma, addr)   alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id())
 
#define alloc_page_vma_node(gfp_mask, vma, addr, node)   alloc_pages_vma(gfp_mask, 0, vma, addr, node)
 
#define __get_free_page(gfp_mask)   __get_free_pages((gfp_mask), 0)
 
#define __get_dma_pages(gfp_mask, order)   __get_free_pages((gfp_mask) | GFP_DMA, (order))
 
#define __free_page(page)   __free_pages((page), 0)
 
#define free_page(addr)   free_pages((addr), 0)
 

Functions

struct page__alloc_pages_nodemask (gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, nodemask_t *nodemask)
 
unsigned long __get_free_pages (gfp_t gfp_mask, unsigned int order)
 
unsigned long get_zeroed_page (gfp_t gfp_mask)
 
voidalloc_pages_exact (size_t size, gfp_t gfp_mask)
 
void free_pages_exact (void *virt, size_t size)
 
voidalloc_pages_exact_nid (int nid, size_t size, gfp_t gfp_mask)
 
void __free_pages (struct page *page, unsigned int order)
 
void free_pages (unsigned long addr, unsigned int order)
 
void free_hot_cold_page (struct page *page, int cold)
 
void free_hot_cold_page_list (struct list_head *list, int cold)
 
void page_alloc_init (void)
 
void drain_zone_pages (struct zone *zone, struct per_cpu_pages *pcp)
 
void drain_all_pages (void)
 
void drain_local_pages (void *dummy)
 
bool gfp_pfmemalloc_allowed (gfp_t gfp_mask)
 
void pm_restrict_gfp_mask (void)
 
void pm_restore_gfp_mask (void)
 

Variables

gfp_t gfp_allowed_mask
 

Macro Definition Documentation

#define ___GFP_COLD   0x100u

Definition at line 21 of file gfp.h.

#define ___GFP_COMP   0x4000u

Definition at line 27 of file gfp.h.

#define ___GFP_DMA   0x01u

Definition at line 13 of file gfp.h.

#define ___GFP_DMA32   0x04u

Definition at line 15 of file gfp.h.

#define ___GFP_FS   0x80u

Definition at line 20 of file gfp.h.

#define ___GFP_HARDWALL   0x20000u

Definition at line 30 of file gfp.h.

#define ___GFP_HIGH   0x20u

Definition at line 18 of file gfp.h.

#define ___GFP_HIGHMEM   0x02u

Definition at line 14 of file gfp.h.

#define ___GFP_IO   0x40u

Definition at line 19 of file gfp.h.

#define ___GFP_MEMALLOC   0x2000u

Definition at line 26 of file gfp.h.

#define ___GFP_MOVABLE   0x08u

Definition at line 16 of file gfp.h.

#define ___GFP_NO_KSWAPD   0x400000u

Definition at line 34 of file gfp.h.

#define ___GFP_NOFAIL   0x800u

Definition at line 24 of file gfp.h.

#define ___GFP_NOMEMALLOC   0x10000u

Definition at line 29 of file gfp.h.

#define ___GFP_NORETRY   0x1000u

Definition at line 25 of file gfp.h.

#define ___GFP_NOTRACK   0x200000u

Definition at line 33 of file gfp.h.

#define ___GFP_NOWARN   0x200u

Definition at line 22 of file gfp.h.

#define ___GFP_OTHER_NODE   0x800000u

Definition at line 35 of file gfp.h.

#define ___GFP_RECLAIMABLE   0x80000u

Definition at line 32 of file gfp.h.

#define ___GFP_REPEAT   0x400u

Definition at line 23 of file gfp.h.

#define ___GFP_THISNODE   0x40000u

Definition at line 31 of file gfp.h.

#define ___GFP_WAIT   0x10u

Definition at line 17 of file gfp.h.

#define ___GFP_WRITE   0x1000000u

Definition at line 36 of file gfp.h.

#define ___GFP_ZERO   0x8000u

Definition at line 28 of file gfp.h.

#define __free_page (   page)    __free_pages((page), 0)

Definition at line 363 of file gfp.h.

#define __get_dma_pages (   gfp_mask,
  order 
)    __get_free_pages((gfp_mask) | GFP_DMA, (order))

Definition at line 355 of file gfp.h.

#define __get_free_page (   gfp_mask)    __get_free_pages((gfp_mask), 0)

Definition at line 352 of file gfp.h.

#define __GFP_BITS_MASK   ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))

Definition at line 96 of file gfp.h.

#define __GFP_BITS_SHIFT   25 /* Room for N __GFP_FOO bits */

Definition at line 95 of file gfp.h.

#define __GFP_COLD   ((__force gfp_t)___GFP_COLD) /* Cache-cold page required */

Definition at line 71 of file gfp.h.

#define __GFP_COMP   ((__force gfp_t)___GFP_COMP) /* Add compound page metadata */

Definition at line 77 of file gfp.h.

#define __GFP_DMA   ((__force gfp_t)___GFP_DMA)

Definition at line 47 of file gfp.h.

#define __GFP_DMA32   ((__force gfp_t)___GFP_DMA32)

Definition at line 49 of file gfp.h.

#define __GFP_FS   ((__force gfp_t)___GFP_FS) /* Can call down to low-level FS? */

Definition at line 70 of file gfp.h.

#define __GFP_HARDWALL   ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */

Definition at line 80 of file gfp.h.

#define __GFP_HIGH   ((__force gfp_t)___GFP_HIGH) /* Should access emergency pools? */

Definition at line 68 of file gfp.h.

#define __GFP_HIGHMEM   ((__force gfp_t)___GFP_HIGHMEM)

Definition at line 48 of file gfp.h.

#define __GFP_IO   ((__force gfp_t)___GFP_IO) /* Can start physical IO? */

Definition at line 69 of file gfp.h.

#define __GFP_MEMALLOC   ((__force gfp_t)___GFP_MEMALLOC)/* Allow access to emergency reserves */

Definition at line 76 of file gfp.h.

#define __GFP_MOVABLE   ((__force gfp_t)___GFP_MOVABLE) /* Page is movable */

Definition at line 50 of file gfp.h.

#define __GFP_NO_KSWAPD   ((__force gfp_t)___GFP_NO_KSWAPD)

Definition at line 85 of file gfp.h.

#define __GFP_NOFAIL   ((__force gfp_t)___GFP_NOFAIL) /* See above */

Definition at line 74 of file gfp.h.

#define __GFP_NOMEMALLOC
Value:
((__force gfp_t)___GFP_NOMEMALLOC) /* Don't use emergency reserves.
* This takes precedence over the
* __GFP_MEMALLOC flag if both are
* set
*/

Definition at line 79 of file gfp.h.

#define __GFP_NORETRY   ((__force gfp_t)___GFP_NORETRY) /* See above */

Definition at line 75 of file gfp.h.

#define __GFP_NOTRACK   ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */

Definition at line 83 of file gfp.h.

#define __GFP_NOTRACK_FALSE_POSITIVE   (__GFP_NOTRACK)

Definition at line 93 of file gfp.h.

#define __GFP_NOWARN   ((__force gfp_t)___GFP_NOWARN) /* Suppress page allocation failure warning */

Definition at line 72 of file gfp.h.

#define __GFP_OTHER_NODE   ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */

Definition at line 86 of file gfp.h.

#define __GFP_RECLAIMABLE   ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */

Definition at line 82 of file gfp.h.

#define __GFP_REPEAT   ((__force gfp_t)___GFP_REPEAT) /* See above */

Definition at line 73 of file gfp.h.

#define __GFP_THISNODE   ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */

Definition at line 81 of file gfp.h.

#define __GFP_WAIT   ((__force gfp_t)___GFP_WAIT) /* Can wait and reschedule? */

Definition at line 67 of file gfp.h.

#define __GFP_WRITE   ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */

Definition at line 87 of file gfp.h.

#define __GFP_ZERO   ((__force gfp_t)___GFP_ZERO) /* Return zeroed page on success */

Definition at line 78 of file gfp.h.

#define alloc_page (   gfp_mask)    alloc_pages(gfp_mask, 0)

Definition at line 338 of file gfp.h.

#define alloc_page_vma (   gfp_mask,
  vma,
  addr 
)    alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id())

Definition at line 339 of file gfp.h.

#define alloc_page_vma_node (   gfp_mask,
  vma,
  addr,
  node 
)    alloc_pages_vma(gfp_mask, 0, vma, addr, node)

Definition at line 341 of file gfp.h.

#define alloc_pages (   gfp_mask,
  order 
)    alloc_pages_node(numa_node_id(), gfp_mask, order)

Definition at line 333 of file gfp.h.

#define alloc_pages_vma (   gfp_mask,
  order,
  vma,
  addr,
  node 
)    alloc_pages(gfp_mask, order)

Definition at line 335 of file gfp.h.

#define free_page (   addr)    free_pages((addr), 0)

Definition at line 364 of file gfp.h.

#define GFP_ATOMIC   (__GFP_HIGH)

Definition at line 101 of file gfp.h.

#define GFP_BOOT_MASK   (__GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS))

Definition at line 133 of file gfp.h.

#define GFP_CONSTRAINT_MASK   (__GFP_HARDWALL|__GFP_THISNODE)

Definition at line 136 of file gfp.h.

#define GFP_DMA   __GFP_DMA

Definition at line 144 of file gfp.h.

#define GFP_DMA32   __GFP_DMA32

Definition at line 147 of file gfp.h.

#define GFP_HIGHUSER
Value:
__GFP_HIGHMEM)

Definition at line 108 of file gfp.h.

#define GFP_HIGHUSER_MOVABLE
Value:
__GFP_HARDWALL | __GFP_HIGHMEM | \
__GFP_MOVABLE)

Definition at line 110 of file gfp.h.

#define GFP_IOFS   (__GFP_IO | __GFP_FS)

Definition at line 113 of file gfp.h.

#define GFP_KERNEL   (__GFP_WAIT | __GFP_IO | __GFP_FS)

Definition at line 104 of file gfp.h.

#define GFP_MOVABLE_MASK   (__GFP_RECLAIMABLE|__GFP_MOVABLE)

Definition at line 125 of file gfp.h.

#define GFP_NOFS   (__GFP_WAIT | __GFP_IO)

Definition at line 103 of file gfp.h.

#define GFP_NOIO   (__GFP_WAIT)

Definition at line 102 of file gfp.h.

#define GFP_NOWAIT   (GFP_ATOMIC & ~__GFP_HIGH)

Definition at line 99 of file gfp.h.

#define GFP_RECLAIM_MASK
Value:

Definition at line 128 of file gfp.h.

#define GFP_SLAB_BUG_MASK   (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)

Definition at line 139 of file gfp.h.

#define GFP_TEMPORARY
Value:
__GFP_RECLAIMABLE)

Definition at line 105 of file gfp.h.

#define GFP_THISNODE   ((__force gfp_t)0)

Definition at line 121 of file gfp.h.

#define GFP_TRANSHUGE
Value:
__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
__GFP_NO_KSWAPD)

Definition at line 114 of file gfp.h.

#define GFP_USER   (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)

Definition at line 107 of file gfp.h.

#define GFP_ZONE_BAD
#define GFP_ZONE_TABLE
#define GFP_ZONEMASK   (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)

Definition at line 51 of file gfp.h.

#define OPT_ZONE_DMA   ZONE_NORMAL

Definition at line 171 of file gfp.h.

#define OPT_ZONE_DMA32   ZONE_NORMAL

Definition at line 177 of file gfp.h.

#define OPT_ZONE_HIGHMEM   ZONE_NORMAL

Definition at line 165 of file gfp.h.

Function Documentation

struct page* __alloc_pages_nodemask ( gfp_t  gfp_mask,
unsigned int  order,
struct zonelist zonelist,
nodemask_t nodemask 
)
read

Definition at line 2590 of file page_alloc.c.

void __free_pages ( struct page page,
unsigned int  order 
)

Definition at line 2682 of file page_alloc.c.

unsigned long __get_free_pages ( gfp_t  gfp_mask,
unsigned int  order 
)

Definition at line 2659 of file page_alloc.c.

void* alloc_pages_exact ( size_t  size,
gfp_t  gfp_mask 
)

alloc_pages_exact - allocate an exact number physically-contiguous pages. : the number of bytes to allocate : GFP flags for the allocation

This function is similar to alloc_pages(), except that it allocates the minimum number of pages to satisfy the request. alloc_pages() can only allocate memory in power-of-two pages.

This function is also limited by MAX_ORDER.

Memory allocated by this function must be released by free_pages_exact().

Definition at line 2732 of file page_alloc.c.

void* alloc_pages_exact_nid ( int  nid,
size_t  size,
gfp_t  gfp_mask 
)

alloc_pages_exact_nid - allocate an exact number of physically-contiguous pages on a node. : the preferred node ID where memory should be allocated : the number of bytes to allocate : GFP flags for the allocation

Like alloc_pages_exact(), but try to allocate on node nid first before falling back. Note this is not alloc_pages_exact_node() which allocates on a specific node, but is not exact.

Definition at line 2754 of file page_alloc.c.

void drain_all_pages ( void  )

Definition at line 1218 of file page_alloc.c.

void drain_local_pages ( void dummy)

Definition at line 1204 of file page_alloc.c.

void drain_zone_pages ( struct zone zone,
struct per_cpu_pages pcp 
)
void free_hot_cold_page ( struct page page,
int  cold 
)

Definition at line 1293 of file page_alloc.c.

void free_hot_cold_page_list ( struct list_head list,
int  cold 
)

Definition at line 1341 of file page_alloc.c.

void free_pages ( unsigned long  addr,
unsigned int  order 
)

Definition at line 2694 of file page_alloc.c.

void free_pages_exact ( void virt,
size_t  size 
)

free_pages_exact - release memory allocated via alloc_pages_exact() : the value returned by alloc_pages_exact. : size of allocation, same value as passed to alloc_pages_exact().

Release the memory allocated by a previous call to alloc_pages_exact.

Definition at line 2771 of file page_alloc.c.

unsigned long get_zeroed_page ( gfp_t  gfp_mask)

Definition at line 2676 of file page_alloc.c.

bool gfp_pfmemalloc_allowed ( gfp_t  gfp_mask)

Definition at line 2376 of file page_alloc.c.

void page_alloc_init ( void  )

Definition at line 5043 of file page_alloc.c.

void pm_restore_gfp_mask ( void  )
void pm_restrict_gfp_mask ( void  )

Variable Documentation

gfp_t gfp_allowed_mask