lkml.org 
[lkml]   [2013]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] cpufreq: Don't use cpu removed during cpufreq_driver_unregister
On 01/04/2013 10:49 AM, Viresh Kumar wrote:
> On 3 January 2013 19:55, Srivatsa S. Bhat
> <srivatsa.bhat@linux.vnet.ibm.com> wrote:
>> I took a quick look at the problem you described above, and the cpufreq code..
>> If we cannot avoid calling cpufreq_add_dev() from cpufreq_remove_dev(), then I can't
>> think of anything better than what your patch does.
>
> Good :)
>
>> BTW, off-topic, while going through that path, I think I found a memory leak
>> in __cpufreq_remove_dev():
>>
>> if (unlikely(cpumask_weight(data->cpus) > 1)) {
>> for_each_cpu(j, data->cpus) {
>> if (j == cpu)
>> continue;
>> per_cpu(cpufreq_cpu_data, j) = NULL;
>> }
>> }
>>
>> We are assigning NULL without freeing that memory.
>
> Not really. All cpus in affected_cpus (data->cpus), share the same
> policy structure.
> We have already taken backup of cpufreq_cpu_data for the first cpu in "data" and
> are freeing it here:
>
> kfree(data);
>

Ah, ok, got it. Thanks!

Regards,
Srivatsa S. Bhat



\
 
 \ /
  Last update: 2013-01-04 07:41    [W:0.093 / U:1.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site