From: Chandra Seetharaman 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. Signed-off-by: Chandra Seetharaman Signed-off-by: Andrew Morton --- mm/memory_hotplug.c | 2 ++ mm/page-writeback.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff -puN mm/memory_hotplug.c~call-mm-page-writebackcset_ratelimit-when-new-pages mm/memory_hotplug.c --- a/mm/memory_hotplug.c~call-mm-page-writebackcset_ratelimit-when-new-pages +++ a/mm/memory_hotplug.c @@ -169,6 +169,7 @@ int online_pages(unsigned long pfn, unsi unsigned long start_pfn; struct zone *zone; int need_zonelists_rebuild = 0; + extern void set_ratelimit(void); /* * This doesn't need a lock to do pfn_to_page(). @@ -219,6 +220,7 @@ int online_pages(unsigned long pfn, unsi if (need_zonelists_rebuild) build_all_zonelists(); vm_total_pages = nr_free_pagecache_pages(); + set_ratelimit(); return 0; } #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ diff -puN mm/page-writeback.c~call-mm-page-writebackcset_ratelimit-when-new-pages mm/page-writeback.c --- a/mm/page-writeback.c~call-mm-page-writebackcset_ratelimit-when-new-pages +++ a/mm/page-writeback.c @@ -503,7 +503,7 @@ void laptop_sync_completion(void) * will write six megabyte chunks, max. */ -static void set_ratelimit(void) +void set_ratelimit(void) { ratelimit_pages = vm_total_pages / (num_online_cpus() * 32); if (ratelimit_pages < 16) _