RE: Fix memory leak in cpufreq stats.

Tu, Xiaobing
2012-10-15T07:04:13Z

+alex

-----Original Message-----
From: Tu, Xiaobing
Sent: Monday, October 15, 2012 10:48 AM
To: 'davej@redhat.com'; 'akpm@linux-foundation.org'; 'mingo@elte.hu'; 'rusty@rustcorp.com.au'; 'a.p.zijlstra@chello.nl'; 'linux-kernel@vger.kernel.org'; 'rostedt@goodmis.org'
Cc: Tang, Guifang; Tu, Xiaobing
Subject: Fix memory leak in cpufreq stats.

Fix memory leak in cpufreq stats.

When system enter sleep, non-boot CPUs will be disable.
Cpufreq stats sysfs is created when the CPU is up, but it is not freed when the CPU going down. This will cause memory leak.
signed-off-by: xiaobing tu <xiaobing.tu@intel.com>
signed-off-by: guifang tang <guifang.tang@intel.com>

diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index b40ee14..3998316 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -328,6 +328,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
cpufreq_update_policy(cpu);
break;
case CPU_DOWN_PREPARE:
+ case CPU_DOWN_PREPARE_FROZEN:
cpufreq_stats_free_sysfs(cpu);
break;
case CPU_DEAD:

Br
XiaoBing Tu
PSI@System Integration Shanghai