public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu/srcutiny: don't return before reenabling preemption
@ 2024-10-07 10:14 Michal Schmidt
  2024-10-09 17:19 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Schmidt @ 2024-10-07 10:14 UTC (permalink / raw)
  To: Lai Jiangshan, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Uladzislau Rezki (Sony)
  Cc: rcu, linux-kernel

Code after the return statement is dead. Enable preemption before
returning from srcu_drive_gp().

This will be important when/if PREEMPT_AUTO (lazy resched) gets merged.

Fixes: 65b4a59557f6 ("srcu: Make Tiny SRCU explicitly disable preemption")
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 kernel/rcu/srcutiny.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 549c03336ee9..4dcbf8aa80ff 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -122,8 +122,8 @@ void srcu_drive_gp(struct work_struct *wp)
 	ssp = container_of(wp, struct srcu_struct, srcu_work);
 	preempt_disable();  // Needed for PREEMPT_AUTO
 	if (ssp->srcu_gp_running || ULONG_CMP_GE(ssp->srcu_idx, READ_ONCE(ssp->srcu_idx_max))) {
-		return; /* Already running or nothing to do. */
 		preempt_enable();
+		return; /* Already running or nothing to do. */
 	}
 
 	/* Remove recently arrived callbacks and wait for readers. */
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rcu/srcutiny: don't return before reenabling preemption
  2024-10-07 10:14 [PATCH] rcu/srcutiny: don't return before reenabling preemption Michal Schmidt
@ 2024-10-09 17:19 ` Paul E. McKenney
  2024-10-18 21:10   ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2024-10-09 17:19 UTC (permalink / raw)
  To: Michal Schmidt
  Cc: Lai Jiangshan, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
	Uladzislau Rezki (Sony), rcu, linux-kernel

On Mon, Oct 07, 2024 at 12:14:15PM +0200, Michal Schmidt wrote:
> Code after the return statement is dead. Enable preemption before
> returning from srcu_drive_gp().
> 
> This will be important when/if PREEMPT_AUTO (lazy resched) gets merged.
> 
> Fixes: 65b4a59557f6 ("srcu: Make Tiny SRCU explicitly disable preemption")
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

Good catch!

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  kernel/rcu/srcutiny.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
> index 549c03336ee9..4dcbf8aa80ff 100644
> --- a/kernel/rcu/srcutiny.c
> +++ b/kernel/rcu/srcutiny.c
> @@ -122,8 +122,8 @@ void srcu_drive_gp(struct work_struct *wp)
>  	ssp = container_of(wp, struct srcu_struct, srcu_work);
>  	preempt_disable();  // Needed for PREEMPT_AUTO
>  	if (ssp->srcu_gp_running || ULONG_CMP_GE(ssp->srcu_idx, READ_ONCE(ssp->srcu_idx_max))) {
> -		return; /* Already running or nothing to do. */
>  		preempt_enable();
> +		return; /* Already running or nothing to do. */
>  	}
>  
>  	/* Remove recently arrived callbacks and wait for readers. */
> -- 
> 2.46.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rcu/srcutiny: don't return before reenabling preemption
  2024-10-09 17:19 ` Paul E. McKenney
@ 2024-10-18 21:10   ` Frederic Weisbecker
  0 siblings, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2024-10-18 21:10 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Michal Schmidt, Lai Jiangshan, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Uladzislau Rezki (Sony), rcu, linux-kernel

Le Wed, Oct 09, 2024 at 10:19:01AM -0700, Paul E. McKenney a écrit :
> On Mon, Oct 07, 2024 at 12:14:15PM +0200, Michal Schmidt wrote:
> > Code after the return statement is dead. Enable preemption before
> > returning from srcu_drive_gp().
> > 
> > This will be important when/if PREEMPT_AUTO (lazy resched) gets merged.
> > 
> > Fixes: 65b4a59557f6 ("srcu: Make Tiny SRCU explicitly disable preemption")
> > Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
> 
> Good catch!
> 
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

Applied!

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-18 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 10:14 [PATCH] rcu/srcutiny: don't return before reenabling preemption Michal Schmidt
2024-10-09 17:19 ` Paul E. McKenney
2024-10-18 21:10   ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox