Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp403195rdb; Mon, 29 Jan 2024 06:02:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx6v+Mggb3oGr7cHgEKZyL4Nerh1Cla946WAa+VOh27955nKBBkIDxPq1A5NuJuVy5CBIj X-Received: by 2002:a05:6a20:5294:b0:19c:4c01:1bcc with SMTP id o20-20020a056a20529400b0019c4c011bccmr2013288pzg.49.1706536961808; Mon, 29 Jan 2024 06:02:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706536961; cv=pass; d=google.com; s=arc-20160816; b=GbDzo9ZR+V21OR+ufuoCsbKtbs0j11iFdgnsqYLmLtjEcY8062N70tkMTZKrRt9dfP tK045PdeS7pJT7fKifm4DrvLkI/iMrsHFinw1AD4njcamlB5wpX++PrdWd3/A9DihamW 4JPYjVUn+IWYHxdVgwFddHLR2iP8D6uKyT3Ah2Vc7+31ABg4NV4FzmfktEAhqQlLXX01 iwzvQXslmosvd8/9nxM1nZ8Tcb33dRKqgagOC9jyDG02azRRJcsTeopp1F8OPGWfKOwn YPeutJMIrMU3rvU1tLbCO3qKxXzWj3XT806tPXF84EgNExfa04qnQ5UkYQjD2FTmhell 1tXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DPwleXPZEicef5bpuduhRFgNi3FvwGm9SY6PNmOkghM=; fh=P7hPToMPKBRe8lSm6gB0UjnjcWqplpQBqY55CEkg+2A=; b=GefZoxzQVvtoGPmN7r+3R5xhC/ezrfsgatjAEgS4G+t0BdVYGCred8hWbqbJ3GW3+h DEfLznBSa2uAPnn/3QIQxRO7KVL+/Eg88zov/Yjnp0lZJui4AIuYumj4Z9nCO2AtIc5e 0I9YWlX7FjS/FrG85DS6rMRgjY5De5oQy+/5dR2ZjiuAfXOmHxvkQ6nLOKUFHrazmvfJ 1uVqOl1op3W/lk2OhHvdeff2elGDoMxLeHjefqrWsk6aOTOdoLuMBk9tJJys8cQysF21 4b1IQRs8elXRvmQgik4s2AMoZ8Go6ZtVPukGzHE16+cpQxrAJB/3ZhzPuqKSbr9r7KjQ jTTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=QAESJruz; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-42854-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42854-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s20-20020a170902989400b001d8e9e54659si1238739plp.381.2024.01.29.06.02.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42854-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=QAESJruz; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-42854-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42854-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2215A2823CD for ; Mon, 29 Jan 2024 14:00:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8067657D4; Mon, 29 Jan 2024 14:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="QAESJruz" Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 296F2657B3 for ; Mon, 29 Jan 2024 14:00:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536846; cv=none; b=lc/xsKcbblgQuEM+yzix3avgKsrb1MV5epURRsPkpURvCzhvWFGdTlPGxuZfFB80K44xZuVSGCVrSsUuPNp9/N+ubyAHgkzC0gLCPucHgbz2lPyH5jrfcJxnZ8n4fHhZ122C7Wh8T4ceZqznkuAT1kUZDYDhdGiKLL1Teul1pDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536846; c=relaxed/simple; bh=SQ04STe/aYVjnCBxYeWBjsaMc9GpyngM0NMmL+Lhc24=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LfxVkd0GdaTFxhl1BI2cwisAICHT5RYdjvEeeIMux2sJbTKHo2N80Y+omwct2o3H/OD4afyuPuEZ2LiQp0xYUIM/4oWYsVXh1ovYz9A1sT2H9v6+SEwy73sY906O7HoNnV3g01qp4Vh6PMQHVOPNNCoJ4KhiIyDHXLI00GZ17BE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=QAESJruz; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d748f1320aso3916865ad.0 for ; Mon, 29 Jan 2024 06:00:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1706536842; x=1707141642; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DPwleXPZEicef5bpuduhRFgNi3FvwGm9SY6PNmOkghM=; b=QAESJruzc6Ul4WUtsezjJyP37fftVpXQHOkS9mGGLZZx67mL+MEPNTczo4sGps516S JTIoE81Ia8PQOqLsn5mlMxbiUGSwWeKspn3z64LUerA4UHfpMFL+FfhJbjwWLqUIgdml lVP2LnrO29rjetqfQHayzU4VttDssIJ6lYKKyFAGZZwH1PTRdQfLbZYDOgo5KPHjJ/I+ 4IBxKSlfZJFVBTZz7EeAuYY242xbqhJSWKpzbJN7G/cuWTKl/MM4cZwgzynFtaUvCPw1 O6PW0Mk7zjNyYwAw7cLtSXGtE6nXMO/HCmmRCF+D1qatJGDVz3rqSHGqSzSr7+OIOhJx Hpqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706536842; x=1707141642; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DPwleXPZEicef5bpuduhRFgNi3FvwGm9SY6PNmOkghM=; b=ZmRN0EAAoiS+m8v0dQOPGA6MBebF0c0s6+kY73guLAM3tP9VSaOC6KntwdAyke7Scn ln2dp501m65vMHwWkmcQn3++v103shwnBEk8DY9HJK0iney0KYGr6cTYoEmxWo00G1bm g3wCTr2tvdT66+KhjSxauiGN5YLJddKdfhRjN5PdjXE8Du9jIWN8wbPZdT00QiCjqTZ5 i65bue+IKvW0lBPpH//y3pPQWUqF5Bx0HMebtQXjOGeN3Ag+25bOldALkFvyQfjoEQFz lN2e8CEvNgQoxH9KEsJSl6fNUkxgq00U8CfwylJI4gP7gitRJq3MJdIxdvNPi5+gKmHY Q94w== X-Forwarded-Encrypted: i=0; AJvYcCVejm002qqGVcQPwKF51llWEQwG8+wud4FOS3oAQsqD/0Z4KWmfCflhLt7Tql2N7orpcR2FGuum3oVpJGq2P8ivZ4ol6xnf222amta/ X-Gm-Message-State: AOJu0Yz788lotHLQDpNDSYMbYkNho+wLzpFVG5e7qdk49VNg2axFyZD5 1lvri8a/Z94kFmmkbzUFoCu6LeF+cKlO/U/uZ9c7tC2m1+8K4Y3y0V+tuflbbgLussXmwVVXw4B Xrm4= X-Received: by 2002:a17:903:32c5:b0:1d3:e503:5b55 with SMTP id i5-20020a17090332c500b001d3e5035b55mr8368129plr.2.1706536841622; Mon, 29 Jan 2024 06:00:41 -0800 (PST) Received: from [192.168.1.150] ([198.8.77.194]) by smtp.gmail.com with ESMTPSA id x5-20020a1709029a4500b001d5d736d1b2sm5354692plv.261.2024.01.29.06.00.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jan 2024 06:00:41 -0800 (PST) Message-ID: Date: Mon, 29 Jan 2024 07:00:39 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7] io_uring: Statistics of the true utilization of sq threads. Content-Language: en-US To: Xiaobing Li Cc: asml.silence@gmail.com, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, kun.dou@samsung.com, peiwei.li@samsung.com, joshi.k@samsung.com, kundan.kumar@samsung.com, wenwen.chen@samsung.com, ruyi.zhang@samsung.com References: <8e104175-7388-4930-b6a2-405fb9143a2d@kernel.dk> <20240129071844.317225-1-xiaobing.li@samsung.com> From: Jens Axboe In-Reply-To: <20240129071844.317225-1-xiaobing.li@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/29/24 12:18 AM, Xiaobing Li wrote: > On 1/18/24 19:34, Jens Axboe wrote: >>> diff --git a/io_uring/sqpoll.h b/io_uring/sqpoll.h >>> index 8df37e8c9149..c14c00240443 100644 >>> --- a/io_uring/sqpoll.h >>> +++ b/io_uring/sqpoll.h >>> @@ -16,6 +16,7 @@ struct io_sq_data { >>> pid_t task_pid; >>> pid_t task_tgid; >>> >>> + long long work_time; >>> unsigned long state; >>> struct completion exited; >>> }; >> >> Probably just make that an u64. >> >> As Pavel mentioned, I think we really need to consider if fdinfo is the >> appropriate API for this. It's fine if you're running stuff directly and >> you're just curious, but it's a very cumbersome API in general as you >> need to know the pid of the task holding the ring, the fd of the ring, >> and then you can get it as a textual description. If this is something >> that is deemed useful, would it not make more sense to make it >> programatically available in addition, or even exclusively? > > Hi, Jens and Pavel > sorry for the late reply. > > I've tried some other methods, but overall, I haven't found a more suitable > method than fdinfo. > If you think it is troublesome to obtain the PID, then I can provide > a shell script to output the total_time and work_time of all sqpoll threads > to the terminal, so that we do not have to manually obtain the PID of each > thread (the script can be placed in tools/ include/io_uring). > > eg: > > PID WorkTime(us) TotalTime(us) COMMAND > 9330 1106578 2215321 iou-sqp-9329 > 9454 1510658 1715321 iou-sqp-9453 > 9478 165785 223219 iou-sqp-9477 > 9587 106578 153217 iou-sqp-9586 > > What do you think of this solution? I don't think it's a great interface, but at the same time, I don't feel that strongly about it and perhaps bundling a script that outputs the above in liburing would be Good Enough. I'm a bit reluctant to add a stats API via io_uring_register() just for this. So maybe spin a v8 with the s/long long/u64 change and include your script as well? -- Jens Axboe