mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Tomasz Figa <tfiga@chromium.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/2] sched/wait: Add wait_event_state_exclusive()
Date: Fri, 13 Jun 2025 11:17:13 +0200	[thread overview]
Message-ID: <20250613091713.GD2278213@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250610045321.4030262-1-senozhatsky@chromium.org>

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@chromium.org>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
> 
> 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
> 

  parent reply	other threads:[~2025-06-13  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  4:52 Sergey Senozhatsky
2025-06-10  4:52 ` [PATCHv2 2/2] fuse: use freezable wait in fuse_get_req() Sergey Senozhatsky
2025-06-19  2:51   ` Sergey Senozhatsky
2025-07-02  5:37   ` Miklos Szeredi
2025-06-13  9:17 ` Peter Zijlstra [this message]
2025-07-20 20:58 ` [PATCHv2 1/2] sched/wait: Add wait_event_state_exclusive() Askar Safin
2025-07-21  3:16   ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250613091713.GD2278213@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®