[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1f38f6b-9d14-46cb-81f1-6bc5f92e7c65@samba.org>
Date: Wed, 13 Aug 2025 22:28:08 +0200
From: Stefan Metzmacher <metze@...ba.org>
To: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>,
Steve French <smfrench@...il.com>, Namjae Jeon <linkinjeon@...nel.org>
Cc: "linux-cifs@...r.kernel.org" <linux-cifs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Questions about wake_up[_interruptible][_all]
Hi,
there are several cases where wait queues are used in:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/smb/client/smbdirect.c
and
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/smb/server/transport_rdma.c
I'm a bit confused because we the use mixed use of
wake_up(), wake_up_interruptible() and wake_up_interruptible_all()
On the wait side the following are used
wait_event(), wait_event_interruptible() and wait_event_interruptible_timeout()
The documentation of all wait_event_* macros say 'wake_up()' should be used.
And there's no documentation on the various wake_up_* macros.
I guess I understand the difference between
wait_event() and wait_event_interruptible(),
the first ignores any signal even kill and the
2nd returns -ERESTARTSYS on any signal.
I'm wondering if using wait_event_killable() should
be preferred instead of wait_event() in order to prevent
processes in state D hanging forever.
For some wait queues it would be desired that only
a single waiter is woken, so it can make good forward progress,
so maybe some wait_event_*_exclusive() would be useful for this.
As far as I understand the difference between
wake_up() and wake_up_all() is that the first
stops after the first waiter with WQ_FLAG_EXCLUSIVE.
and wake_up_all() wakes all waiters (useful for error conditions,
which all waiters should handle immediately.
But I don't understand the difference between
wake_up() and wake_up_interruptible().
My best guess would be that wake_up_interruptible()
would not wake waiters using wait_event(), but only
waiters using wait_event_interruptible() or any other
version that includes TASK_INTERRUPTIBLE.
So I guess we never want to use wake_up_interruptible(),
but always wake_up() or wake_up_all() instead...
It would be great if the documentation of
the wake_up macros and their interaction with
the wait_event macros could be improved.
Any hints are highly welcome :-)
Thanks!
metze
Powered by blists - more mailing lists