Commit 2d1d43f6a43b703587e759145f69467e7c6553a7

Authored by Chandra Seetharaman
Committed by Linus Torvalds
1 parent 40c99aae23

[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: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 6 additions and 3 deletions Side-by-side Diff

include/linux/writeback.h
... ... @@ -117,6 +117,7 @@
117 117 int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
118 118 loff_t pos, loff_t count);
119 119 void set_page_dirty_balance(struct page *page);
  120 +void writeback_set_ratelimit(void);
120 121  
121 122 /* pdflush.c */
122 123 extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
... ... @@ -13,6 +13,7 @@
13 13 #include <linux/compiler.h>
14 14 #include <linux/module.h>
15 15 #include <linux/pagevec.h>
  16 +#include <linux/writeback.h>
16 17 #include <linux/slab.h>
17 18 #include <linux/sysctl.h>
18 19 #include <linux/cpu.h>
... ... @@ -192,6 +193,7 @@
192 193 if (need_zonelists_rebuild)
193 194 build_all_zonelists();
194 195 vm_total_pages = nr_free_pagecache_pages();
  196 + writeback_set_ratelimit();
195 197 return 0;
196 198 }
197 199  
... ... @@ -501,7 +501,7 @@
501 501 * will write six megabyte chunks, max.
502 502 */
503 503  
504   -static void set_ratelimit(void)
  504 +void writeback_set_ratelimit(void)
505 505 {
506 506 ratelimit_pages = vm_total_pages / (num_online_cpus() * 32);
507 507 if (ratelimit_pages < 16)
... ... @@ -513,7 +513,7 @@
513 513 static int __cpuinit
514 514 ratelimit_handler(struct notifier_block *self, unsigned long u, void *v)
515 515 {
516   - set_ratelimit();
  516 + writeback_set_ratelimit();
517 517 return 0;
518 518 }
519 519  
... ... @@ -546,7 +546,7 @@
546 546 vm_dirty_ratio = 1;
547 547 }
548 548 mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
549   - set_ratelimit();
  549 + writeback_set_ratelimit();
550 550 register_cpu_notifier(&ratelimit_nb);
551 551 }
552 552