diff options
author | Rik van Riel <riel@redhat.com> | 2008-10-18 23:26:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:50:25 -0400 |
commit | 4f98a2fee8acdb4ac84545df98cccecfd130f8db (patch) | |
tree | 035a2937f4c3e2f7b4269412041c073ac646937c /fs/proc/proc_misc.c | |
parent | b2e185384f534781fd22f5ce170b2ad26f97df70 (diff) |
vmscan: split LRU lists into anon & file sets
Split the LRU lists in two, one set for pages that are backed by real file
systems ("file") and one for pages that are backed by memory and swap
("anon"). The latter includes tmpfs.
The advantage of doing this is that the VM will not have to scan over lots
of anonymous pages (which we generally do not want to swap out), just to
find the page cache pages that it should evict.
This patch has the infrastructure and a basic policy to balance how much
we scan the anon lists and how much we scan the file lists. The big
policy changes are in separate patches.
[lee.schermerhorn@hp.com: collect lru meminfo statistics from correct offset]
[kosaki.motohiro@jp.fujitsu.com: prevent incorrect oom under split_lru]
[kosaki.motohiro@jp.fujitsu.com: fix pagevec_move_tail() doesn't treat unevictable page]
[hugh@veritas.com: memcg swapbacked pages active]
[hugh@veritas.com: splitlru: BDI_CAP_SWAP_BACKED]
[akpm@linux-foundation.org: fix /proc/vmstat units]
[nishimura@mxp.nes.nec.co.jp: memcg: fix handling of shmem migration]
[kosaki.motohiro@jp.fujitsu.com: adjust Quicklists field of /proc/meminfo]
[kosaki.motohiro@jp.fujitsu.com: fix style issue of get_scan_ratio()]
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 59ea42e1ef03..b8edb2860557 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -136,6 +136,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
136 | unsigned long allowed; | 136 | unsigned long allowed; |
137 | struct vmalloc_info vmi; | 137 | struct vmalloc_info vmi; |
138 | long cached; | 138 | long cached; |
139 | unsigned long pages[NR_LRU_LISTS]; | ||
140 | int lru; | ||
139 | 141 | ||
140 | /* | 142 | /* |
141 | * display in kilobytes. | 143 | * display in kilobytes. |
@@ -154,51 +156,62 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
154 | 156 | ||
155 | get_vmalloc_info(&vmi); | 157 | get_vmalloc_info(&vmi); |
156 | 158 | ||
159 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) | ||
160 | pages[lru] = global_page_state(NR_LRU_BASE + lru); | ||
161 | |||
157 | /* | 162 | /* |
158 | * Tagged format, for easy grepping and expansion. | 163 | * Tagged format, for easy grepping and expansion. |
159 | */ | 164 | */ |
160 | len = sprintf(page, | 165 | len = sprintf(page, |
161 | "MemTotal: %8lu kB\n" | 166 | "MemTotal: %8lu kB\n" |
162 | "MemFree: %8lu kB\n" | 167 | "MemFree: %8lu kB\n" |
163 | "Buffers: %8lu kB\n" | 168 | "Buffers: %8lu kB\n" |
164 | "Cached: %8lu kB\n" | 169 | "Cached: %8lu kB\n" |
165 | "SwapCached: %8lu kB\n" | 170 | "SwapCached: %8lu kB\n" |
166 | "Active: %8lu kB\n" | 171 | "Active: %8lu kB\n" |
167 | "Inactive: %8lu kB\n" | 172 | "Inactive: %8lu kB\n" |
173 | "Active(anon): %8lu kB\n" | ||
174 | "Inactive(anon): %8lu kB\n" | ||
175 | "Active(file): %8lu kB\n" | ||
176 | "Inactive(file): %8lu kB\n" | ||
168 | #ifdef CONFIG_HIGHMEM | 177 | #ifdef CONFIG_HIGHMEM |
169 | "HighTotal: %8lu kB\n" | 178 | "HighTotal: %8lu kB\n" |
170 | "HighFree: %8lu kB\n" | 179 | "HighFree: %8lu kB\n" |
171 | "LowTotal: %8lu kB\n" | 180 | "LowTotal: %8lu kB\n" |
172 | "LowFree: %8lu kB\n" | 181 | "LowFree: %8lu kB\n" |
173 | #endif | 182 | #endif |
174 | "SwapTotal: %8lu kB\n" | 183 | "SwapTotal: %8lu kB\n" |
175 | "SwapFree: %8lu kB\n" | 184 | "SwapFree: %8lu kB\n" |
176 | "Dirty: %8lu kB\n" | 185 | "Dirty: %8lu kB\n" |
177 | "Writeback: %8lu kB\n" | 186 | "Writeback: %8lu kB\n" |
178 | "AnonPages: %8lu kB\n" | 187 | "AnonPages: %8lu kB\n" |
179 | "Mapped: %8lu kB\n" | 188 | "Mapped: %8lu kB\n" |
180 | "Slab: %8lu kB\n" | 189 | "Slab: %8lu kB\n" |
181 | "SReclaimable: %8lu kB\n" | 190 | "SReclaimable: %8lu kB\n" |
182 | "SUnreclaim: %8lu kB\n" | 191 | "SUnreclaim: %8lu kB\n" |
183 | "PageTables: %8lu kB\n" | 192 | "PageTables: %8lu kB\n" |
184 | #ifdef CONFIG_QUICKLIST | 193 | #ifdef CONFIG_QUICKLIST |
185 | "Quicklists: %8lu kB\n" | 194 | "Quicklists: %8lu kB\n" |
186 | #endif | 195 | #endif |
187 | "NFS_Unstable: %8lu kB\n" | 196 | "NFS_Unstable: %8lu kB\n" |
188 | "Bounce: %8lu kB\n" | 197 | "Bounce: %8lu kB\n" |
189 | "WritebackTmp: %8lu kB\n" | 198 | "WritebackTmp: %8lu kB\n" |
190 | "CommitLimit: %8lu kB\n" | 199 | "CommitLimit: %8lu kB\n" |
191 | "Committed_AS: %8lu kB\n" | 200 | "Committed_AS: %8lu kB\n" |
192 | "VmallocTotal: %8lu kB\n" | 201 | "VmallocTotal: %8lu kB\n" |
193 | "VmallocUsed: %8lu kB\n" | 202 | "VmallocUsed: %8lu kB\n" |
194 | "VmallocChunk: %8lu kB\n", | 203 | "VmallocChunk: %8lu kB\n", |
195 | K(i.totalram), | 204 | K(i.totalram), |
196 | K(i.freeram), | 205 | K(i.freeram), |
197 | K(i.bufferram), | 206 | K(i.bufferram), |
198 | K(cached), | 207 | K(cached), |
199 | K(total_swapcache_pages), | 208 | K(total_swapcache_pages), |
200 | K(global_page_state(NR_ACTIVE)), | 209 | K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]), |
201 | K(global_page_state(NR_INACTIVE)), | 210 | K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]), |
211 | K(pages[LRU_ACTIVE_ANON]), | ||
212 | K(pages[LRU_INACTIVE_ANON]), | ||
213 | K(pages[LRU_ACTIVE_FILE]), | ||
214 | K(pages[LRU_INACTIVE_FILE]), | ||
202 | #ifdef CONFIG_HIGHMEM | 215 | #ifdef CONFIG_HIGHMEM |
203 | K(i.totalhigh), | 216 | K(i.totalhigh), |
204 | K(i.freehigh), | 217 | K(i.freehigh), |