cpufreq: intel_pstate: trivial improvements
Subsystems (2)
v2 cover cpufreq: intel_pstate: trivial improvements
The first patch fixes incorrect placement of __initdata
The second patch is to add __init/__initdata marker to some functions or varaiables so that we can discard them.
The third patch declares pid_params/pstate_funcs/hwp_active as __read_mostly, under the fact that they are mostly read and not written to.
Since v1:
- add Viresh's ack
- fix the third patch commit msg: remove duplicated words
Jisheng Zhang (3):
intel_pstate: Fix incorrect placement of __initdata
intel_pstate: add __init/__initdata marker to some functions/variables
intel_pstate: Declare pid_params/pstate_funcs/hwp_active __read_mostly
drivers/cpufreq/intel_pstate.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
Signature · 1 line
2.8.1
PATCH v2 1/3 intel_pstate: Fix incorrect placement of __initdata
__initdata should be placed between the variable name and equal sign (if there is) for the variable to be placed in the intended section.
--- drivers/cpufreq/intel_pstate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +3 -3
@@ -1574,9 +1574,9 @@ static struct cpufreq_driver intel_pstate_driver = { .name = "intel_pstate", }; -static int __initdata no_load; -static int __initdata no_hwp; -static int __initdata hwp_only; +static int no_load__initdata ; +static int no_hwp__initdata ; +static int hwp_only__initdata ;static unsigned int force_load;static int intel_pstate_msrs_not_valid (void )
Signature · 1 line
2.8.1
PATCH v2 2/3 intel_pstate: add __init/__initdata marker to some functions/variables
In reply to Jisheng ZhangThese functions/variables are not needed after booting, so mark them as __init or __initdata.
--- drivers/cpufreq/intel_pstate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/cpufreq/intel_pstate.c +9 -9
@@ -1355,7 +1355,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { };MODULE_DEVICE_TABLE (x86cpu, intel_pstate_cpu_ids); -static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] = { +static const struct x86_cpu_id intel_pstate_cpu_oob_ids[]__initconst = {ICPU (0x56 , core_params), {} };
@@ -1577,9 +1577,9 @@ static struct cpufreq_driver intel_pstate_driver = {static int no_load__initdata ;static int no_hwp__initdata ;static int hwp_only__initdata ; -static unsigned int force_load; +static unsigned int force_load__initdata ; -static int intel_pstate_msrs_not_valid (void ) +static int __init intel_pstate_msrs_not_valid (void ) { if (!pstate_funcs.get_max() || !pstate_funcs.get_min() ||
@@ -1589,7 +1589,7 @@ static int intel_pstate_msrs_not_valid(void)return 0 ; } -static void copy_pid_params (struct pstate_adjust_policy *policy) +static void __init copy_pid_params (struct pstate_adjust_policy *policy) { pid_params.sample_rate_ms = policy->sample_rate_ms; pid_params.sample_rate_ns = pid_params.sample_rate_ms *NSEC_PER_MSEC ;
@@ -1600,7 +1600,7 @@ static void copy_pid_params(struct pstate_adjust_policy *policy) pid_params.setpoint = policy->setpoint; } -static void copy_cpu_funcs (struct pstate_funcs *funcs) +static void __init copy_cpu_funcs (struct pstate_funcs *funcs) { pstate_funcs.get_max = funcs->get_max; pstate_funcs.get_max_physical = funcs->get_max_physical;
@@ -1615,7 +1615,7 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs)#ifdef CONFIG_ACPI -static bool intel_pstate_no_acpi_pss (void ) +static bool __init intel_pstate_no_acpi_pss (void ) {int i;
@@ -1644,7 +1644,7 @@ static bool intel_pstate_no_acpi_pss(void)return true; } -static bool intel_pstate_has_acpi_ppc (void ) +static bool __init intel_pstate_has_acpi_ppc (void ) {int i;
@@ -1672,7 +1672,7 @@ struct hw_vendor_info { };/* Hardware vendor-specific info that has its own power management modes */ -static struct hw_vendor_info vendor_info[] = { +static struct hw_vendor_info vendor_info[]__initdata = { {1 ,"HP " ,"ProLiant" ,PSS }, {1 ,"ORACLE" ,"X4-2 " ,PPC }, {1 ,"ORACLE" ,"X4-2L " ,PPC },
@@ -1691,7 +1691,7 @@ static struct hw_vendor_info vendor_info[] = { {0, "", ""}, }; -static bool intel_pstate_platform_pwr_mgmt_exists (void ) +static bool __init intel_pstate_platform_pwr_mgmt_exists (void ) {struct acpi_table_header hdr;struct hw_vendor_info *v_info;
Signature · 1 line
2.8.1
PATCH v2 3/3 intel_pstate: Declare pid_params/pstate_funcs/hwp_active __read_mostly
In reply to Jisheng Zhangpid_params is written once by copy_pid_params() during initialization, and thereafter is mostly read by hot path intel_pstate_update_util(). The read of pid_params gets more after commit a4675fbc4a7a ("cpufreq:intel_pstate: Replace timers with utilization update callbacks")
pstate_funcs is written once by copy_cpu_funcs() during initialization, and thereafter is mostly read by hot path intel_pstate_update_util()
hwp_active is written to once during initialization and thereafter is mostly read by hot path intel_pstate_update_util().
The fact that they are mostly read and not written to makes them candidates for __read_mostly declarations.
--- drivers/cpufreq/intel_pstate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +3 -3
@@ -281,9 +281,9 @@ struct cpu_defaults {static inline int32_t get_target_pstate_use_performance (struct cpudata *cpu);static inline int32_t get_target_pstate_use_cpu_load (struct cpudata *cpu); -static struct pstate_adjust_policy pid_params; -static struct pstate_funcs pstate_funcs; -static int hwp_active; +static struct pstate_adjust_policy pid_params__read_mostly ; +static struct pstate_funcs pstate_funcs__read_mostly ; +static int hwp_active__read_mostly ;#ifdef CONFIG_ACPI static bool acpi_ppc;
Signature · 1 line
2.8.1
Re: [PATCH v2 1/3] intel_pstate: Fix incorrect placement of __initdata
In reply to Jisheng ZhangQuoted 5 lines · Jisheng Zhang
__initdatashould be placed between the variable name and equal sign (if there is) for the variable to be placed in the intended section.Signed-off-by Jisheng Zhang <[email protected]>Acked-by Viresh Kumar <[email protected]>
Quoted 23 lines
---
drivers/cpufreq/intel_pstate.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -1574,9 +1574,9 @@ static struct cpufreq_driver intel_pstate_driver = { .name = "intel_pstate", };drivers/cpufreq/intel_pstate.c +3
-3-static int __initdata no_load; -static int __initdata no_hwp; -static int __initdata hwp_only; +static int no_load__initdata ; +static int no_hwp__initdata ; +static int hwp_only__initdata ;static unsigned int
force_load;
static intintel_pstate_msrs_not_valid(void)
Re: [PATCH v2 2/3] intel_pstate: add __init/__initdata marker to some functions/variables
In reply to Jisheng ZhangQuoted 5 lines · Jisheng Zhang
These functions/variables are not needed after booting, so mark them as
__initor__initdata.Signed-off-by Jisheng Zhang <[email protected]>Acked-by Viresh Kumar <[email protected]>
Quoted 92 lines
---
drivers/cpufreq/intel_pstate.c | 18 +++++++++---------1 file changed, 9 insertions(+), 9 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -1355,7 +1355,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { }; MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);drivers/cpufreq/intel_pstate.c +1
-1-static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] = { +static const struct x86_cpu_id intel_pstate_cpu_oob_ids[]
__initconst= {
ICPU(0x56, core_params),
{}
};drivers/cpufreq/intel_pstate.c +1
-1@@ -1577,9 +1577,9 @@ static struct cpufreq_driver intel_pstate_driver = { static int no_load __initdata; static int no_hwp __initdata; static int hwp_only __initdata; -static unsigned int force_load; +static unsigned int force_load__initdata ;drivers/cpufreq/intel_pstate.c +1
-1-static int intel_pstate_msrs_not_valid (void ) +static int __init intel_pstate_msrs_not_valid (void ){
if (!pstate_funcs.get_max() ||
!pstate_funcs.get_min() ||drivers/cpufreq/intel_pstate.c +0
-0@@ -1589,7 +1589,7 @@ static int intel_pstate_msrs_not_valid(void) return 0; }drivers/cpufreq/intel_pstate.c +1
-1-static void copy_pid_params (struct pstate_adjust_policy *policy) +static void __init copy_pid_params(struct pstate_adjust_policy*policy)
{
pid_params.sample_rate_ms =policy->sample_rate_ms; pid_params.sample_rate_ns = pid_params.sample_rate_ms *NSEC_PER_MSEC;drivers/cpufreq/intel_pstate.c +0
-0@@ -1600,7 +1600,7 @@ static void copy_pid_params(struct pstate_adjust_policy *policy) pid_params.setpoint = policy->setpoint; }drivers/cpufreq/intel_pstate.c +1
-1-static void copy_cpu_funcs (struct pstate_funcs *funcs) +static void __init copy_cpu_funcs (struct pstate_funcs *funcs){
pstate_funcs.get_max =funcs->get_max; pstate_funcs.get_max_physical =funcs->get_max_physical;drivers/cpufreq/intel_pstate.c +0
-0@@ -1615,7 +1615,7 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs)
#ifdefCONFIG_ACPIdrivers/cpufreq/intel_pstate.c +1
-1-static bool intel_pstate_no_acpi_pss (void ) +static bool __init intel_pstate_no_acpi_pss (void ){
int i;drivers/cpufreq/intel_pstate.c +0
-0@@ -1644,7 +1644,7 @@ static bool intel_pstate_no_acpi_pss(void) return true; }drivers/cpufreq/intel_pstate.c +1
-1-static bool intel_pstate_has_acpi_ppc (void ) +static bool __init intel_pstate_has_acpi_ppc (void ){
int i;drivers/cpufreq/intel_pstate.c +0
-0@@ -1672,7 +1672,7 @@ struct hw_vendor_info { };
/* Hardware vendor-specific info that has its own power management modes */drivers/cpufreq/intel_pstate.c +1
-1-static struct hw_vendor_info vendor_info[] = { +static struct hw_vendor_info vendor_info[]__initdata = {{1, "HP ", "ProLiant", PSS},
{1, "ORACLE", "X4-2 ", PPC},
{1, "ORACLE", "X4-2L ", PPC},drivers/cpufreq/intel_pstate.c +0
-0@@ -1691,7 +1691,7 @@ static struct hw_vendor_info vendor_info[] = { {0, "", ""}, };drivers/cpufreq/intel_pstate.c +1
-1-static bool intel_pstate_platform_pwr_mgmt_exists (void ) +static bool __init intel_pstate_platform_pwr_mgmt_exists (void ){
structacpi_table_headerhdr;
structhw_vendor_info*v_info;
Re: [PATCH v2 3/3] intel_pstate: Declare pid_params/pstate_funcs/hwp_active __read_mostly
In reply to Jisheng ZhangQuoted 10 lines · Jisheng Zhang
pid_paramsis written once bycopy_pid_params()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util(). The read ofpid_paramsgets more after commita4675fbc4a7a("cpufreq:intel_pstate: Replace timers with utilization update callbacks")
pstate_funcsis written once bycopy_cpu_funcs()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util()
Quoted 7 lines
hwp_activeis written to once during initialization and thereafter is mostly read by hot pathintel_pstate_update_util().The fact that they are mostly read and not written to makes them candidates for
__read_mostlydeclarations.Signed-off-by Jisheng Zhang <[email protected]>
Quoted 24 lines
---
drivers/cpufreq/intel_pstate.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -281,9 +281,9 @@ struct cpu_defaults {static inline
int32_tget_target_pstate_use_performance(struct cpudata *cpu);
static inlineint32_tget_target_pstate_use_cpu_load(struct cpudata *cpu);drivers/cpufreq/intel_pstate.c +3
-3-static struct pstate_adjust_policy pid_params; -static struct pstate_funcs pstate_funcs; -static int hwp_active; +static struct pstate_adjust_policy pid_params__read_mostly ; +static struct pstate_funcs pstate_funcs__read_mostly ; +static int hwp_active__read_mostly ;
#ifdefCONFIG_ACPI
static boolacpi_ppc;
Jisheng Zhang
Acked-by Viresh KumarRe: [PATCH v2 3/3] intel_pstate: Declare pid_params/pstate_funcs/hwp_active __read_mostly
Dear Rafael,
Quoted 11 lines · On Mon, 27 Jun 2016 10:29:54 -0700 Srinivas Pandruvada…
Quoted 10 lines · Jisheng Zhang
pid_paramsis written once bycopy_pid_params()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util(). The read ofpid_paramsgets more after commita4675fbc4a7a("cpufreq:intel_pstate: Replace timers with utilization update callbacks")
pstate_funcsis written once bycopy_cpu_funcs()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util()
Quoted 8 lines
Quoted 7 lines
hwp_activeis written to once during initialization and thereafter is mostly read by hot pathintel_pstate_update_util().The fact that they are mostly read and not written to makes them candidates for
__read_mostlydeclarations.Signed-off-by Jisheng Zhang <[email protected]>
oops, I missed Viresh's Ack in this patch, so can you please add the missing
Sorry for inconvenience,
Jisheng
Quoted 24 lines
Quoted 24 lines
---
drivers/cpufreq/intel_pstate.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -281,9 +281,9 @@ struct cpu_defaults {static inline
int32_tget_target_pstate_use_performance(struct cpudata *cpu);
static inlineint32_tget_target_pstate_use_cpu_load(struct cpudata *cpu);drivers/cpufreq/intel_pstate.c +3
-3-static struct pstate_adjust_policy pid_params; -static struct pstate_funcs pstate_funcs; -static int hwp_active; +static struct pstate_adjust_policy pid_params__read_mostly ; +static struct pstate_funcs pstate_funcs__read_mostly ; +static int hwp_active__read_mostly ;
#ifdefCONFIG_ACPI
static boolacpi_ppc;
Re: [PATCH v2 3/3] intel_pstate: Declare pid_params/pstate_funcs/hwp_active __read_mostly
Quoted 22 lines · Jisheng Zhang
Dear Rafael,
Quoted 17 lines · On Mon, 27 Jun 2016 10:29:54 -0700 Srinivas Pandruvada…
Quoted 16 lines · Jisheng Zhang
pid_paramsis written once bycopy_pid_params()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util(). The read ofpid_paramsgets more after commita4675fbc4a7a("cpufreq:intel_pstate: Replace timers with utilization update callbacks")
pstate_funcsis written once bycopy_cpu_funcs()during initialization,
and thereafter is mostly read by hot pathintel_pstate_update_util()
hwp_activeis written to once during initialization and thereafter is mostly read by hot pathintel_pstate_update_util().The fact that they are mostly read and not written to makes them candidates for
__read_mostlydeclarations.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Jisheng Zhang <[email protected]>oops, I missed Viresh's Ack in this patch, so can you please add the missing
Acked-by Viresh Kumar <[email protected]>
I've added it already.
Thanks,
Rafael
Quoted 14 lines · Jisheng Zhang
The first patch fixes incorrect placement of
__initdataThe second patch is to add __init/__initdata marker to some functions or varaiables so that we can discard them.
The third patch declares pid_params/pstate_funcs/hwp_active as
__read_mostly, under the fact that they are mostly read and not written to.Since v1:
- add Viresh's ack
- fix the third patch commit msg: remove duplicated words
Quoted 7 lines
Jisheng Zhang (3):
intel_pstate: Fix incorrect placement of__initdata
intel_pstate: add __init/__initdata marker to some functions/variables
intel_pstate: Declare pid_params/pstate_funcs/hwp_active__read_mostlydrivers/cpufreq/intel_pstate.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
All [1-3/3] applied (with tags), thanks!