Commit 2d1d43f6 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Linus Torvalds

[PATCH] call mm/page-writeback.c:set_ratelimit() when new pages are hot-added

ratelimit_pages in page-writeback.c is recalculated (in set_ratelimit())
every time a CPU is hot-added/removed.  But this value is not recalculated
when new pages are hot-added.

This patch fixes that problem by calling set_ratelimit() when new pages
are hot-added.

[akpm@osdl.org: cleanups]
Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 40c99aae
...@@ -117,6 +117,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping, ...@@ -117,6 +117,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
loff_t pos, loff_t count); loff_t pos, loff_t count);
void set_page_dirty_balance(struct page *page); void set_page_dirty_balance(struct page *page);
void writeback_set_ratelimit(void);
/* pdflush.c */ /* pdflush.c */
extern int nr_pdflush_threads; /* Global so it can be exported to sysctl extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pagevec.h> #include <linux/pagevec.h>
#include <linux/writeback.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/cpu.h> #include <linux/cpu.h>
...@@ -192,6 +193,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) ...@@ -192,6 +193,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
if (need_zonelists_rebuild) if (need_zonelists_rebuild)
build_all_zonelists(); build_all_zonelists();
vm_total_pages = nr_free_pagecache_pages(); vm_total_pages = nr_free_pagecache_pages();
writeback_set_ratelimit();
return 0; return 0;
} }
......
...@@ -501,7 +501,7 @@ void laptop_sync_completion(void) ...@@ -501,7 +501,7 @@ void laptop_sync_completion(void)
* will write six megabyte chunks, max. * will write six megabyte chunks, max.
*/ */
static void set_ratelimit(void) void writeback_set_ratelimit(void)
{ {
ratelimit_pages = vm_total_pages / (num_online_cpus() * 32); ratelimit_pages = vm_total_pages / (num_online_cpus() * 32);
if (ratelimit_pages < 16) if (ratelimit_pages < 16)
...@@ -513,7 +513,7 @@ static void set_ratelimit(void) ...@@ -513,7 +513,7 @@ static void set_ratelimit(void)
static int __cpuinit static int __cpuinit
ratelimit_handler(struct notifier_block *self, unsigned long u, void *v) ratelimit_handler(struct notifier_block *self, unsigned long u, void *v)
{ {
set_ratelimit(); writeback_set_ratelimit();
return 0; return 0;
} }
...@@ -546,7 +546,7 @@ void __init page_writeback_init(void) ...@@ -546,7 +546,7 @@ void __init page_writeback_init(void)
vm_dirty_ratio = 1; vm_dirty_ratio = 1;
} }
mod_timer(&wb_timer, jiffies + dirty_writeback_interval); mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
set_ratelimit(); writeback_set_ratelimit();
register_cpu_notifier(&ratelimit_nb); register_cpu_notifier(&ratelimit_nb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment