diff options
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; |