[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <93c6f293-7aa5-4e12-b238-f369d53ab28e@kernel.dk>
Date: Mon, 13 Nov 2023 09:38:19 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Xiaobing Li <xiaobing.li@...sung.com>
Cc: asml.silence@...il.com, linux-kernel@...r.kernel.org,
io-uring@...r.kernel.org, kun.dou@...sung.com,
peiwei.li@...sung.com, joshi.k@...sung.com,
kundan.kumar@...sung.com, wenwen.chen@...sung.com,
ruyi.zhang@...sung.com
Subject: Re: [PATCH v2] io_uring: Statistics of the true utilization of sq
threads.
On 11/12/23 8:10 PM, Xiaobing Li wrote:
> After careful consideration and testing, I don't think getting the
> uring_lock is possible here, for the following reasons:
> Due to lock competition, ctx->uring_lock and sq->lock are usually not
> available here. The best proof is that the values of SqThread and
> SqThreadCpu always output -1. In this case, it is impossible to obtain
> the required work_time and total_time values.
> In fact, it should be feasible to obtain work_time and total_time by
> judging that ctx->sq_data is not NULL, because if the sq thread exits,
> the action of reading data will also stop, and the possibility of a null
> pointer reference is very low.
We have that problem right now, in the current tree. And agree it's not
the best. sq_data should be fine under the (ctx) lock, it's just the
thread that may go away. Maybe we just cache the cpu/pid of it when we
create it, seems better than needing to query it. And for the other
stats, should be fine in ctx->sq_data.
--
Jens Axboe
Powered by blists - more mailing lists