public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Pavel Begunkov <[email protected]>,
	Joseph Qi <[email protected]>
Subject: [PATCH 2/2] io_uring: store pid of sqthread for userspace usage
Date: Tue, 13 Jul 2021 01:31:34 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

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 <[email protected]>
---
 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


                 reply	other threads:[~2021-07-12 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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