diff mbox series

rcu: remove rcu_is_idle_cpu

Message ID 20220926015827.227050-1-zouyipeng@huawei.com (mailing list archive)
State Accepted
Commit f8b389c24cf9a523472e3e505815b26f0174856c
Headers show
Series rcu: remove rcu_is_idle_cpu | expand

Commit Message

Yipeng Zou Sept. 26, 2022, 1:58 a.m. UTC
The commit "x86/cpu: Avoid cpuinfo-induced IPIing of idle CPUs" introduce
this function to identify the current CPU idle state.
But after commit "x86/aperfmperf: Replace arch_freq_get_on_cpu()" we
just use MAX_SAMPLE_AGE to do that, So there is no use of this function.

Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
---
 include/linux/rcutiny.h | 2 --
 include/linux/rcutree.h | 2 --
 kernel/rcu/tree.c       | 6 ------
 3 files changed, 10 deletions(-)

Comments

Frederic Weisbecker Sept. 26, 2022, 8:36 p.m. UTC | #1
On Mon, Sep 26, 2022 at 09:58:27AM +0800, Yipeng Zou wrote:
> The commit "x86/cpu: Avoid cpuinfo-induced IPIing of idle CPUs" introduce
> this function to identify the current CPU idle state.
> But after commit "x86/aperfmperf: Replace arch_freq_get_on_cpu()" we
> just use MAX_SAMPLE_AGE to do that, So there is no use of this function.
> 
> Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Paul E. McKenney Sept. 27, 2022, 6:51 p.m. UTC | #2
On Mon, Sep 26, 2022 at 10:36:29PM +0200, Frederic Weisbecker wrote:
> On Mon, Sep 26, 2022 at 09:58:27AM +0800, Yipeng Zou wrote:
> > The commit "x86/cpu: Avoid cpuinfo-induced IPIing of idle CPUs" introduce
> > this function to identify the current CPU idle state.
> > But after commit "x86/aperfmperf: Replace arch_freq_get_on_cpu()" we
> > just use MAX_SAMPLE_AGE to do that, So there is no use of this function.
> > 
> > Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
> > Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> 
> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

Good eyes, Yipeng!  Queued and pushed, thank you both!

As usual, I could not resist the urge to wordsmith, so please check the
patch below and let me know if I messed something up.

And please include both commit IDs in future patches with the
formatting shows below.  Makes it easier for me to accept your
patches, after all.  ;-)

							Thanx, Paul

------------------------------------------------------------------------

commit f8b389c24cf9a523472e3e505815b26f0174856c
Author: Yipeng Zou <zouyipeng@huawei.com>
Date:   Mon Sep 26 09:58:27 2022 +0800

    rcu: Remove rcu_is_idle_cpu()
    
    The commit 3fcd6a230fa7 ("x86/cpu: Avoid cpuinfo-induced IPIing of
    idle CPUs") introduced rcu_is_idle_cpu() in order to identify the
    current CPU idle state.  But commit f3eca381bd49 ("x86/aperfmperf:
    Replace arch_freq_get_on_cpu()") switched to using MAX_SAMPLE_AGE,
    so rcu_is_idle_cpu() is no longer used.  This commit therefore removes it.
    
    Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
    Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
    Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 84e930c11065..93485b812712 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -146,8 +146,6 @@ static inline void rcu_virt_note_context_switch(void) { }
 static inline void rcu_cpu_stall_reset(void) { }
 static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
 static inline void rcu_irq_exit_check_preempt(void) { }
-#define rcu_is_idle_cpu(cpu) \
-	(is_idle_task(current) && !in_nmi() && !in_hardirq() && !in_serving_softirq())
 static inline void exit_rcu(void) { }
 static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
 {
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 3066e0975022..f41c4ab2a884 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -87,8 +87,6 @@ bool poll_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
 void cond_synchronize_rcu(unsigned long oldstate);
 void cond_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
 
-bool rcu_is_idle_cpu(int cpu);
-
 #ifdef CONFIG_PROVE_RCU
 void rcu_irq_exit_check_preempt(void);
 #else
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 1930cee1ccdb..96d678c9cfb6 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -301,12 +301,6 @@ static bool rcu_dynticks_in_eqs(int snap)
 	return !(snap & RCU_DYNTICKS_IDX);
 }
 
-/* Return true if the specified CPU is currently idle from an RCU viewpoint.  */
-bool rcu_is_idle_cpu(int cpu)
-{
-	return rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu));
-}
-
 /*
  * Return true if the CPU corresponding to the specified rcu_data
  * structure has spent some time in an extended quiescent state since
Yipeng Zou Sept. 28, 2022, 1:24 a.m. UTC | #3
在 2022/9/28 2:51, Paul E. McKenney 写道:
> On Mon, Sep 26, 2022 at 10:36:29PM +0200, Frederic Weisbecker wrote:
>> On Mon, Sep 26, 2022 at 09:58:27AM +0800, Yipeng Zou wrote:
>>> The commit "x86/cpu: Avoid cpuinfo-induced IPIing of idle CPUs" introduce
>>> this function to identify the current CPU idle state.
>>> But after commit "x86/aperfmperf: Replace arch_freq_get_on_cpu()" we
>>> just use MAX_SAMPLE_AGE to do that, So there is no use of this function.
>>>
>>> Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
>>> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
>> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
> Good eyes, Yipeng!  Queued and pushed, thank you both!
>
> As usual, I could not resist the urge to wordsmith, so please check the
> patch below and let me know if I messed something up.

Its all good, and thanks for review.

> And please include both commit IDs in future patches with the
> formatting shows below.  Makes it easier for me to accept your
> patches, after all.  ;-)
ok,got it.
>
> 							Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit f8b389c24cf9a523472e3e505815b26f0174856c
> Author: Yipeng Zou <zouyipeng@huawei.com>
> Date:   Mon Sep 26 09:58:27 2022 +0800
>
>      rcu: Remove rcu_is_idle_cpu()
>      
>      The commit 3fcd6a230fa7 ("x86/cpu: Avoid cpuinfo-induced IPIing of
>      idle CPUs") introduced rcu_is_idle_cpu() in order to identify the
>      current CPU idle state.  But commit f3eca381bd49 ("x86/aperfmperf:
>      Replace arch_freq_get_on_cpu()") switched to using MAX_SAMPLE_AGE,
>      so rcu_is_idle_cpu() is no longer used.  This commit therefore removes it.
>      
>      Fixes: f3eca381bd49 ("x86/aperfmperf: Replace arch_freq_get_on_cpu()")
>      Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
>      Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
>      Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> index 84e930c11065..93485b812712 100644
> --- a/include/linux/rcutiny.h
> +++ b/include/linux/rcutiny.h
> @@ -146,8 +146,6 @@ static inline void rcu_virt_note_context_switch(void) { }
>   static inline void rcu_cpu_stall_reset(void) { }
>   static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
>   static inline void rcu_irq_exit_check_preempt(void) { }
> -#define rcu_is_idle_cpu(cpu) \
> -	(is_idle_task(current) && !in_nmi() && !in_hardirq() && !in_serving_softirq())
>   static inline void exit_rcu(void) { }
>   static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
>   {
> diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
> index 3066e0975022..f41c4ab2a884 100644
> --- a/include/linux/rcutree.h
> +++ b/include/linux/rcutree.h
> @@ -87,8 +87,6 @@ bool poll_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
>   void cond_synchronize_rcu(unsigned long oldstate);
>   void cond_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
>   
> -bool rcu_is_idle_cpu(int cpu);
> -
>   #ifdef CONFIG_PROVE_RCU
>   void rcu_irq_exit_check_preempt(void);
>   #else
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 1930cee1ccdb..96d678c9cfb6 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -301,12 +301,6 @@ static bool rcu_dynticks_in_eqs(int snap)
>   	return !(snap & RCU_DYNTICKS_IDX);
>   }
>   
> -/* Return true if the specified CPU is currently idle from an RCU viewpoint.  */
> -bool rcu_is_idle_cpu(int cpu)
> -{
> -	return rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu));
> -}
> -
>   /*
>    * Return true if the CPU corresponding to the specified rcu_data
>    * structure has spent some time in an extended quiescent state since
diff mbox series

Patch

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 9bc025aa79a3..5c271bf3a1e7 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -146,8 +146,6 @@  static inline void rcu_virt_note_context_switch(void) { }
 static inline void rcu_cpu_stall_reset(void) { }
 static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
 static inline void rcu_irq_exit_check_preempt(void) { }
-#define rcu_is_idle_cpu(cpu) \
-	(is_idle_task(current) && !in_nmi() && !in_hardirq() && !in_serving_softirq())
 static inline void exit_rcu(void) { }
 static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
 {
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 70795386b9ff..4003bf6cfa1c 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -87,8 +87,6 @@  bool poll_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
 void cond_synchronize_rcu(unsigned long oldstate);
 void cond_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp);
 
-bool rcu_is_idle_cpu(int cpu);
-
 #ifdef CONFIG_PROVE_RCU
 void rcu_irq_exit_check_preempt(void);
 #else
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 5ec97e3f7468..f6561aa401c0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -301,12 +301,6 @@  static bool rcu_dynticks_in_eqs(int snap)
 	return !(snap & RCU_DYNTICKS_IDX);
 }
 
-/* Return true if the specified CPU is currently idle from an RCU viewpoint.  */
-bool rcu_is_idle_cpu(int cpu)
-{
-	return rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu));
-}
-
 /*
  * Return true if the CPU corresponding to the specified rcu_data
  * structure has spent some time in an extended quiescent state since