diff mbox series

[v2,13/27] context_tracking, rcu: Rename rcu_dynticks_task*() into rcu_task*()

Message ID 20240430091740.1826862-14-vschneid@redhat.com (mailing list archive)
State New
Headers show
Series context_tracking, rcu: Spring cleaning renaming | expand

Commit Message

Valentin Schneider April 30, 2024, 9:17 a.m. UTC
The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
RCU_WATCHING, and the 'dynticks' prefix can be dropped without losing any
meaning.

Suggested-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
 kernel/context_tracking.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Frederic Weisbecker May 6, 2024, 9:15 p.m. UTC | #1
Le Tue, Apr 30, 2024 at 11:17:17AM +0200, Valentin Schneider a écrit :
> The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
> RCU_WATCHING, and the 'dynticks' prefix can be dropped without losing any
> meaning.
> 
> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Frederic Weisbecker May 8, 2024, 2:39 p.m. UTC | #2
Le Tue, Apr 30, 2024 at 11:17:17AM +0200, Valentin Schneider a écrit :
> The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
> RCU_WATCHING, and the 'dynticks' prefix can be dropped without losing any
> meaning.
> 
> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> ---
>  kernel/context_tracking.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 647939b0befd9..9c8f7b9191cd4 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -39,7 +39,7 @@ EXPORT_SYMBOL_GPL(context_tracking);
>  #define TPS(x)  tracepoint_string(x)
>  
>  /* Record the current task on dyntick-idle entry. */
> -static __always_inline void rcu_dynticks_task_enter(void)
> +static __always_inline void rcu_task_enter(void)

On a second thought, this should be the reverse. We are not
telling anymore that we are entering dynticks mode from an
RCU-task perspective. We are telling that we are exiting RCU-tasks
because we are in eqs mode (even though this is mostly a concern
for nohz_full here, as idle tasks are entirely quiescent states
but anyway...).

So this should be s/rcu_dynticks_task_enter/rcu_task_exit

>  {
>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>  	WRITE_ONCE(current->rcu_tasks_idle_cpu, smp_processor_id());
> @@ -47,7 +47,7 @@ static __always_inline void rcu_dynticks_task_enter(void)
>  }
>  
>  /* Record no current task on dyntick-idle exit. */
> -static __always_inline void rcu_dynticks_task_exit(void)
> +static __always_inline void rcu_task_exit(void)

And s/rcu_dynticks_task_exit/rcu_task_enter

>  {
>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>  	WRITE_ONCE(current->rcu_tasks_idle_cpu, -1);
> @@ -55,7 +55,7 @@ static __always_inline void rcu_dynticks_task_exit(void)
>  }
>  
>  /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
> -static __always_inline void rcu_dynticks_task_trace_enter(void)
> +static __always_inline void rcu_task_trace_enter(void)

The same reverse naming goes for task_trace (even though I can't make
sense right now of what the barrier it implies orders exactly, but that's
another story)

>  {
>  #ifdef CONFIG_TASKS_TRACE_RCU
>  	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
> @@ -64,7 +64,7 @@ static __always_inline void rcu_dynticks_task_trace_enter(void)
>  }
>  
>  /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
> -static __always_inline void rcu_dynticks_task_trace_exit(void)
> +static __always_inline void rcu_task_trace_exit(void)
>  {
>  #ifdef CONFIG_TASKS_TRACE_RCU
>  	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
> @@ -87,7 +87,7 @@ static noinstr void ct_kernel_exit_state(int offset)
>  	 * critical sections, and we also must force ordering with the
>  	 * next idle sojourn.
>  	 */
> -	rcu_dynticks_task_trace_enter();  // Before ->dynticks update!
> +	rcu_task_trace_enter();  // Before ->dynticks update!

s/->dynticks/->state

>  	seq = ct_state_inc(offset);
>  	// RCU is no longer watching.  Better be in extended quiescent state!
>  	WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && (seq & CT_RCU_WATCHING));
> @@ -109,7 +109,7 @@ static noinstr void ct_kernel_enter_state(int offset)
>  	 */
>  	seq = ct_state_inc(offset);
>  	// RCU is now watching.  Better not be in an extended quiescent state!
> -	rcu_dynticks_task_trace_exit();  // After ->dynticks update!
> +	rcu_task_trace_exit();  // After ->dynticks update!

ditto

Thanks!
Valentin Schneider May 13, 2024, 6:39 p.m. UTC | #3
On 08/05/24 16:39, Frederic Weisbecker wrote:
> Le Tue, Apr 30, 2024 at 11:17:17AM +0200, Valentin Schneider a écrit :
>> The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
>> RCU_WATCHING, and the 'dynticks' prefix can be dropped without losing any
>> meaning.
>>
>> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
>> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
>> ---
>>  kernel/context_tracking.c | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
>> index 647939b0befd9..9c8f7b9191cd4 100644
>> --- a/kernel/context_tracking.c
>> +++ b/kernel/context_tracking.c
>> @@ -39,7 +39,7 @@ EXPORT_SYMBOL_GPL(context_tracking);
>>  #define TPS(x)  tracepoint_string(x)
>>
>>  /* Record the current task on dyntick-idle entry. */
>> -static __always_inline void rcu_dynticks_task_enter(void)
>> +static __always_inline void rcu_task_enter(void)
>
> On a second thought, this should be the reverse. We are not
> telling anymore that we are entering dynticks mode from an
> RCU-task perspective. We are telling that we are exiting RCU-tasks
> because we are in eqs mode (even though this is mostly a concern
> for nohz_full here, as idle tasks are entirely quiescent states
> but anyway...).
>
> So this should be s/rcu_dynticks_task_enter/rcu_task_exit
>

That definitely makes more sense, thanks!

>>  {
>>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>>      WRITE_ONCE(current->rcu_tasks_idle_cpu, smp_processor_id());
>> @@ -47,7 +47,7 @@ static __always_inline void rcu_dynticks_task_enter(void)
>>  }
>>
>>  /* Record no current task on dyntick-idle exit. */
>> -static __always_inline void rcu_dynticks_task_exit(void)
>> +static __always_inline void rcu_task_exit(void)
>
> And s/rcu_dynticks_task_exit/rcu_task_enter
>
>>  {
>>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>>      WRITE_ONCE(current->rcu_tasks_idle_cpu, -1);
>> @@ -55,7 +55,7 @@ static __always_inline void rcu_dynticks_task_exit(void)
>>  }
>>
>>  /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
>> -static __always_inline void rcu_dynticks_task_trace_enter(void)
>> +static __always_inline void rcu_task_trace_enter(void)
>
> The same reverse naming goes for task_trace (even though I can't make
> sense right now of what the barrier it implies orders exactly, but that's
> another story)

Ack.

>
>>  {
>>  #ifdef CONFIG_TASKS_TRACE_RCU
>>      if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
>> @@ -64,7 +64,7 @@ static __always_inline void rcu_dynticks_task_trace_enter(void)
>>  }
>>
>>  /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
>> -static __always_inline void rcu_dynticks_task_trace_exit(void)
>> +static __always_inline void rcu_task_trace_exit(void)
>>  {
>>  #ifdef CONFIG_TASKS_TRACE_RCU
>>      if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
>> @@ -87,7 +87,7 @@ static noinstr void ct_kernel_exit_state(int offset)
>>       * critical sections, and we also must force ordering with the
>>       * next idle sojourn.
>>       */
>> -	rcu_dynticks_task_trace_enter();  // Before ->dynticks update!
>> +	rcu_task_trace_enter();  // Before ->dynticks update!
>
> s/->dynticks/->state
>
>>      seq = ct_state_inc(offset);
>>      // RCU is no longer watching.  Better be in extended quiescent state!
>>      WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && (seq & CT_RCU_WATCHING));
>> @@ -109,7 +109,7 @@ static noinstr void ct_kernel_enter_state(int offset)
>>       */
>>      seq = ct_state_inc(offset);
>>      // RCU is now watching.  Better not be in an extended quiescent state!
>> -	rcu_dynticks_task_trace_exit();  // After ->dynticks update!
>> +	rcu_task_trace_exit();  // After ->dynticks update!
>
> ditto

I've got these fixed in 25/27, but I can fold it down into the patches that
touch the related areas.

>
> Thanks!
diff mbox series

Patch

diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 647939b0befd9..9c8f7b9191cd4 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -39,7 +39,7 @@  EXPORT_SYMBOL_GPL(context_tracking);
 #define TPS(x)  tracepoint_string(x)
 
 /* Record the current task on dyntick-idle entry. */
-static __always_inline void rcu_dynticks_task_enter(void)
+static __always_inline void rcu_task_enter(void)
 {
 #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
 	WRITE_ONCE(current->rcu_tasks_idle_cpu, smp_processor_id());
@@ -47,7 +47,7 @@  static __always_inline void rcu_dynticks_task_enter(void)
 }
 
 /* Record no current task on dyntick-idle exit. */
-static __always_inline void rcu_dynticks_task_exit(void)
+static __always_inline void rcu_task_exit(void)
 {
 #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
 	WRITE_ONCE(current->rcu_tasks_idle_cpu, -1);
@@ -55,7 +55,7 @@  static __always_inline void rcu_dynticks_task_exit(void)
 }
 
 /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
-static __always_inline void rcu_dynticks_task_trace_enter(void)
+static __always_inline void rcu_task_trace_enter(void)
 {
 #ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
@@ -64,7 +64,7 @@  static __always_inline void rcu_dynticks_task_trace_enter(void)
 }
 
 /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
-static __always_inline void rcu_dynticks_task_trace_exit(void)
+static __always_inline void rcu_task_trace_exit(void)
 {
 #ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
@@ -87,7 +87,7 @@  static noinstr void ct_kernel_exit_state(int offset)
 	 * critical sections, and we also must force ordering with the
 	 * next idle sojourn.
 	 */
-	rcu_dynticks_task_trace_enter();  // Before ->dynticks update!
+	rcu_task_trace_enter();  // Before ->dynticks update!
 	seq = ct_state_inc(offset);
 	// RCU is no longer watching.  Better be in extended quiescent state!
 	WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && (seq & CT_RCU_WATCHING));
@@ -109,7 +109,7 @@  static noinstr void ct_kernel_enter_state(int offset)
 	 */
 	seq = ct_state_inc(offset);
 	// RCU is now watching.  Better not be in an extended quiescent state!
-	rcu_dynticks_task_trace_exit();  // After ->dynticks update!
+	rcu_task_trace_exit();  // After ->dynticks update!
 	WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && !(seq & CT_RCU_WATCHING));
 }
 
@@ -149,7 +149,7 @@  static void noinstr ct_kernel_exit(bool user, int offset)
 	// RCU is watching here ...
 	ct_kernel_exit_state(offset);
 	// ... but is no longer watching here.
-	rcu_dynticks_task_enter();
+	rcu_task_enter();
 }
 
 /*
@@ -173,7 +173,7 @@  static void noinstr ct_kernel_enter(bool user, int offset)
 		ct->nesting++;
 		return;
 	}
-	rcu_dynticks_task_exit();
+	rcu_task_exit();
 	// RCU is not watching here ...
 	ct_kernel_enter_state(offset);
 	// ... but is watching here.
@@ -240,7 +240,7 @@  void noinstr ct_nmi_exit(void)
 	// ... but is no longer watching here.
 
 	if (!in_nmi())
-		rcu_dynticks_task_enter();
+		rcu_task_enter();
 }
 
 /**
@@ -274,7 +274,7 @@  void noinstr ct_nmi_enter(void)
 	if (rcu_dynticks_curr_cpu_in_eqs()) {
 
 		if (!in_nmi())
-			rcu_dynticks_task_exit();
+			rcu_task_exit();
 
 		// RCU is not watching here ...
 		ct_kernel_enter_state(CT_RCU_WATCHING);