Skip to content

Commit 2f60d62

Browse files
Srivatsa S. BhatFengguang Wu
authored andcommitted
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>
1 parent 0e2f2b2 commit 2f60d62

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎mm/page-writeback.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,10 +1602,18 @@ void writeback_set_ratelimit(void)
16021602
}
16031603

16041604
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)
16061607
{
1607-
writeback_set_ratelimit();
1608-
return NOTIFY_DONE;
1608+
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+
}
16091617
}
16101618

16111619
static struct notifier_block __cpuinitdata ratelimit_nb = {

0 commit comments

Comments
 (0)