diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2006-09-29 05:01:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:22 -0400 |
commit | 40c99aae23529f3d069ae08836ae46fadb3fd2bd (patch) | |
tree | 5172ca1dca669de3ddc2a6aacc79e41667204aea /mm/page-writeback.c | |
parent | 153dcc54df826d2f8413c026313cba673c6bcc5b (diff) |
[PATCH] remove static variable mm/page-writeback.c:total_pages
page-writeback.c has a static local variable "total_pages", which is the
total number of pages in the system.
There is a global variable "vm_total_pages", which is the total number of
pages the VM controls.
Both are assigned from the return value of nr_free_pagecache_pages().
This patch removes the local variable and uses the global variable in that
place.
One more issue with the local static variable "total_pages" is that it is
not updated when new pages are hot-added. Since vm_total_pages is updated
when new pages are hot-added, this patch fixes that problem too.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r-- | mm/page-writeback.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 555752907dc3..efd2705e4986 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -46,7 +46,6 @@ | |||
46 | */ | 46 | */ |
47 | static long ratelimit_pages = 32; | 47 | static long ratelimit_pages = 32; |
48 | 48 | ||
49 | static long total_pages; /* The total number of pages in the machine. */ | ||
50 | static int dirty_exceeded __cacheline_aligned_in_smp; /* Dirty mem may be over limit */ | 49 | static int dirty_exceeded __cacheline_aligned_in_smp; /* Dirty mem may be over limit */ |
51 | 50 | ||
52 | /* | 51 | /* |
@@ -126,7 +125,7 @@ get_dirty_limits(long *pbackground, long *pdirty, | |||
126 | int unmapped_ratio; | 125 | int unmapped_ratio; |
127 | long background; | 126 | long background; |
128 | long dirty; | 127 | long dirty; |
129 | unsigned long available_memory = total_pages; | 128 | unsigned long available_memory = vm_total_pages; |
130 | struct task_struct *tsk; | 129 | struct task_struct *tsk; |
131 | 130 | ||
132 | #ifdef CONFIG_HIGHMEM | 131 | #ifdef CONFIG_HIGHMEM |
@@ -141,7 +140,7 @@ get_dirty_limits(long *pbackground, long *pdirty, | |||
141 | 140 | ||
142 | unmapped_ratio = 100 - ((global_page_state(NR_FILE_MAPPED) + | 141 | unmapped_ratio = 100 - ((global_page_state(NR_FILE_MAPPED) + |
143 | global_page_state(NR_ANON_PAGES)) * 100) / | 142 | global_page_state(NR_ANON_PAGES)) * 100) / |
144 | total_pages; | 143 | vm_total_pages; |
145 | 144 | ||
146 | dirty_ratio = vm_dirty_ratio; | 145 | dirty_ratio = vm_dirty_ratio; |
147 | if (dirty_ratio > unmapped_ratio / 2) | 146 | if (dirty_ratio > unmapped_ratio / 2) |
@@ -504,7 +503,7 @@ void laptop_sync_completion(void) | |||
504 | 503 | ||
505 | static void set_ratelimit(void) | 504 | static void set_ratelimit(void) |
506 | { | 505 | { |
507 | ratelimit_pages = total_pages / (num_online_cpus() * 32); | 506 | ratelimit_pages = vm_total_pages / (num_online_cpus() * 32); |
508 | if (ratelimit_pages < 16) | 507 | if (ratelimit_pages < 16) |
509 | ratelimit_pages = 16; | 508 | ratelimit_pages = 16; |
510 | if (ratelimit_pages * PAGE_CACHE_SIZE > 4096 * 1024) | 509 | if (ratelimit_pages * PAGE_CACHE_SIZE > 4096 * 1024) |
@@ -533,9 +532,7 @@ void __init page_writeback_init(void) | |||
533 | long buffer_pages = nr_free_buffer_pages(); | 532 | long buffer_pages = nr_free_buffer_pages(); |
534 | long correction; | 533 | long correction; |
535 | 534 | ||
536 | total_pages = nr_free_pagecache_pages(); | 535 | correction = (100 * 4 * buffer_pages) / vm_total_pages; |
537 | |||
538 | correction = (100 * 4 * buffer_pages) / total_pages; | ||
539 | 536 | ||
540 | if (correction < 100) { | 537 | if (correction < 100) { |
541 | dirty_background_ratio *= correction; | 538 | dirty_background_ratio *= correction; |