All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] io_uring: store pid of sqthread for userspace usage
@ 2021-07-12 17:31 Hao Xu
  0 siblings, 0 replies; only message in thread
From: Hao Xu @ 2021-07-12 17:31 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Pavel Begunkov, Joseph Qi

users may want to change the schedule policy and priority of sqthread.
So it's good to store this info in io_uring_params.

Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
 fs/io_uring.c                 | 1 +
 include/uapi/linux/io_uring.h | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca9172f51a77..9f7101f3c28d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8054,6 +8054,7 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
 		wake_up_new_task(tsk);
 		if (ret)
 			goto err;
+		p->sq_thread_pid = task_pid_vnr(tsk);
 	} else if (p->flags & IORING_SETUP_SQ_AFF) {
 		/* Can't have SQ_AFF without SQPOLL */
 		ret = -EINVAL;
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 79126d5cd289..07b624be7a66 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -254,7 +254,10 @@ struct io_uring_params {
 	__u32 sq_entries;
 	__u32 cq_entries;
 	__u32 flags;
-	__u32 sq_thread_cpu;
+	union {
+		__u32 sq_thread_cpu;
+		__s32 sq_thread_pid;
+	};
 	__u32 sq_thread_idle;
 	__u32 features;
 	__u32 wq_fd;
-- 
2.24.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-12 17:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 17:31 [PATCH 2/2] io_uring: store pid of sqthread for userspace usage Hao Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.