FIXUP: sched: scheduler-driven cpu frequency selection
authorRicky Liang <jcliang@chromium.org>
Mon, 1 Feb 2016 17:12:06 +0000 (01:12 +0800)
committerAmit Pundir <amit.pundir@linaro.org>
Wed, 14 Sep 2016 09:32:22 +0000 (15:02 +0530)
Two fixups that have been reported on LKML. The next version of
scheduler-driver cpu frequency selection patch set should include
these fixes and we can drop this patch then.

Signed-off-by: Ricky Liang <jcliang@chromium.org>
Change-Id: Ia2f8b5c0dd5dac06580256eeb4b259929688af68

kernel/sched/cpufreq_sched.c

index 4fea269a6598c971de4eef5fdd6582581cde6f49..f6f9b9b3a4a8367a2753c82b27a373a73b3f3ddd 100644 (file)
@@ -131,6 +131,8 @@ static int cpufreq_sched_thread(void *data)
                new_request = gd->requested_freq;
                if (new_request == last_request) {
                        set_current_state(TASK_INTERRUPTIBLE);
+                       if (kthread_should_stop())
+                               break;
                        schedule();
                } else {
                        /*
@@ -293,6 +295,7 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy)
                goto err;
        }
 
+       policy->governor_data = gd;
        if (cpufreq_driver_is_slow()) {
                cpufreq_driver_slow = true;
                gd->task = kthread_create(cpufreq_sched_thread, policy,
@@ -309,12 +312,12 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy)
                init_irq_work(&gd->irq_work, cpufreq_sched_irq_work);
        }
 
-       policy->governor_data = gd;
        set_sched_freq();
 
        return 0;
 
 err:
+       policy->governor_data = NULL;
        kfree(gd);
        return -ENOMEM;
 }