diff mbox

[11/14] powerpc/64s: cpuidle read mostly for common globals

Message ID 20170611235835.7400-12-npiggin@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Nicholas Piggin June 11, 2017, 11:58 p.m. UTC
Ensure these don't get put into bouncing cachelines.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 drivers/cpuidle/cpuidle-powernv.c | 10 +++++-----
 drivers/cpuidle/cpuidle-pseries.c |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Gautham R Shenoy June 12, 2017, 3:30 p.m. UTC | #1
On Mon, Jun 12, 2017 at 09:58:32AM +1000, Nicholas Piggin wrote:
> Ensure these don't get put into bouncing cachelines.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>

> ---
>  drivers/cpuidle/cpuidle-powernv.c | 10 +++++-----
>  drivers/cpuidle/cpuidle-pseries.c |  8 ++++----
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> index 50b3c2e0306f..9d03326ac05e 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -32,18 +32,18 @@ static struct cpuidle_driver powernv_idle_driver = {
>  	.owner            = THIS_MODULE,
>  };
> 
> -static int max_idle_state;
> -static struct cpuidle_state *cpuidle_state_table;
> +static int max_idle_state __read_mostly;
> +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> 
>  struct stop_psscr_table {
>  	u64 val;
>  	u64 mask;
>  };
> 
> -static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX];
> +static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] __read_mostly;
> 
> -static u64 snooze_timeout;
> -static bool snooze_timeout_en;
> +static u64 snooze_timeout __read_mostly;
> +static bool snooze_timeout_en __read_mostly;
> 
>  static int snooze_loop(struct cpuidle_device *dev,
>  			struct cpuidle_driver *drv,
> diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
> index 7b12bb2ea70f..a404f352d284 100644
> --- a/drivers/cpuidle/cpuidle-pseries.c
> +++ b/drivers/cpuidle/cpuidle-pseries.c
> @@ -25,10 +25,10 @@ struct cpuidle_driver pseries_idle_driver = {
>  	.owner            = THIS_MODULE,
>  };
> 
> -static int max_idle_state;
> -static struct cpuidle_state *cpuidle_state_table;
> -static u64 snooze_timeout;
> -static bool snooze_timeout_en;
> +static int max_idle_state __read_mostly;
> +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> +static u64 snooze_timeout __read_mostly;
> +static bool snooze_timeout_en __read_mostly;
> 
>  static inline void idle_loop_prolog(unsigned long *in_purr)
>  {
> -- 
> 2.11.0
>
Vaidyanathan Srinivasan June 12, 2017, 5:50 p.m. UTC | #2
* Gautham R Shenoy <ego@linux.vnet.ibm.com> [2017-06-12 21:00:27]:

> On Mon, Jun 12, 2017 at 09:58:32AM +1000, Nicholas Piggin wrote:
> > Ensure these don't get put into bouncing cachelines.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> 
> Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
 
Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
 
> > ---
> >  drivers/cpuidle/cpuidle-powernv.c | 10 +++++-----
> >  drivers/cpuidle/cpuidle-pseries.c |  8 ++++----
> >  2 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> > index 50b3c2e0306f..9d03326ac05e 100644
> > --- a/drivers/cpuidle/cpuidle-powernv.c
> > +++ b/drivers/cpuidle/cpuidle-powernv.c
> > @@ -32,18 +32,18 @@ static struct cpuidle_driver powernv_idle_driver = {
> >  	.owner            = THIS_MODULE,
> >  };
> > 
> > -static int max_idle_state;
> > -static struct cpuidle_state *cpuidle_state_table;
> > +static int max_idle_state __read_mostly;
> > +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> > 
> >  struct stop_psscr_table {
> >  	u64 val;
> >  	u64 mask;
> >  };
> > 
> > -static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX];
> > +static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] __read_mostly;
> > 
> > -static u64 snooze_timeout;
> > -static bool snooze_timeout_en;
> > +static u64 snooze_timeout __read_mostly;
> > +static bool snooze_timeout_en __read_mostly;
> > 
> >  static int snooze_loop(struct cpuidle_device *dev,
> >  			struct cpuidle_driver *drv,
> > diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
> > index 7b12bb2ea70f..a404f352d284 100644
> > --- a/drivers/cpuidle/cpuidle-pseries.c
> > +++ b/drivers/cpuidle/cpuidle-pseries.c
> > @@ -25,10 +25,10 @@ struct cpuidle_driver pseries_idle_driver = {
> >  	.owner            = THIS_MODULE,
> >  };
> > 
> > -static int max_idle_state;
> > -static struct cpuidle_state *cpuidle_state_table;
> > -static u64 snooze_timeout;
> > -static bool snooze_timeout_en;
> > +static int max_idle_state __read_mostly;
> > +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> > +static u64 snooze_timeout __read_mostly;
> > +static bool snooze_timeout_en __read_mostly;
> > 

Simple annotation of  __read_mostly could save us a few cache line
bounces.  Good idea.

--Vaidy
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index 50b3c2e0306f..9d03326ac05e 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -32,18 +32,18 @@  static struct cpuidle_driver powernv_idle_driver = {
 	.owner            = THIS_MODULE,
 };
 
-static int max_idle_state;
-static struct cpuidle_state *cpuidle_state_table;
+static int max_idle_state __read_mostly;
+static struct cpuidle_state *cpuidle_state_table __read_mostly;
 
 struct stop_psscr_table {
 	u64 val;
 	u64 mask;
 };
 
-static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX];
+static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] __read_mostly;
 
-static u64 snooze_timeout;
-static bool snooze_timeout_en;
+static u64 snooze_timeout __read_mostly;
+static bool snooze_timeout_en __read_mostly;
 
 static int snooze_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 7b12bb2ea70f..a404f352d284 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -25,10 +25,10 @@  struct cpuidle_driver pseries_idle_driver = {
 	.owner            = THIS_MODULE,
 };
 
-static int max_idle_state;
-static struct cpuidle_state *cpuidle_state_table;
-static u64 snooze_timeout;
-static bool snooze_timeout_en;
+static int max_idle_state __read_mostly;
+static struct cpuidle_state *cpuidle_state_table __read_mostly;
+static u64 snooze_timeout __read_mostly;
+static bool snooze_timeout_en __read_mostly;
 
 static inline void idle_loop_prolog(unsigned long *in_purr)
 {