mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rcuwait: Add might_sleep() annotations
@ 2023-07-24 16:03 Davidlohr Bueso
  2023-07-25 12:03 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2023-07-24 16:03 UTC (permalink / raw)
  To: peterz, mingo; +Cc: dave, linux-kernel

... as with regular waitqueues.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
 include/linux/rcuwait.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
index 27343424225c..c0fcac903d03 100644
--- a/include/linux/rcuwait.h
+++ b/include/linux/rcuwait.h
@@ -74,7 +74,10 @@ extern void finish_rcuwait(struct rcuwait *w);
 })
 
 #define rcuwait_wait_event(w, condition, state)				\
-	___rcuwait_wait_event(w, condition, state, 0, schedule())
+do {									\
+	might_sleep();							\
+	___rcuwait_wait_event(w, condition, state, 0, schedule());	\
+} while (0)
 
 #define __rcuwait_wait_event_timeout(w, condition, state, timeout)	\
 	___rcuwait_wait_event(w, ___wait_cond_timeout(condition),	\
@@ -84,6 +87,7 @@ extern void finish_rcuwait(struct rcuwait *w);
 #define rcuwait_wait_event_timeout(w, condition, state, timeout)	\
 ({									\
 	long __ret = timeout;						\
+	might_sleep();							\
 	if (!___wait_cond_timeout(condition))				\
 		__ret = __rcuwait_wait_event_timeout(w, condition,	\
 						     state, timeout);	\
-- 
2.41.0


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

* Re: [PATCH] rcuwait: Add might_sleep() annotations
  2023-07-24 16:03 [PATCH] rcuwait: Add might_sleep() annotations Davidlohr Bueso
@ 2023-07-25 12:03 ` Peter Zijlstra
  2023-07-25 14:27   ` Davidlohr Bueso
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2023-07-25 12:03 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: mingo, linux-kernel

On Mon, Jul 24, 2023 at 09:03:36AM -0700, Davidlohr Bueso wrote:
> ... as with regular waitqueues.

No immediate objection, but please, tell us more. What made you get up
this fine morning and write this patch?

> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  include/linux/rcuwait.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
> index 27343424225c..c0fcac903d03 100644
> --- a/include/linux/rcuwait.h
> +++ b/include/linux/rcuwait.h
> @@ -74,7 +74,10 @@ extern void finish_rcuwait(struct rcuwait *w);
>  })
>  
>  #define rcuwait_wait_event(w, condition, state)				\
> -	___rcuwait_wait_event(w, condition, state, 0, schedule())
> +do {									\
> +	might_sleep();							\
> +	___rcuwait_wait_event(w, condition, state, 0, schedule());	\
> +} while (0)
>  
>  #define __rcuwait_wait_event_timeout(w, condition, state, timeout)	\
>  	___rcuwait_wait_event(w, ___wait_cond_timeout(condition),	\
> @@ -84,6 +87,7 @@ extern void finish_rcuwait(struct rcuwait *w);
>  #define rcuwait_wait_event_timeout(w, condition, state, timeout)	\
>  ({									\
>  	long __ret = timeout;						\
> +	might_sleep();							\
>  	if (!___wait_cond_timeout(condition))				\
>  		__ret = __rcuwait_wait_event_timeout(w, condition,	\
>  						     state, timeout);	\
> -- 
> 2.41.0
> 

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

* Re: [PATCH] rcuwait: Add might_sleep() annotations
  2023-07-25 12:03 ` Peter Zijlstra
@ 2023-07-25 14:27   ` Davidlohr Bueso
  0 siblings, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2023-07-25 14:27 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, linux-kernel

On Tue, 25 Jul 2023, Peter Zijlstra wrote:

>On Mon, Jul 24, 2023 at 09:03:36AM -0700, Davidlohr Bueso wrote:
>> ... as with regular waitqueues.
>
>No immediate objection, but please, tell us more. What made you get up
>this fine morning and write this patch?

So this was just something I had noticed missing while adding the
timeout support.

Thanks,
Davidlohr

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

end of thread, other threads:[~2023-07-25 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 16:03 [PATCH] rcuwait: Add might_sleep() annotations Davidlohr Bueso
2023-07-25 12:03 ` Peter Zijlstra
2023-07-25 14:27   ` Davidlohr Bueso

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

all inboxes | Powered by JetHome®