Re: [PATCH v2 1/1] wait: Relate wait_event_cmd() to its userspace equivalence

From: Haakon Bugge
Date: Mon Jul 21 2025 - 12:53:20 EST




> On 27 Jun 2025, at 12:52, Håkon Bugge <Haakon.Bugge@xxxxxxxxxx> wrote:
>
> Relate wait_event_cmd() to userspace's pthread_cond_wait(). This
> because when searching for functionality comparable to
> pthread_cond_wait(), it is very hard to find wait_event_cmd().
>
> Signed-off-by: Håkon Bugge <haakon.bugge@xxxxxxxxxx>

A gentle ping on this one.


Thxs, Håkon


>
> --
>
> v1 -> v2:
> * Split original patch into two
> * Wordsmithing as suggested by Matthew
> ---
> include/linux/wait.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 965a19809c7e5..62df98193a3a7 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -469,6 +469,14 @@ do { \
> *
> * wake_up() has to be called after changing any variable that could
> * change the result of the wait condition.
> + *
> + * This is the kernel's polymorphic implementation of userspace's
> + * pthread_cond_wait().
> + *
> + * When calling this function, cmd1 is typically a lock-release call
> + * and cmd2 a lock-acquire call. The locking primitive can be chosen,
> + * contrary to pthread_cond_wait(), where the locking type is cast in
> + * stone and is a pthread_mutex_t.
> */
> #define wait_event_cmd(wq_head, condition, cmd1, cmd2) \
> do { \
> --
> 2.43.5
>