Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
mmzone.h File Reference
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/wait.h>
#include <linux/bitops.h>
#include <linux/cache.h>
#include <linux/threads.h>
#include <linux/numa.h>
#include <linux/init.h>
#include <linux/seqlock.h>
#include <linux/nodemask.h>
#include <linux/pageblock-flags.h>
#include <generated/bounds.h>
#include <linux/atomic.h>
#include <asm/page.h>
#include <linux/memory_hotplug.h>

Go to the source code of this file.

Data Structures

struct  free_area
 
struct  zone_reclaim_stat
 
struct  lruvec
 
struct  per_cpu_pages
 
struct  per_cpu_pageset
 
struct  zone
 
struct  zoneref
 
struct  zonelist
 
struct  pglist_data
 

Macros

#define MAX_ORDER   11
 
#define MAX_ORDER_NR_PAGES   (1 << (MAX_ORDER - 1))
 
#define PAGE_ALLOC_COSTLY_ORDER   3
 
#define is_migrate_cma(migratetype)   false
 
#define cma_wmark_pages(zone)   0
 
#define for_each_migratetype_order(order, type)
 
#define ZONE_PADDING(name)
 
#define LRU_BASE   0
 
#define LRU_ACTIVE   1
 
#define LRU_FILE   2
 
#define for_each_lru(lru)   for (lru = 0; lru < NR_LRU_LISTS; lru++)
 
#define for_each_evictable_lru(lru)   for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
 
#define LRU_ALL_FILE   (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
 
#define LRU_ALL_ANON   (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
 
#define LRU_ALL   ((1 << NR_LRU_LISTS) - 1)
 
#define ISOLATE_CLEAN   ((__force isolate_mode_t)0x1)
 
#define ISOLATE_UNMAPPED   ((__force isolate_mode_t)0x2)
 
#define ISOLATE_ASYNC_MIGRATE   ((__force isolate_mode_t)0x4)
 
#define ISOLATE_UNEVICTABLE   ((__force isolate_mode_t)0x8)
 
#define min_wmark_pages(z)   (z->watermark[WMARK_MIN])
 
#define low_wmark_pages(z)   (z->watermark[WMARK_LOW])
 
#define high_wmark_pages(z)   (z->watermark[WMARK_HIGH])
 
#define ZONES_SHIFT   0
 
#define DEF_PRIORITY   12
 
#define MAX_ZONES_PER_ZONELIST   (MAX_NUMNODES * MAX_NR_ZONES)
 
#define MAX_ZONELISTS   1
 
#define node_present_pages(nid)   (NODE_DATA(nid)->node_present_pages)
 
#define node_spanned_pages(nid)   (NODE_DATA(nid)->node_spanned_pages)
 
#define pgdat_page_nr(pgdat, pagenr)   pfn_to_page((pgdat)->node_start_pfn + (pagenr))
 
#define nid_page_nr(nid, pagenr)   pgdat_page_nr(NODE_DATA(nid),(pagenr))
 
#define node_start_pfn(nid)   (NODE_DATA(nid)->node_start_pfn)
 
#define node_end_pfn(nid)
 
#define zone_idx(zone)   ((zone) - (zone)->zone_pgdat->node_zones)
 
#define NUMA_ZONELIST_ORDER_LEN   16 /* string buffer size */
 
#define NODE_DATA(nid)   (&contig_page_data)
 
#define NODE_MEM_MAP(nid)   mem_map
 
#define for_each_online_pgdat(pgdat)
 
#define for_each_zone(zone)
 
#define for_each_populated_zone(zone)
 
#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask)
 
#define for_each_zone_zonelist(zone, z, zlist, highidx)   for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)
 
#define sparse_init()   do {} while (0)
 
#define sparse_index_init(_sec, _nid)   do {} while (0)
 
#define early_pfn_in_nid(pfn, nid)   (1)
 
#define early_pfn_valid(pfn)   (1)
 
#define pfn_valid_within(pfn)   (1)
 

Typedefs

typedef unsigned __bitwise__ isolate_mode_t
 
typedef struct pglist_data pg_data_t
 

Enumerations

enum  {
  MIGRATE_UNMOVABLE, MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE, MIGRATE_PCPTYPES,
  MIGRATE_RESERVE = MIGRATE_PCPTYPES, MIGRATE_ISOLATE, MIGRATE_TYPES
}
 
enum  zone_stat_item {
  NR_FREE_PAGES, NR_LRU_BASE, NR_INACTIVE_ANON = NR_LRU_BASE, NR_ACTIVE_ANON,
  NR_INACTIVE_FILE, NR_ACTIVE_FILE, NR_UNEVICTABLE, NR_MLOCK,
  NR_ANON_PAGES, NR_FILE_MAPPED, NR_FILE_PAGES, NR_FILE_DIRTY,
  NR_WRITEBACK, NR_SLAB_RECLAIMABLE, NR_SLAB_UNRECLAIMABLE, NR_PAGETABLE,
  NR_KERNEL_STACK, NR_UNSTABLE_NFS, NR_BOUNCE, NR_VMSCAN_WRITE,
  NR_VMSCAN_IMMEDIATE, NR_WRITEBACK_TEMP, NR_ISOLATED_ANON, NR_ISOLATED_FILE,
  NR_SHMEM, NR_DIRTIED, NR_WRITTEN, NR_ANON_TRANSPARENT_HUGEPAGES,
  NR_FREE_CMA_PAGES, NR_VM_ZONE_STAT_ITEMS
}
 
enum  lru_list {
  LRU_INACTIVE_ANON = LRU_BASE, LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
  LRU_UNEVICTABLE, NR_LRU_LISTS
}
 
enum  zone_watermarks { WMARK_MIN, WMARK_LOW, WMARK_HIGH, NR_WMARK }
 
enum  zone_type { ZONE_NORMAL, ZONE_MOVABLE, __MAX_NR_ZONES }
 
enum  zone_flags_t { ZONE_RECLAIM_LOCKED, ZONE_OOM_LOCKED, ZONE_CONGESTED }
 
enum  memmap_context { MEMMAP_EARLY, MEMMAP_HOTPLUG }
 

Functions

void build_all_zonelists (pg_data_t *pgdat, struct zone *zone)
 
void wakeup_kswapd (struct zone *zone, int order, enum zone_type classzone_idx)
 
bool zone_watermark_ok (struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags)
 
bool zone_watermark_ok_safe (struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags)
 
int init_currently_empty_zone (struct zone *zone, unsigned long start_pfn, unsigned long size, enum memmap_context context)
 
void lruvec_init (struct lruvec *lruvec)
 
int min_free_kbytes_sysctl_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
int lowmem_reserve_ratio_sysctl_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
int percpu_pagelist_fraction_sysctl_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
int sysctl_min_unmapped_ratio_sysctl_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
int sysctl_min_slab_ratio_sysctl_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
int numa_zonelist_order_handler (struct ctl_table *, int, void __user *, size_t *, loff_t *)
 
struct pglist_datafirst_online_pgdat (void)
 
struct pglist_datanext_online_pgdat (struct pglist_data *pgdat)
 
struct zonenext_zone (struct zone *zone)
 
struct zonerefnext_zones_zonelist (struct zoneref *z, enum zone_type highest_zoneidx, nodemask_t *nodes, struct zone **zone)
 
unsigned long __init node_memmap_size_bytes (int, unsigned long, unsigned long)
 

Variables

int page_group_by_mobility_disabled
 
struct zone ____cacheline_internodealigned_in_smp
 
struct pagemem_map
 
struct mutex zonelists_mutex
 
int movable_zone
 
int sysctl_lowmem_reserve_ratio [MAX_NR_ZONES-1]
 
char numa_zonelist_order []
 
struct pglist_data contig_page_data
 

Macro Definition Documentation

#define cma_wmark_pages (   zone)    0

Definition at line 69 of file mmzone.h.

#define DEF_PRIORITY   12

Definition at line 541 of file mmzone.h.

#define early_pfn_in_nid (   pfn,
  nid 
)    (1)

Definition at line 1194 of file mmzone.h.

#define early_pfn_valid (   pfn)    (1)

Definition at line 1198 of file mmzone.h.

#define for_each_evictable_lru (   lru)    for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)

Definition at line 172 of file mmzone.h.

#define for_each_lru (   lru)    for (lru = 0; lru < NR_LRU_LISTS; lru++)

Definition at line 170 of file mmzone.h.

#define for_each_migratetype_order (   order,
  type 
)
Value:
for (order = 0; order < MAX_ORDER; order++) \
for (type = 0; type < MIGRATE_TYPES; type++)

Definition at line 72 of file mmzone.h.

#define for_each_online_pgdat (   pgdat)
Value:
for (pgdat = first_online_pgdat(); \
pgdat; \
pgdat = next_online_pgdat(pgdat))

for_each_online_pgdat - helper macro to iterate over all online nodes - pointer to a pg_data_t variable

Definition at line 898 of file mmzone.h.

#define for_each_populated_zone (   zone)
Value:
for (zone = (first_online_pgdat())->node_zones; \
if (!populated_zone(zone)) \
; /* do nothing */ \
else

Definition at line 914 of file mmzone.h.

#define for_each_zone (   zone)
Value:
for (zone = (first_online_pgdat())->node_zones; \

for_each_zone - helper macro to iterate over all memory zones - pointer to struct zone variable

The user only needs to declare the zone variable, for_each_zone fills it in.

Definition at line 909 of file mmzone.h.

#define for_each_zone_zonelist (   zone,
  z,
  zlist,
  highidx 
)    for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)

for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index - The current zone in the iterator - The current pointer within zonelist->zones being iterated - The zonelist being iterated - The zone index of the highest zone to return

This iterator iterates though all zones at or below a given zone index.

Definition at line 1006 of file mmzone.h.

#define for_each_zone_zonelist_nodemask (   zone,
  z,
  zlist,
  highidx,
  nodemask 
)
Value:
for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
z = next_zones_zonelist(++z, highidx, nodemask, &zone)) \

for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask - The current zone in the iterator - The current pointer within zonelist->zones being iterated - The zonelist being iterated - The zone index of the highest zone to return - Nodemask allowed by the allocator

This iterator iterates though all zones at or below a given zone index and within a given nodemask

Definition at line 992 of file mmzone.h.

#define high_wmark_pages (   z)    (z->watermark[WMARK_HIGH])

Definition at line 236 of file mmzone.h.

#define is_migrate_cma (   migratetype)    false

Definition at line 68 of file mmzone.h.

#define ISOLATE_ASYNC_MIGRATE   ((__force isolate_mode_t)0x4)

Definition at line 220 of file mmzone.h.

#define ISOLATE_CLEAN   ((__force isolate_mode_t)0x1)

Definition at line 216 of file mmzone.h.

#define ISOLATE_UNEVICTABLE   ((__force isolate_mode_t)0x8)

Definition at line 222 of file mmzone.h.

#define ISOLATE_UNMAPPED   ((__force isolate_mode_t)0x2)

Definition at line 218 of file mmzone.h.

#define low_wmark_pages (   z)    (z->watermark[WMARK_LOW])

Definition at line 235 of file mmzone.h.

#define LRU_ACTIVE   1

Definition at line 158 of file mmzone.h.

#define LRU_ALL   ((1 << NR_LRU_LISTS) - 1)

Definition at line 213 of file mmzone.h.

#define LRU_ALL_ANON   (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))

Definition at line 212 of file mmzone.h.

#define LRU_ALL_FILE   (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))

Definition at line 211 of file mmzone.h.

#define LRU_BASE   0

Definition at line 157 of file mmzone.h.

#define LRU_FILE   2

Definition at line 159 of file mmzone.h.

#define MAX_ORDER   11

Definition at line 24 of file mmzone.h.

#define MAX_ORDER_NR_PAGES   (1 << (MAX_ORDER - 1))

Definition at line 28 of file mmzone.h.

#define MAX_ZONELISTS   1

Definition at line 623 of file mmzone.h.

#define MAX_ZONES_PER_ZONELIST   (MAX_NUMNODES * MAX_NR_ZONES)

Definition at line 544 of file mmzone.h.

#define min_wmark_pages (   z)    (z->watermark[WMARK_MIN])

Definition at line 234 of file mmzone.h.

#define nid_page_nr (   nid,
  pagenr 
)    pgdat_page_nr(NODE_DATA(nid),(pagenr))

Definition at line 729 of file mmzone.h.

#define NODE_DATA (   nid)    (&contig_page_data)

Definition at line 881 of file mmzone.h.

#define node_end_pfn (   nid)
Value:
({\
pg_data_t *__pgdat = NODE_DATA(nid);\
__pgdat->node_start_pfn + __pgdat->node_spanned_pages;\
})

Definition at line 733 of file mmzone.h.

#define NODE_MEM_MAP (   nid)    mem_map

Definition at line 882 of file mmzone.h.

#define node_present_pages (   nid)    (NODE_DATA(nid)->node_present_pages)

Definition at line 722 of file mmzone.h.

#define node_spanned_pages (   nid)    (NODE_DATA(nid)->node_spanned_pages)

Definition at line 723 of file mmzone.h.

#define node_start_pfn (   nid)    (NODE_DATA(nid)->node_start_pfn)

Definition at line 731 of file mmzone.h.

#define NUMA_ZONELIST_ORDER_LEN   16 /* string buffer size */

Definition at line 876 of file mmzone.h.

#define PAGE_ALLOC_COSTLY_ORDER   3

Definition at line 36 of file mmzone.h.

#define pfn_valid_within (   pfn)    (1)

Definition at line 1213 of file mmzone.h.

#define pgdat_page_nr (   pgdat,
  pagenr 
)    pfn_to_page((pgdat)->node_start_pfn + (pagenr))

Definition at line 727 of file mmzone.h.

#define sparse_index_init (   _sec,
  _nid 
)    do {} while (0)

Definition at line 1188 of file mmzone.h.

#define sparse_init (   void)    do {} while (0)

Definition at line 1187 of file mmzone.h.

#define zone_idx (   zone)    ((zone) - (zone)->zone_pgdat->node_zones)

Definition at line 785 of file mmzone.h.

#define ZONE_PADDING (   name)

Definition at line 102 of file mmzone.h.

#define ZONES_SHIFT   0

Definition at line 322 of file mmzone.h.

Typedef Documentation

typedef unsigned __bitwise__ isolate_mode_t

Definition at line 225 of file mmzone.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
MIGRATE_UNMOVABLE 
MIGRATE_RECLAIMABLE 
MIGRATE_MOVABLE 
MIGRATE_PCPTYPES 
MIGRATE_RESERVE 
MIGRATE_ISOLATE 
MIGRATE_TYPES 

Definition at line 38 of file mmzone.h.

enum lru_list
Enumerator:
LRU_INACTIVE_ANON 
LRU_ACTIVE_ANON 
LRU_INACTIVE_FILE 
LRU_ACTIVE_FILE 
LRU_UNEVICTABLE 
NR_LRU_LISTS 

Definition at line 161 of file mmzone.h.

Enumerator:
MEMMAP_EARLY 
MEMMAP_HOTPLUG 

Definition at line 747 of file mmzone.h.

Enumerator:
ZONE_RECLAIM_LOCKED 
ZONE_OOM_LOCKED 
ZONE_CONGESTED 

Definition at line 498 of file mmzone.h.

Enumerator:
NR_FREE_PAGES 
NR_LRU_BASE 
NR_INACTIVE_ANON 
NR_ACTIVE_ANON 
NR_INACTIVE_FILE 
NR_ACTIVE_FILE 
NR_UNEVICTABLE 
NR_MLOCK 
NR_ANON_PAGES 
NR_FILE_MAPPED 
NR_FILE_PAGES 
NR_FILE_DIRTY 
NR_WRITEBACK 
NR_SLAB_RECLAIMABLE 
NR_SLAB_UNRECLAIMABLE 
NR_PAGETABLE 
NR_KERNEL_STACK 
NR_UNSTABLE_NFS 
NR_BOUNCE 
NR_VMSCAN_WRITE 
NR_VMSCAN_IMMEDIATE 
NR_WRITEBACK_TEMP 
NR_ISOLATED_ANON 
NR_ISOLATED_FILE 
NR_SHMEM 
NR_DIRTIED 
NR_WRITTEN 
NR_ANON_TRANSPARENT_HUGEPAGES 
NR_FREE_CMA_PAGES 
NR_VM_ZONE_STAT_ITEMS 

Definition at line 105 of file mmzone.h.

enum zone_type
Enumerator:
ZONE_NORMAL 
ZONE_MOVABLE 
__MAX_NR_ZONES 

Definition at line 260 of file mmzone.h.

Enumerator:
WMARK_MIN 
WMARK_LOW 
WMARK_HIGH 
NR_WMARK 

Definition at line 227 of file mmzone.h.

Function Documentation

void build_all_zonelists ( pg_data_t pgdat,
struct zone zone 
)

Definition at line 3588 of file page_alloc.c.

struct pglist_data* first_online_pgdat ( void  )
read

Definition at line 12 of file mmzone.c.

int init_currently_empty_zone ( struct zone zone,
unsigned long  start_pfn,
unsigned long  size,
enum memmap_context  context 
)

Definition at line 4043 of file page_alloc.c.

int lowmem_reserve_ratio_sysctl_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)

Definition at line 5347 of file page_alloc.c.

void lruvec_init ( struct lruvec lruvec)

Definition at line 90 of file mmzone.c.

int min_free_kbytes_sysctl_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)
struct pglist_data* next_online_pgdat ( struct pglist_data pgdat)
read

Definition at line 17 of file mmzone.c.

struct zone* next_zone ( struct zone zone)
read

Definition at line 29 of file mmzone.c.

struct zoneref* next_zones_zonelist ( struct zoneref z,
enum zone_type  highest_zoneidx,
nodemask_t nodes,
struct zone **  zone 
)
read

next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point - The cursor used as a starting point for the search - The zone index of the highest zone to return - An optional nodemask to filter the zonelist with - The first suitable zone found is returned via this parameter

This function returns the next zone at or below a given zone index that is within the allowed nodemask using a cursor as the starting point for the search. The zoneref returned is a cursor that represents the current zone being examined. It should be advanced by one before calling next_zones_zonelist again.

Definition at line 55 of file mmzone.c.

unsigned long __init node_memmap_size_bytes ( int  ,
unsigned  long,
unsigned  long 
)

Definition at line 193 of file sparse.c.

int numa_zonelist_order_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)
int percpu_pagelist_fraction_sysctl_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)

Definition at line 5361 of file page_alloc.c.

int sysctl_min_slab_ratio_sysctl_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)
int sysctl_min_unmapped_ratio_sysctl_handler ( struct ctl_table ,
int  ,
void __user ,
size_t ,
loff_t *   
)
void wakeup_kswapd ( struct zone zone,
int  order,
enum zone_type  classzone_idx 
)

Definition at line 3010 of file vmscan.c.

bool zone_watermark_ok ( struct zone z,
int  order,
unsigned long  mark,
int  classzone_idx,
int  alloc_flags 
)

Definition at line 1658 of file page_alloc.c.

bool zone_watermark_ok_safe ( struct zone z,
int  order,
unsigned long  mark,
int  classzone_idx,
int  alloc_flags 
)

Definition at line 1665 of file page_alloc.c.

Variable Documentation

struct zone ____cacheline_internodealigned_in_smp
struct pglist_data contig_page_data

Definition at line 27 of file bootmem.c.

struct page* mem_map

Definition at line 73 of file memory.c.

int movable_zone
char numa_zonelist_order[]
int page_group_by_mobility_disabled
int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]

Definition at line 165 of file page_alloc.c.

struct mutex zonelists_mutex