From: Xiaobing Li <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
[email protected], [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected]
Subject: Re: [PATCH v3] io_uring/fdinfo: remove need for sqpoll lock for thread/pid retrieval
Date: Wed, 15 Nov 2023 14:10:27 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 11/15/23 2:36 AM, Jens Axboe wrote:
> if (has_lock && (ctx->flags & IORING_SETUP_SQPOLL)) {
> struct io_sq_data *sq = ctx->sq_data;
>
>- if (mutex_trylock(&sq->lock)) {
>- if (sq->thread) {
>- sq_pid = task_pid_nr(sq->thread);
>- sq_cpu = task_cpu(sq->thread);
>- }
>- mutex_unlock(&sq->lock);
>- }
>+ sq_pid = sq->task_pid;
>+ sq_cpu = sq->sq_cpu;
> }
There are two problems:
1.The output of SqThread is inaccurate. What is actually recorded is the PID of the parent process.
2. Sometimes it can output, sometimes it outputs -1.
The test results are as follows:
Every 0.5s: cat /proc/9572/fdinfo/6 | grep Sq
SqMask: 0x3
SqHead: 6765744
SqTail: 6765744
CachedSqHead: 6765744
SqThread: -1
SqThreadCpu: -1
SqBusy: 0%
-------------------------------------------
Every 0.5s: cat /proc/9572/fdinfo/6 | grep Sq
SqMask: 0x3
SqHead: 7348727
SqTail: 7348728
CachedSqHead: 7348728
SqThread: 9571
SqThreadCpu: 174
SqBusy: 95%
next prev parent reply other threads:[~2023-11-15 6:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 2:36 [PATCH v3] io_uring/fdinfo: remove need for sqpoll lock for thread/pid retrieval Jens Axboe
[not found] ` <CGME20231115061813epcas5p2bb6bebb451c6e2c65a5e9ec9ffac5f46@epcas5p2.samsung.com>
2023-11-15 6:10 ` Xiaobing Li [this message]
2023-11-15 13:42 ` Jens Axboe
2023-11-15 13:49 ` Jens Axboe
[not found] ` <CGME20231118032740epcas5p20b6aad6264323376fa024bc2a56f0990@epcas5p2.samsung.com>
2023-11-18 3:19 ` Xiaobing Li
2023-11-19 21:23 ` Jens Axboe
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] \
[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