diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-06-30 04:55:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-30 14:25:36 -0400 |
commit | fd39fc8561be33065306bdac0e30414e1e8ac8e1 (patch) | |
tree | ae0740716eed3f850a8f7232c61caebe360bb5ae | |
parent | ce866b34ae1b7f1ce60234cf65855886ac7e7d30 (diff) |
[PATCH] zoned vm counters: conversion of nr_unstable to per zone counter
Conversion of nr_unstable to a per zone counter
We need to do some special modifications to the nfs code since there are
multiple cases of disposition and we need to have a page ref for proper
accounting.
This converts the last critical page state of the VM and therefore we need to
remove several functions that were depending on GET_PAGE_STATE_LAST in order
to make the kernel compile again. We are only left with event type counters
in page state.
[akpm@osdl.org: bugfixes]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/base/node.c | 4 | ||||
-rw-r--r-- | fs/fs-writeback.c | 2 | ||||
-rw-r--r-- | fs/nfs/write.c | 6 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 4 | ||||
-rw-r--r-- | include/linux/mmzone.h | 1 | ||||
-rw-r--r-- | include/linux/vmstat.h | 9 | ||||
-rw-r--r-- | mm/page-writeback.c | 2 | ||||
-rw-r--r-- | mm/page_alloc.c | 4 | ||||
-rw-r--r-- | mm/vmstat.c | 25 |
9 files changed, 11 insertions, 46 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index a7b3dcbbdfc9..b73d869c9d48 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -40,13 +40,11 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | |||
40 | int n; | 40 | int n; |
41 | int nid = dev->id; | 41 | int nid = dev->id; |
42 | struct sysinfo i; | 42 | struct sysinfo i; |
43 | struct page_state ps; | ||
44 | unsigned long inactive; | 43 | unsigned long inactive; |
45 | unsigned long active; | 44 | unsigned long active; |
46 | unsigned long free; | 45 | unsigned long free; |
47 | 46 | ||
48 | si_meminfo_node(&i, nid); | 47 | si_meminfo_node(&i, nid); |
49 | get_page_state_node(&ps, nid); | ||
50 | __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); | 48 | __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); |
51 | 49 | ||
52 | 50 | ||
@@ -66,6 +64,7 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | |||
66 | "Node %d Mapped: %8lu kB\n" | 64 | "Node %d Mapped: %8lu kB\n" |
67 | "Node %d AnonPages: %8lu kB\n" | 65 | "Node %d AnonPages: %8lu kB\n" |
68 | "Node %d PageTables: %8lu kB\n" | 66 | "Node %d PageTables: %8lu kB\n" |
67 | "Node %d NFS Unstable: %8lu kB\n" | ||
69 | "Node %d Slab: %8lu kB\n", | 68 | "Node %d Slab: %8lu kB\n", |
70 | nid, K(i.totalram), | 69 | nid, K(i.totalram), |
71 | nid, K(i.freeram), | 70 | nid, K(i.freeram), |
@@ -82,6 +81,7 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | |||
82 | nid, K(node_page_state(nid, NR_FILE_MAPPED)), | 81 | nid, K(node_page_state(nid, NR_FILE_MAPPED)), |
83 | nid, K(node_page_state(nid, NR_ANON_PAGES)), | 82 | nid, K(node_page_state(nid, NR_ANON_PAGES)), |
84 | nid, K(node_page_state(nid, NR_PAGETABLE)), | 83 | nid, K(node_page_state(nid, NR_PAGETABLE)), |
84 | nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), | ||
85 | nid, K(node_page_state(nid, NR_SLAB))); | 85 | nid, K(node_page_state(nid, NR_SLAB))); |
86 | n += hugetlb_report_node_meminfo(nid, buf + n); | 86 | n += hugetlb_report_node_meminfo(nid, buf + n); |
87 | return n; | 87 | return n; |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e5ad10756848..892643dc9af1 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -465,7 +465,7 @@ void sync_inodes_sb(struct super_block *sb, int wait) | |||
465 | .range_end = LLONG_MAX, | 465 | .range_end = LLONG_MAX, |
466 | }; | 466 | }; |
467 | unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); | 467 | unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); |
468 | unsigned long nr_unstable = read_page_state(nr_unstable); | 468 | unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS); |
469 | 469 | ||
470 | wbc.nr_to_write = nr_dirty + nr_unstable + | 470 | wbc.nr_to_write = nr_dirty + nr_unstable + |
471 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + | 471 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index a6d1ca513dde..f21e268705c0 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -525,7 +525,7 @@ nfs_mark_request_commit(struct nfs_page *req) | |||
525 | nfs_list_add_request(req, &nfsi->commit); | 525 | nfs_list_add_request(req, &nfsi->commit); |
526 | nfsi->ncommit++; | 526 | nfsi->ncommit++; |
527 | spin_unlock(&nfsi->req_lock); | 527 | spin_unlock(&nfsi->req_lock); |
528 | inc_page_state(nr_unstable); | 528 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
529 | mark_inode_dirty(inode); | 529 | mark_inode_dirty(inode); |
530 | } | 530 | } |
531 | #endif | 531 | #endif |
@@ -1393,7 +1393,6 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1393 | { | 1393 | { |
1394 | struct nfs_write_data *data = calldata; | 1394 | struct nfs_write_data *data = calldata; |
1395 | struct nfs_page *req; | 1395 | struct nfs_page *req; |
1396 | int res = 0; | ||
1397 | 1396 | ||
1398 | dprintk("NFS: %4d nfs_commit_done (status %d)\n", | 1397 | dprintk("NFS: %4d nfs_commit_done (status %d)\n", |
1399 | task->tk_pid, task->tk_status); | 1398 | task->tk_pid, task->tk_status); |
@@ -1405,6 +1404,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1405 | while (!list_empty(&data->pages)) { | 1404 | while (!list_empty(&data->pages)) { |
1406 | req = nfs_list_entry(data->pages.next); | 1405 | req = nfs_list_entry(data->pages.next); |
1407 | nfs_list_remove_request(req); | 1406 | nfs_list_remove_request(req); |
1407 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | ||
1408 | 1408 | ||
1409 | dprintk("NFS: commit (%s/%Ld %d@%Ld)", | 1409 | dprintk("NFS: commit (%s/%Ld %d@%Ld)", |
1410 | req->wb_context->dentry->d_inode->i_sb->s_id, | 1410 | req->wb_context->dentry->d_inode->i_sb->s_id, |
@@ -1431,9 +1431,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1431 | nfs_mark_request_dirty(req); | 1431 | nfs_mark_request_dirty(req); |
1432 | next: | 1432 | next: |
1433 | nfs_clear_page_writeback(req); | 1433 | nfs_clear_page_writeback(req); |
1434 | res++; | ||
1435 | } | 1434 | } |
1436 | sub_page_state(nr_unstable,res); | ||
1437 | } | 1435 | } |
1438 | 1436 | ||
1439 | static const struct rpc_call_ops nfs_commit_ops = { | 1437 | static const struct rpc_call_ops nfs_commit_ops = { |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 48cb35862445..eae66b41a1a4 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -120,7 +120,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
120 | { | 120 | { |
121 | struct sysinfo i; | 121 | struct sysinfo i; |
122 | int len; | 122 | int len; |
123 | struct page_state ps; | ||
124 | unsigned long inactive; | 123 | unsigned long inactive; |
125 | unsigned long active; | 124 | unsigned long active; |
126 | unsigned long free; | 125 | unsigned long free; |
@@ -129,7 +128,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
129 | struct vmalloc_info vmi; | 128 | struct vmalloc_info vmi; |
130 | long cached; | 129 | long cached; |
131 | 130 | ||
132 | get_page_state(&ps); | ||
133 | get_zone_counts(&active, &inactive, &free); | 131 | get_zone_counts(&active, &inactive, &free); |
134 | 132 | ||
135 | /* | 133 | /* |
@@ -172,6 +170,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
172 | "Mapped: %8lu kB\n" | 170 | "Mapped: %8lu kB\n" |
173 | "Slab: %8lu kB\n" | 171 | "Slab: %8lu kB\n" |
174 | "PageTables: %8lu kB\n" | 172 | "PageTables: %8lu kB\n" |
173 | "NFS Unstable: %8lu kB\n" | ||
175 | "CommitLimit: %8lu kB\n" | 174 | "CommitLimit: %8lu kB\n" |
176 | "Committed_AS: %8lu kB\n" | 175 | "Committed_AS: %8lu kB\n" |
177 | "VmallocTotal: %8lu kB\n" | 176 | "VmallocTotal: %8lu kB\n" |
@@ -196,6 +195,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
196 | K(global_page_state(NR_FILE_MAPPED)), | 195 | K(global_page_state(NR_FILE_MAPPED)), |
197 | K(global_page_state(NR_SLAB)), | 196 | K(global_page_state(NR_SLAB)), |
198 | K(global_page_state(NR_PAGETABLE)), | 197 | K(global_page_state(NR_PAGETABLE)), |
198 | K(global_page_state(NR_UNSTABLE_NFS)), | ||
199 | K(allowed), | 199 | K(allowed), |
200 | K(committed), | 200 | K(committed), |
201 | (unsigned long)VMALLOC_TOTAL >> 10, | 201 | (unsigned long)VMALLOC_TOTAL >> 10, |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 885cc9727001..e9d80697f555 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -55,6 +55,7 @@ enum zone_stat_item { | |||
55 | NR_PAGETABLE, /* used for pagetables */ | 55 | NR_PAGETABLE, /* used for pagetables */ |
56 | NR_FILE_DIRTY, | 56 | NR_FILE_DIRTY, |
57 | NR_WRITEBACK, | 57 | NR_WRITEBACK, |
58 | NR_UNSTABLE_NFS, /* NFS unstable pages */ | ||
58 | NR_VM_ZONE_STAT_ITEMS }; | 59 | NR_VM_ZONE_STAT_ITEMS }; |
59 | 60 | ||
60 | struct per_cpu_pages { | 61 | struct per_cpu_pages { |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 60c2e0382ceb..9de2a41c885c 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -22,13 +22,6 @@ | |||
22 | * commented here. | 22 | * commented here. |
23 | */ | 23 | */ |
24 | struct page_state { | 24 | struct page_state { |
25 | unsigned long nr_unstable; /* NFS unstable pages */ | ||
26 | #define GET_PAGE_STATE_LAST nr_unstable | ||
27 | |||
28 | /* | ||
29 | * The below are zeroed by get_page_state(). Use get_full_page_state() | ||
30 | * to add up all these. | ||
31 | */ | ||
32 | unsigned long pgpgin; /* Disk reads */ | 25 | unsigned long pgpgin; /* Disk reads */ |
33 | unsigned long pgpgout; /* Disk writes */ | 26 | unsigned long pgpgout; /* Disk writes */ |
34 | unsigned long pswpin; /* swap reads */ | 27 | unsigned long pswpin; /* swap reads */ |
@@ -77,8 +70,6 @@ struct page_state { | |||
77 | unsigned long nr_bounce; /* pages for bounce buffers */ | 70 | unsigned long nr_bounce; /* pages for bounce buffers */ |
78 | }; | 71 | }; |
79 | 72 | ||
80 | extern void get_page_state(struct page_state *ret); | ||
81 | extern void get_page_state_node(struct page_state *ret, int node); | ||
82 | extern void get_full_page_state(struct page_state *ret); | 73 | extern void get_full_page_state(struct page_state *ret); |
83 | extern unsigned long read_page_state_offset(unsigned long offset); | 74 | extern unsigned long read_page_state_offset(unsigned long offset); |
84 | extern void mod_page_state_offset(unsigned long offset, unsigned long delta); | 75 | extern void mod_page_state_offset(unsigned long offset, unsigned long delta); |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3cfdff4b1985..de9836f43db5 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -110,7 +110,7 @@ struct writeback_state | |||
110 | static void get_writeback_state(struct writeback_state *wbs) | 110 | static void get_writeback_state(struct writeback_state *wbs) |
111 | { | 111 | { |
112 | wbs->nr_dirty = global_page_state(NR_FILE_DIRTY); | 112 | wbs->nr_dirty = global_page_state(NR_FILE_DIRTY); |
113 | wbs->nr_unstable = read_page_state(nr_unstable); | 113 | wbs->nr_unstable = global_page_state(NR_UNSTABLE_NFS); |
114 | wbs->nr_mapped = global_page_state(NR_FILE_MAPPED) + | 114 | wbs->nr_mapped = global_page_state(NR_FILE_MAPPED) + |
115 | global_page_state(NR_ANON_PAGES); | 115 | global_page_state(NR_ANON_PAGES); |
116 | wbs->nr_writeback = global_page_state(NR_WRITEBACK); | 116 | wbs->nr_writeback = global_page_state(NR_WRITEBACK); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a12e894a8bca..6aa2c31f513b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1271,7 +1271,6 @@ void si_meminfo_node(struct sysinfo *val, int nid) | |||
1271 | */ | 1271 | */ |
1272 | void show_free_areas(void) | 1272 | void show_free_areas(void) |
1273 | { | 1273 | { |
1274 | struct page_state ps; | ||
1275 | int cpu, temperature; | 1274 | int cpu, temperature; |
1276 | unsigned long active; | 1275 | unsigned long active; |
1277 | unsigned long inactive; | 1276 | unsigned long inactive; |
@@ -1303,7 +1302,6 @@ void show_free_areas(void) | |||
1303 | } | 1302 | } |
1304 | } | 1303 | } |
1305 | 1304 | ||
1306 | get_page_state(&ps); | ||
1307 | get_zone_counts(&active, &inactive, &free); | 1305 | get_zone_counts(&active, &inactive, &free); |
1308 | 1306 | ||
1309 | printk("Free pages: %11ukB (%ukB HighMem)\n", | 1307 | printk("Free pages: %11ukB (%ukB HighMem)\n", |
@@ -1316,7 +1314,7 @@ void show_free_areas(void) | |||
1316 | inactive, | 1314 | inactive, |
1317 | global_page_state(NR_FILE_DIRTY), | 1315 | global_page_state(NR_FILE_DIRTY), |
1318 | global_page_state(NR_WRITEBACK), | 1316 | global_page_state(NR_WRITEBACK), |
1319 | ps.nr_unstable, | 1317 | global_page_state(NR_UNSTABLE_NFS), |
1320 | nr_free_pages(), | 1318 | nr_free_pages(), |
1321 | global_page_state(NR_SLAB), | 1319 | global_page_state(NR_SLAB), |
1322 | global_page_state(NR_FILE_MAPPED), | 1320 | global_page_state(NR_FILE_MAPPED), |
diff --git a/mm/vmstat.c b/mm/vmstat.c index e84c7e520a1d..9dc270aed5c4 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -45,28 +45,6 @@ static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask) | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | void get_page_state_node(struct page_state *ret, int node) | ||
49 | { | ||
50 | int nr; | ||
51 | cpumask_t mask = node_to_cpumask(node); | ||
52 | |||
53 | nr = offsetof(struct page_state, GET_PAGE_STATE_LAST); | ||
54 | nr /= sizeof(unsigned long); | ||
55 | |||
56 | __get_page_state(ret, nr+1, &mask); | ||
57 | } | ||
58 | |||
59 | void get_page_state(struct page_state *ret) | ||
60 | { | ||
61 | int nr; | ||
62 | cpumask_t mask = CPU_MASK_ALL; | ||
63 | |||
64 | nr = offsetof(struct page_state, GET_PAGE_STATE_LAST); | ||
65 | nr /= sizeof(unsigned long); | ||
66 | |||
67 | __get_page_state(ret, nr + 1, &mask); | ||
68 | } | ||
69 | |||
70 | void get_full_page_state(struct page_state *ret) | 48 | void get_full_page_state(struct page_state *ret) |
71 | { | 49 | { |
72 | cpumask_t mask = CPU_MASK_ALL; | 50 | cpumask_t mask = CPU_MASK_ALL; |
@@ -402,10 +380,9 @@ static char *vmstat_text[] = { | |||
402 | "nr_page_table_pages", | 380 | "nr_page_table_pages", |
403 | "nr_dirty", | 381 | "nr_dirty", |
404 | "nr_writeback", | 382 | "nr_writeback", |
405 | |||
406 | /* Page state */ | ||
407 | "nr_unstable", | 383 | "nr_unstable", |
408 | 384 | ||
385 | /* Event counters */ | ||
409 | "pgpgin", | 386 | "pgpgin", |
410 | "pgpgout", | 387 | "pgpgout", |
411 | "pswpin", | 388 | "pswpin", |