public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] wait/9p: Account 9P RPC waiting time as I/O wait
@ 2026-01-21 19:21 Remi Pommarel
  2026-01-21 19:21 ` [PATCH 1/2] wait: Introduce io_wait_event_killable() Remi Pommarel
  2026-01-21 19:21 ` [PATCH 2/2] 9p: Track 9P RPC waiting time as IO Remi Pommarel
  0 siblings, 2 replies; 5+ messages in thread
From: Remi Pommarel @ 2026-01-21 19:21 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, v9fs
  Cc: Juri Lelli, Vincent Guittot, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, linux-fsdevel, linux-kernel,
	Remi Pommarel

This patch serie helps to attribute the time spent waiting for server
responses during 9P RPC calls to I/O wait time in system metrics. As a
result, I/O-intensive operations on a 9pfs mount will now be reflected
in the "wa" column instead of the "id" one of tools like top.

Thanks,

Remi Pommarel (2):
  wait: Introduce io_wait_event_killable()
  9p: Track 9P RPC waiting time as IO

 include/linux/wait.h | 15 +++++++++++++++
 net/9p/client.c      |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] wait: Introduce io_wait_event_killable()
  2026-01-21 19:21 [PATCH 0/2] wait/9p: Account 9P RPC waiting time as I/O wait Remi Pommarel
@ 2026-01-21 19:21 ` Remi Pommarel
  2026-01-21 19:43   ` Peter Zijlstra
  2026-01-21 19:21 ` [PATCH 2/2] 9p: Track 9P RPC waiting time as IO Remi Pommarel
  1 sibling, 1 reply; 5+ messages in thread
From: Remi Pommarel @ 2026-01-21 19:21 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, v9fs
  Cc: Juri Lelli, Vincent Guittot, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, linux-fsdevel, linux-kernel,
	Remi Pommarel

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 f648044466d5..dce055e6add3 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] 9p: Track 9P RPC waiting time as IO
  2026-01-21 19:21 [PATCH 0/2] wait/9p: Account 9P RPC waiting time as I/O wait Remi Pommarel
  2026-01-21 19:21 ` [PATCH 1/2] wait: Introduce io_wait_event_killable() Remi Pommarel
@ 2026-01-21 19:21 ` Remi Pommarel
  2026-01-21 23:20   ` Dominique Martinet
  1 sibling, 1 reply; 5+ messages in thread
From: Remi Pommarel @ 2026-01-21 19:21 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, v9fs
  Cc: Juri Lelli, Vincent Guittot, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, linux-fsdevel, linux-kernel,
	Remi Pommarel

Use io_wait_event_killable() to ensure that time spent waiting for 9P
RPC transactions is accounted as IO wait time.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
---
 net/9p/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index f60d1d041adb..1b475525ac5b 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -590,8 +590,8 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
 	}
 again:
 	/* Wait for the response */
-	err = wait_event_killable(req->wq,
-				  READ_ONCE(req->status) >= REQ_STATUS_RCVD);
+	err = io_wait_event_killable(req->wq,
+				     READ_ONCE(req->status) >= REQ_STATUS_RCVD);
 
 	/* Make sure our req is coherent with regard to updates in other
 	 * threads - echoes to wmb() in the callback
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] wait: Introduce io_wait_event_killable()
  2026-01-21 19:21 ` [PATCH 1/2] wait: Introduce io_wait_event_killable() Remi Pommarel
@ 2026-01-21 19:43   ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2026-01-21 19:43 UTC (permalink / raw)
  To: Remi Pommarel
  Cc: Ingo Molnar, v9fs, Juri Lelli, Vincent Guittot,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	linux-fsdevel, linux-kernel

On Wed, Jan 21, 2026 at 08:21:58PM +0100, Remi Pommarel wrote:
> 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>

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

> ---
>  include/linux/wait.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index f648044466d5..dce055e6add3 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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] 9p: Track 9P RPC waiting time as IO
  2026-01-21 19:21 ` [PATCH 2/2] 9p: Track 9P RPC waiting time as IO Remi Pommarel
@ 2026-01-21 23:20   ` Dominique Martinet
  0 siblings, 0 replies; 5+ messages in thread
From: Dominique Martinet @ 2026-01-21 23:20 UTC (permalink / raw)
  To: Remi Pommarel
  Cc: Peter Zijlstra, Ingo Molnar, v9fs, Juri Lelli, Vincent Guittot,
	Eric Van Hensbergen, Latchesar Ionkov, linux-fsdevel,
	linux-kernel

Remi Pommarel wrote on Wed, Jan 21, 2026 at 08:21:59PM +0100:
> Use io_wait_event_killable() to ensure that time spent waiting for 9P
> RPC transactions is accounted as IO wait time.

Thanks for splitting this out of your other 9p improvements!

I was about to ask Peter/Ingo which tree this should go through, but
could you also convert the other few wait_event_killable() calls in
net/9p/trans_*.c ?
They're either waiting for other IO to complete (virtio x2) or for the
current IO to complete (virtio/xen), so I think they qualify just as
much.

(the virtio ones will likely conflict with some other rework that's been
dragging on last month, but given the patch is trivial it won't matter
much, you can send as of master)

Thanks,
-- 
Dominique Martinet | Asmadeus

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-21 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 19:21 [PATCH 0/2] wait/9p: Account 9P RPC waiting time as I/O wait Remi Pommarel
2026-01-21 19:21 ` [PATCH 1/2] wait: Introduce io_wait_event_killable() Remi Pommarel
2026-01-21 19:43   ` Peter Zijlstra
2026-01-21 19:21 ` [PATCH 2/2] 9p: Track 9P RPC waiting time as IO Remi Pommarel
2026-01-21 23:20   ` Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox