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

Commit 62575c26 authored by Junjie Wu's avatar Junjie Wu Committed by Matt Wagantall
Browse files

cpufreq: interactive: Fix refcount for migration notification



Current implementation of cpufreq_interactive_enable_sched_input()
returns early if use_sched_input is already enabled. This breaks
refcounting for migration notification registration. It could also
result in failure of registering migration notification after
hotplugging the entire cluster and/or suspend/resume.

Change-Id: I079b2c70b182f696cd8a883f5c8e3a37b5c6d21d
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent 5b10bb9f
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -1202,7 +1202,7 @@ static int cpufreq_interactive_enable_sched_input(
	mutex_lock(&sched_lock);

	set_window_count++;
	if (set_window_count != 1) {
	if (set_window_count > 1) {
		for_each_possible_cpu(j) {
			t = per_cpu(cpuinfo, j).cached_tunables;
			if (t && t->use_sched_load) {
@@ -1211,9 +1211,7 @@ static int cpufreq_interactive_enable_sched_input(
				break;
			}
		}
		goto out;
	}

	} else {
		rc = set_window_helper(tunables);
		if (rc) {
			pr_err("%s: Failed to set sched window\n", __func__);
@@ -1221,12 +1219,13 @@ static int cpufreq_interactive_enable_sched_input(
			goto out;
		}
		sched_set_io_is_busy(tunables->io_is_busy);
	}

	if (!tunables->use_migration_notif)
		goto out;

	migration_register_count++;
	if (migration_register_count != 1)
	if (migration_register_count > 1)
		goto out;
	else
		atomic_notifier_chain_register(&load_alert_notifier_head,
@@ -1243,7 +1242,7 @@ static int cpufreq_interactive_disable_sched_input(

	if (tunables->use_migration_notif) {
		migration_register_count--;
		if (!migration_register_count)
		if (migration_register_count < 1)
			atomic_notifier_chain_unregister(
					&load_alert_notifier_head,
					&load_notifier_block);