Re: [PATCH] cpufreq: flush any pending policy update work scheduled before freeing

From: Viresh Kumar
Date: Mon Oct 21 2019 - 06:56:06 EST


On 21-10-19, 11:27, Sudeep Holla wrote:
> I just tested now with today's linux-pm/bleeding-edge branch.
> And even if I move cancel_work_sync just after freq_qos_remove_notifier,
> it works fine now. It was not the case on Friday.
>
> Is that what you wanted to check or something else ?
>
> Regards,
> Sudeep
>
> -->8
>
> diff --git i/drivers/cpufreq/cpufreq.c w/drivers/cpufreq/cpufreq.c
> index 829a3764df1b..48a224a6b178 100644
> --- i/drivers/cpufreq/cpufreq.c
> +++ w/drivers/cpufreq/cpufreq.c
> @@ -1268,6 +1268,9 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
> freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN,
> &policy->nb_min);
>
> + /* Cancel any pending policy->update work before freeing the policy. */
> + cancel_work_sync(&policy->update);
> +
> if (policy->max_freq_req) {
> /*
> * CPUFREQ_CREATE_POLICY notification is sent only after
> @@ -1279,8 +1282,6 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
> }
>
> freq_qos_remove_request(policy->min_freq_req);
> - /* Cancel any pending policy->update work before freeing the policy. */
> - cancel_work_sync(&policy->update);
> kfree(policy->min_freq_req);
>
> cpufreq_policy_put_kobj(policy);

Yes, send a incremental patch for that. Thanks.

--
viresh