mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Remi Pommarel <repk@triplefau.lt>
To: v9fs@lists.linux.dev
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	Remi Pommarel <repk@triplefau.lt>
Subject: [RFC PATCH 4/5] wait: Introduce io_wait_event_killable()
Date: Sun, 31 Aug 2025 21:03:42 +0200	[thread overview]
Message-ID: <370180ef235d9e183c93bfb9677e8a35e4ca27f2.1756635044.git.repk@triplefau.lt> (raw)
In-Reply-To: <cover.1756635044.git.repk@triplefau.lt>

Add io_wait_event_killable(), a variant of wait_event_killable() that
uses io_schedule() instead of schedule(). This is to be used in
situation where waiting time is to be accounted as IO wait time.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
---
 include/linux/wait.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 09855d819418..cfeb1adee973 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -937,6 +937,21 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
 	__ret;									\
 })
 
+#define __io_wait_event_killable(wq, condition)					\
+	___wait_event(wq, condition, TASK_KILLABLE, 0, 0, io_schedule())
+
+/*
+ * wait_event_killable() - link wait_event_killable but with io_schedule()
+ */
+#define io_wait_event_killable(wq_head, condition)				\
+({										\
+	int __ret = 0;								\
+	might_sleep();								\
+	if (!(condition))							\
+		__ret = __io_wait_event_killable(wq_head, condition);		\
+	__ret;									\
+})
+
 #define __wait_event_state(wq, condition, state)				\
 	___wait_event(wq, condition, state, 0, 0, schedule())
 
-- 
2.50.1


  parent reply	other threads:[~2025-08-31 19:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-31 19:03 [RFC PATCH 0/5] 9p: Performance improvements for build workloads Remi Pommarel
2025-08-31 19:03 ` [RFC PATCH 1/5] 9p: Cache negative dentries for lookup performance Remi Pommarel
2025-08-31 19:03 ` [RFC PATCH 2/5] 9p: Introduce option for negative dentry cache retention time Remi Pommarel
2025-08-31 19:03 ` [RFC PATCH 3/5] 9p: Enable symlink caching in page cache Remi Pommarel
2025-08-31 19:03 ` Remi Pommarel [this message]
2025-08-31 19:03 ` [RFC PATCH 5/5] 9p: Track 9P RPC waiting time as IO Remi Pommarel
2025-09-14 12:34 ` [RFC PATCH 0/5] 9p: Performance improvements for build workloads Dominique Martinet
2025-09-18 19:17   ` Remi Pommarel
2025-09-19  2:49     ` Dominique Martinet

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=370180ef235d9e183c93bfb9677e8a35e4ca27f2.1756635044.git.repk@triplefau.lt \
    --to=repk@triplefau.lt \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=v9fs@lists.linux.dev \
    /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®