[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172837418166.1442.8175035816812384640.tip-bot2@tip-bot2>
Date: Tue, 08 Oct 2024 07:56:21 -0000
From: "tip-bot2 for NeilBrown" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: NeilBrown <neilb@...e.de>, "Peter Zijlstra (Intel)" <peterz@...radead.org>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched: add wait_var_event_io()
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 80681c04c5e8e4297b9ebf201ca3ce6242aa16c3
Gitweb: https://git.kernel.org/tip/80681c04c5e8e4297b9ebf201ca3ce6242aa16c3
Author: NeilBrown <neilb@...e.de>
AuthorDate: Wed, 25 Sep 2024 15:31:43 +10:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Mon, 07 Oct 2024 09:28:39 +02:00
sched: add wait_var_event_io()
It is not currently possible to wait wait_var_event for an io_schedule()
style wait. This patch adds wait_var_event_io() for that purpose.
Signed-off-by: NeilBrown <neilb@...e.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://lore.kernel.org/r/20240925053405.3960701-7-neilb@suse.de
---
include/linux/wait_bit.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index 6aea10e..6346e26 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -281,6 +281,9 @@ __out: __ret; \
#define __wait_var_event(var, condition) \
___wait_var_event(var, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
schedule())
+#define __wait_var_event_io(var, condition) \
+ ___wait_var_event(var, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
+ io_schedule())
/**
* wait_var_event - wait for a variable to be updated and notified
@@ -306,6 +309,34 @@ do { \
__wait_var_event(var, condition); \
} while (0)
+/**
+ * wait_var_event_io - wait for a variable to be updated and notified
+ * @var: the address of variable being waited on
+ * @condition: the condition to wait for
+ *
+ * Wait for an IO related @condition to be true, only re-checking when a
+ * wake up is received for the given @var (an arbitrary kernel address
+ * which need not be directly related to the given condition, but
+ * usually is).
+ *
+ * The process will wait on a waitqueue selected by hash from a shared
+ * pool. It will only be woken on a wake_up for the given address.
+ *
+ * This is similar to wait_var_event(), but calls io_schedule() instead
+ * of schedule().
+ *
+ * The condition should normally use smp_load_acquire() or a similarly
+ * ordered access to ensure that any changes to memory made before the
+ * condition became true will be visible after the wait completes.
+ */
+#define wait_var_event_io(var, condition) \
+do { \
+ might_sleep(); \
+ if (condition) \
+ break; \
+ __wait_var_event_io(var, condition); \
+} while (0)
+
#define __wait_var_event_killable(var, condition) \
___wait_var_event(var, condition, TASK_KILLABLE, 0, 0, \
schedule())
Powered by blists - more mailing lists