diff options
author | Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> | 2012-09-28 08:27:49 -0400 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2012-09-28 08:27:49 -0400 |
commit | 2f60d628ffd042e65e0b1d3431fb3e38d6f7c1be (patch) | |
tree | ab0abd6f9936db1441382f862028a4c22b7239e1 | |
parent | 0e2f2b23672055e1301c11509d5b8eda7b718d8e (diff) |
CPU hotplug, writeback: Don't call writeback_set_ratelimit() too often during hotplug
The CPU hotplug callback related to writeback calls writeback_set_ratelimit()
during every state change in the hotplug sequence. This is unnecessary
since num_online_cpus() changes only once during the entire hotplug operation.
So invoke the function only once per hotplug, thereby avoiding the
unnecessary repetition of those costly calculations.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
-rw-r--r-- | mm/page-writeback.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 5ad5ce23c1e0..830893b2b3c7 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -1602,10 +1602,18 @@ void writeback_set_ratelimit(void) | |||
1602 | } | 1602 | } |
1603 | 1603 | ||
1604 | static int __cpuinit | 1604 | static int __cpuinit |
1605 | ratelimit_handler(struct notifier_block *self, unsigned long u, void *v) | 1605 | ratelimit_handler(struct notifier_block *self, unsigned long action, |
1606 | void *hcpu) | ||
1606 | { | 1607 | { |
1607 | writeback_set_ratelimit(); | 1608 | |
1608 | return NOTIFY_DONE; | 1609 | switch (action & ~CPU_TASKS_FROZEN) { |
1610 | case CPU_ONLINE: | ||
1611 | case CPU_DEAD: | ||
1612 | writeback_set_ratelimit(); | ||
1613 | return NOTIFY_OK; | ||
1614 | default: | ||
1615 | return NOTIFY_DONE; | ||
1616 | } | ||
1609 | } | 1617 | } |
1610 | 1618 | ||
1611 | static struct notifier_block __cpuinitdata ratelimit_nb = { | 1619 | static struct notifier_block __cpuinitdata ratelimit_nb = { |