Re: [PATCHv2 1/2] sched/wait: Add wait_event_state_exclusive()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 10, 2025 at 01:52:28PM +0900, Sergey Senozhatsky wrote:
> Allows exclusive waits with a custom @state.
> 
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

> ---
> 
> v2: switched to wait_event_state_exclusive()
> 
>  include/linux/wait.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 327894f022cf..9ebb0d2e422a 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -968,6 +968,18 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
>  		      state, 0, timeout,					\
>  		      __ret = schedule_timeout(__ret))
>  
> +#define __wait_event_state_exclusive(wq, condition, state)			\
> +	___wait_event(wq, condition, state, 1, 0, schedule())
> +
> +#define wait_event_state_exclusive(wq, condition, state)			\
> +({										\
> +	int __ret = 0;								\
> +	might_sleep();								\
> +	if (!(condition))							\
> +		__ret = __wait_event_state_exclusive(wq, condition, state);	\
> +	__ret;									\
> +})
> +
>  #define __wait_event_killable_timeout(wq_head, condition, timeout)		\
>  	___wait_event(wq_head, ___wait_cond_timeout(condition),			\
>  		      TASK_KILLABLE, 0, timeout,				\
> -- 
> 2.50.0.rc1.591.g9c95f17f64-goog
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux