Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753048AbbGIBbS (ORCPT ); Wed, 8 Jul 2015 21:31:18 -0400 Received: from mga01.intel.com ([192.55.52.88]:30732 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752409AbbGIBbF (ORCPT ); Wed, 8 Jul 2015 21:31:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,435,1432623600"; d="scan'208";a="760965264" Message-ID: <559DCE3E.8050105@intel.com> Date: Thu, 09 Jul 2015 09:28:30 +0800 From: Pan Xinhui User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "Rafael J. Wysocki" , Viresh Kumar CC: "linux-kernel@vger.kernel.org" , linux-pm@vger.kernel.org, "mnipxh@163.com" , "yanmin_zhang@linux.intel.com" Subject: Re: [PATCH V2] acpi-cpufreq: replace per_cpu with driver_data of policy References: <559BC96E.8020804@intel.com> <20150707143443.GT14598@linux> <12074796.mAD950pclu@vostro.rjw.lan> In-Reply-To: <12074796.mAD950pclu@vostro.rjw.lan> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2109 Lines: 55 hi, Rafael thanks for your kind reply. :) On 2015年07月09日 08:20, Rafael J. Wysocki wrote: > On Tuesday, July 07, 2015 08:04:43 PM Viresh Kumar wrote: >> On 07-07-15, 20:43, Pan Xinhui wrote: >>> >>> Drivers can store their internal per-policy information in >>> policy->driver_data, lets use it. >>> >>> we have benefits after this replacing. >>> 1) memory saving. >>> 2) policy is shared by several cpus, per_cpu seems not correct. using >>> *driver_data* is more reasonable. >>> 3) fix a memory leak in acpi_cpufreq_cpu_exit. as policy->cpu might >>> change during cpu hotplug. So sometimes we cant't free *data*, use >>> *driver_data* to fix it. >>> 4) fix a zero return value of get_cur_freq_on_cpu. Only per_cpu of >>> policy->cpu is set to *data*, if we try to get cpufreq on other cpus, we >>> get zero instead of correct values. Use *driver_data* to fix it. >>> >>> Signed-off-by: Pan Xinhui >>> --- >>> Changes from V1: >>> codes style fix, comments update >>> move cpufreq_cpu_put(policy) after we get *driver_data* >>> --- >>> drivers/cpufreq/acpi-cpufreq.c | 40 ++++++++++++++++++++++------------------ >>> 1 file changed, 22 insertions(+), 18 deletions(-) >> >> Acked-by: Viresh Kumar > > OK > > Does it fix any recent regressions or is it just an old bug? > This patch achieve old bug fix and codes improvements. In past days, policy has no field *driver_data*, So acpi-cpufreq driver has to use per_cpu to store some extra information. But it did not take good care of every scenarios. Now cpufreq core makes awesome effort to store more per-policy information in policy. We can make use of this feature. So I cook this patch. :) I am preparing two patches for other two issues in acpi-cpufreq driver based on this patch. I will fix them step by step. :) thanks xinhui > Rafael > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/