Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2176306rdf; Mon, 6 Nov 2023 06:56:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLTOeAyj8na3LmAS85EUwIFKzY/xhw3rbmR8Q0MnUsuqZB/07J0rO1sn1d7YvG6ov5zLdb X-Received: by 2002:a05:6358:5924:b0:168:de6b:6c70 with SMTP id g36-20020a056358592400b00168de6b6c70mr28293291rwf.1.1699282581148; Mon, 06 Nov 2023 06:56:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699282581; cv=none; d=google.com; s=arc-20160816; b=X0hnrgAW3QGqRJEYyI4k9JnBPKWMyOrD9ThctNl4H+V5VgGz9qwyN+c8VMjIpeRbNM ixf1nrZIHTJ/ZtFrsf8xhL7TUytN7deshORkR+30DGwfixycyA/NWQ0A71d339EB5/SG 62rmsJjX8jNPWXQ2WZyQG0vSp4Dl4tXazs2x7fhEdZebpHxfkQQaEYI1fRt9eloIWTEu nhbxtbhQTH3FJD6d/tWOeLQpW3WbmGu7YOaA0c3L6w2QIhnGaQ3+FlGzxmNpJRrCB16/ ne5VY2unMwkP0VBnnxe90bXdNFeA7rW72iayIAiQWn5dYMkHcJtKO2ew6DSDm/Vbsozv L4Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Iairs2nHbf4BFvIm6R4/DL1Lv/6t5zKTAWcYMmkRBmo=; fh=sahU2PNMYW875cC8jXyQjK/dL/DL1L+GtAeFRLwKzH0=; b=Fa3RsdeH+32n2dA1WU7rfICsn1RRJltnnjMo6slZaHBokuYfYPt65o/mPHc6oifY6D gEv7MlKFl8D7GdmtnalpoUYVinUv9HOxy4aMQUGSZnfX2fNbuEhSzqapL2yb+rpzAMDC P2fYI7P25Ad+P9vSfDnJPoVuwM5YHDm5q8DKeu9gaLWKjE3A652/RwMYe6Gbc3bQqfyc lsKaI/b/mTK+q9olXz/a2XFdd9nM2gm3W34G7gghYOuzy3aGRqhi9tfTrss5KkOW5hi0 C5rRY5Isx4T7id1dXpZcbHgpjYJK6X9j4h9T3oaxkJt0zCzi51nd34f7mRCl7IfNLKkb XGtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=2k2tFvPu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g10-20020a63110a000000b005b9302f3e47si7925224pgl.3.2023.11.06.06.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 06:56:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=2k2tFvPu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 44C068069D82; Mon, 6 Nov 2023 06:55:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231909AbjKFOz3 (ORCPT + 99 others); Mon, 6 Nov 2023 09:55:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbjKFOzZ (ORCPT ); Mon, 6 Nov 2023 09:55:25 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09997B6 for ; Mon, 6 Nov 2023 06:55:23 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-7748ca56133so41197439f.0 for ; Mon, 06 Nov 2023 06:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1699282522; x=1699887322; 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=Iairs2nHbf4BFvIm6R4/DL1Lv/6t5zKTAWcYMmkRBmo=; b=2k2tFvPu8qRmpOnG+RiggRUTFNK/9Zy6UWXbrZjYt2n7CyZiFT2s1T4v+W7mdL1yM3 VY7X7dmA7OMhpkacCdHBiHaHI07Cj411B+YdTMEajUBSk0YoNQc476nm8e3WVfAZDLcP ++Lv3l5+Bhv5FplzALUKJAE4SjpezHeyKOAUeJS8IHu/OFwwpTOJV8932MXyj1gdQW0e 8fqGI0TQUtNosHvEpnoSK5YHN0vIqoCgtWSeroUZ4/lR9u96bvLa9sIntZgSoB65GaQ7 kEd/pAfwhydldOle+MCFKIX78Nuy6zzbP+Y/tQp8mHhrYDxL1FpQXvXQQyUEdi8qGXZK zSRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699282522; x=1699887322; 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=Iairs2nHbf4BFvIm6R4/DL1Lv/6t5zKTAWcYMmkRBmo=; b=KzObPJS+kO1kdmE1aDtnnX0jhr5KKPyXtAf7QRFXU/VOVx9eRGeV2b3jTdBlYUrrbg gvUpLepjQQPI41CGCXtBrAfaXfygr1n13yB9Whh7Gnf+I+ZNk6gteg/lY27xRSyiG3cW gTNK1N4UFxNSoZh7VQ+rRYXf7dN1q5+cEt/fEvL4SRLraNs8rW8qivzEr/26OD4ZIQWD NZrkjA4DqLmgZThA9rCXwMzzQ/R47pbGLUEqSvGRpHpHfMT5Zt7UttPH0UDkTgTWnyMF Jpgur/w+xFZoYW7eWRCFqc2wp80utfAxO91EomN4lRiyJ04uk9ODKHJjBKzrScOnqa5h Ynvw== X-Gm-Message-State: AOJu0YwQttazRzLvnOPP5nZcXfkosXhTzKsxFYnFtucKoaHi1f/okkuD /KwQ61itPMCUSJ9KxLUHksTbKA== X-Received: by 2002:a92:d08b:0:b0:359:39ac:a161 with SMTP id h11-20020a92d08b000000b0035939aca161mr15435444ilh.1.1699282522379; Mon, 06 Nov 2023 06:55:22 -0800 (PST) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id gs25-20020a0566382d9900b0042b2f0b77aasm2118414jab.95.2023.11.06.06.55.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Nov 2023 06:55:21 -0800 (PST) Message-ID: <2a1bdb5a-1216-45b0-a78d-5542b36ccd17@kernel.dk> Date: Mon, 6 Nov 2023 07:55:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] IO_URING: Statistics of the true utilization of sq threads. Content-Language: en-US To: Xiaobing Li , asml.silence@gmail.com Cc: 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: <20231106074055.1248629-1-xiaobing.li@samsung.com> From: Jens Axboe In-Reply-To: <20231106074055.1248629-1-xiaobing.li@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 06:55:43 -0800 (PST) On 11/6/23 12:40 AM, Xiaobing Li wrote: > Since the sq thread has a while(1) structure, during this process, there > may be a lot of time that is not processing IO but does not exceed the > timeout period, therefore, the sqpoll thread will keep running and will > keep occupying the CPU. Obviously, the CPU is wasted at this time;Our > goal is to count the part of the time that the sqpoll thread actually > processes IO, so as to reflect the part of the CPU it uses to process > IO, which can be used to help improve the actual utilization of the CPU > in the future. > > Signed-off-by: Xiaobing Li > --- > io_uring/sqpoll.c | 8 ++++++++ > io_uring/sqpoll.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c > index bd6c2c7959a5..27b01ad42678 100644 > --- a/io_uring/sqpoll.c > +++ b/io_uring/sqpoll.c > @@ -224,6 +224,7 @@ static int io_sq_thread(void *data) > struct io_ring_ctx *ctx; > unsigned long timeout = 0; > char buf[TASK_COMM_LEN]; > + unsigned long long start, begin, end; > DEFINE_WAIT(wait); These can just be unsigned long, that's the size of jiffies on any platform. Ditto for struct io_sq_data. And while this looks fine, nothing is using this accounting. For this to be an acceptable patch, surely the value needs to be used somehow or at least you should be able to query it? -- Jens Axboe