Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f60d628 authored by Srivatsa S. Bhat's avatar Srivatsa S. Bhat Committed by Fengguang Wu
Browse files

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: default avatarSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
parent 0e2f2b23
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -1602,11 +1602,19 @@ void writeback_set_ratelimit(void)
}

static int __cpuinit
ratelimit_handler(struct notifier_block *self, unsigned long u, void *v)
ratelimit_handler(struct notifier_block *self, unsigned long action,
		  void *hcpu)
{

	switch (action & ~CPU_TASKS_FROZEN) {
	case CPU_ONLINE:
	case CPU_DEAD:
		writeback_set_ratelimit();
		return NOTIFY_OK;
	default:
		return NOTIFY_DONE;
	}
}

static struct notifier_block __cpuinitdata ratelimit_nb = {
	.notifier_call	= ratelimit_handler,