diff options
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 105 |
1 files changed, 97 insertions, 8 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 428328a05fa1..35a7b5e19465 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -81,21 +81,31 @@ struct zone_padding { | |||
81 | enum zone_stat_item { | 81 | enum zone_stat_item { |
82 | /* First 128 byte cacheline (assuming 64 bit words) */ | 82 | /* First 128 byte cacheline (assuming 64 bit words) */ |
83 | NR_FREE_PAGES, | 83 | NR_FREE_PAGES, |
84 | NR_INACTIVE, | 84 | NR_LRU_BASE, |
85 | NR_ACTIVE, | 85 | NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */ |
86 | NR_ACTIVE_ANON, /* " " " " " */ | ||
87 | NR_INACTIVE_FILE, /* " " " " " */ | ||
88 | NR_ACTIVE_FILE, /* " " " " " */ | ||
89 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
90 | NR_UNEVICTABLE, /* " " " " " */ | ||
91 | NR_MLOCK, /* mlock()ed pages found and moved off LRU */ | ||
92 | #else | ||
93 | NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */ | ||
94 | NR_MLOCK = NR_ACTIVE_FILE, | ||
95 | #endif | ||
86 | NR_ANON_PAGES, /* Mapped anonymous pages */ | 96 | NR_ANON_PAGES, /* Mapped anonymous pages */ |
87 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. | 97 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. |
88 | only modified from process context */ | 98 | only modified from process context */ |
89 | NR_FILE_PAGES, | 99 | NR_FILE_PAGES, |
90 | NR_FILE_DIRTY, | 100 | NR_FILE_DIRTY, |
91 | NR_WRITEBACK, | 101 | NR_WRITEBACK, |
92 | /* Second 128 byte cacheline */ | ||
93 | NR_SLAB_RECLAIMABLE, | 102 | NR_SLAB_RECLAIMABLE, |
94 | NR_SLAB_UNRECLAIMABLE, | 103 | NR_SLAB_UNRECLAIMABLE, |
95 | NR_PAGETABLE, /* used for pagetables */ | 104 | NR_PAGETABLE, /* used for pagetables */ |
96 | NR_UNSTABLE_NFS, /* NFS unstable pages */ | 105 | NR_UNSTABLE_NFS, /* NFS unstable pages */ |
97 | NR_BOUNCE, | 106 | NR_BOUNCE, |
98 | NR_VMSCAN_WRITE, | 107 | NR_VMSCAN_WRITE, |
108 | /* Second 128 byte cacheline */ | ||
99 | NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ | 109 | NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ |
100 | #ifdef CONFIG_NUMA | 110 | #ifdef CONFIG_NUMA |
101 | NUMA_HIT, /* allocated in intended node */ | 111 | NUMA_HIT, /* allocated in intended node */ |
@@ -107,6 +117,55 @@ enum zone_stat_item { | |||
107 | #endif | 117 | #endif |
108 | NR_VM_ZONE_STAT_ITEMS }; | 118 | NR_VM_ZONE_STAT_ITEMS }; |
109 | 119 | ||
120 | /* | ||
121 | * We do arithmetic on the LRU lists in various places in the code, | ||
122 | * so it is important to keep the active lists LRU_ACTIVE higher in | ||
123 | * the array than the corresponding inactive lists, and to keep | ||
124 | * the *_FILE lists LRU_FILE higher than the corresponding _ANON lists. | ||
125 | * | ||
126 | * This has to be kept in sync with the statistics in zone_stat_item | ||
127 | * above and the descriptions in vmstat_text in mm/vmstat.c | ||
128 | */ | ||
129 | #define LRU_BASE 0 | ||
130 | #define LRU_ACTIVE 1 | ||
131 | #define LRU_FILE 2 | ||
132 | |||
133 | enum lru_list { | ||
134 | LRU_INACTIVE_ANON = LRU_BASE, | ||
135 | LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, | ||
136 | LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, | ||
137 | LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, | ||
138 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
139 | LRU_UNEVICTABLE, | ||
140 | #else | ||
141 | LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */ | ||
142 | #endif | ||
143 | NR_LRU_LISTS | ||
144 | }; | ||
145 | |||
146 | #define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) | ||
147 | |||
148 | #define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) | ||
149 | |||
150 | static inline int is_file_lru(enum lru_list l) | ||
151 | { | ||
152 | return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); | ||
153 | } | ||
154 | |||
155 | static inline int is_active_lru(enum lru_list l) | ||
156 | { | ||
157 | return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); | ||
158 | } | ||
159 | |||
160 | static inline int is_unevictable_lru(enum lru_list l) | ||
161 | { | ||
162 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
163 | return (l == LRU_UNEVICTABLE); | ||
164 | #else | ||
165 | return 0; | ||
166 | #endif | ||
167 | } | ||
168 | |||
110 | struct per_cpu_pages { | 169 | struct per_cpu_pages { |
111 | int count; /* number of pages in the list */ | 170 | int count; /* number of pages in the list */ |
112 | int high; /* high watermark, emptying needed */ | 171 | int high; /* high watermark, emptying needed */ |
@@ -251,10 +310,22 @@ struct zone { | |||
251 | 310 | ||
252 | /* Fields commonly accessed by the page reclaim scanner */ | 311 | /* Fields commonly accessed by the page reclaim scanner */ |
253 | spinlock_t lru_lock; | 312 | spinlock_t lru_lock; |
254 | struct list_head active_list; | 313 | struct { |
255 | struct list_head inactive_list; | 314 | struct list_head list; |
256 | unsigned long nr_scan_active; | 315 | unsigned long nr_scan; |
257 | unsigned long nr_scan_inactive; | 316 | } lru[NR_LRU_LISTS]; |
317 | |||
318 | /* | ||
319 | * The pageout code in vmscan.c keeps track of how many of the | ||
320 | * mem/swap backed and file backed pages are refeferenced. | ||
321 | * The higher the rotated/scanned ratio, the more valuable | ||
322 | * that cache is. | ||
323 | * | ||
324 | * The anon LRU stats live in [0], file LRU stats in [1] | ||
325 | */ | ||
326 | unsigned long recent_rotated[2]; | ||
327 | unsigned long recent_scanned[2]; | ||
328 | |||
258 | unsigned long pages_scanned; /* since last reclaim */ | 329 | unsigned long pages_scanned; /* since last reclaim */ |
259 | unsigned long flags; /* zone flags, see below */ | 330 | unsigned long flags; /* zone flags, see below */ |
260 | 331 | ||
@@ -276,6 +347,12 @@ struct zone { | |||
276 | */ | 347 | */ |
277 | int prev_priority; | 348 | int prev_priority; |
278 | 349 | ||
350 | /* | ||
351 | * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on | ||
352 | * this zone's LRU. Maintained by the pageout code. | ||
353 | */ | ||
354 | unsigned int inactive_ratio; | ||
355 | |||
279 | 356 | ||
280 | ZONE_PADDING(_pad2_) | 357 | ZONE_PADDING(_pad2_) |
281 | /* Rarely used or read-mostly fields */ | 358 | /* Rarely used or read-mostly fields */ |
@@ -524,8 +601,11 @@ typedef struct pglist_data { | |||
524 | struct zone node_zones[MAX_NR_ZONES]; | 601 | struct zone node_zones[MAX_NR_ZONES]; |
525 | struct zonelist node_zonelists[MAX_ZONELISTS]; | 602 | struct zonelist node_zonelists[MAX_ZONELISTS]; |
526 | int nr_zones; | 603 | int nr_zones; |
527 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | 604 | #ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ |
528 | struct page *node_mem_map; | 605 | struct page *node_mem_map; |
606 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
607 | struct page_cgroup *node_page_cgroup; | ||
608 | #endif | ||
529 | #endif | 609 | #endif |
530 | struct bootmem_data *bdata; | 610 | struct bootmem_data *bdata; |
531 | #ifdef CONFIG_MEMORY_HOTPLUG | 611 | #ifdef CONFIG_MEMORY_HOTPLUG |
@@ -854,6 +934,7 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn) | |||
854 | #endif | 934 | #endif |
855 | 935 | ||
856 | struct page; | 936 | struct page; |
937 | struct page_cgroup; | ||
857 | struct mem_section { | 938 | struct mem_section { |
858 | /* | 939 | /* |
859 | * This is, logically, a pointer to an array of struct | 940 | * This is, logically, a pointer to an array of struct |
@@ -871,6 +952,14 @@ struct mem_section { | |||
871 | 952 | ||
872 | /* See declaration of similar field in struct zone */ | 953 | /* See declaration of similar field in struct zone */ |
873 | unsigned long *pageblock_flags; | 954 | unsigned long *pageblock_flags; |
955 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
956 | /* | ||
957 | * If !SPARSEMEM, pgdat doesn't have page_cgroup pointer. We use | ||
958 | * section. (see memcontrol.h/page_cgroup.h about this.) | ||
959 | */ | ||
960 | struct page_cgroup *page_cgroup; | ||
961 | unsigned long pad; | ||
962 | #endif | ||
874 | }; | 963 | }; |
875 | 964 | ||
876 | #ifdef CONFIG_SPARSEMEM_EXTREME | 965 | #ifdef CONFIG_SPARSEMEM_EXTREME |