Received: by 2002:a05:7208:3228:b0:82:47:81bb with SMTP id cb40csp2637194rbb; Tue, 16 Apr 2024 07:28:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjvkP6DWLu8fXgPxEoUx32lDriCXbR/XJ3w1jbrz1UBrPmK6mJ11SsOBXXvhhwVYGAks5As84JK+jcGgVx8lI02W2SehfUhXmfAKoBtA== X-Google-Smtp-Source: AGHT+IFmKaZGouNPc5hAq+G0zzkqN/2b2ZPbGFHeUPRhMqsD6k1CLsDOYp3OKh001t8L3Dt+/BR/ X-Received: by 2002:a05:620a:40c2:b0:78e:f736:9d4c with SMTP id g2-20020a05620a40c200b0078ef7369d4cmr1983125qko.63.1713277688572; Tue, 16 Apr 2024 07:28:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713277688; cv=pass; d=google.com; s=arc-20160816; b=S1jFHjjcx2INRQj5zCVX2Yrg6UL9gqP6yYAxTlt+ZJPdskSXYRVjfAZ48aVRmtrnRp 1+21vre+XveQUsVFcVX74GC34Gx/UpgRCUIS16f2JkjON/GPD9ReApoR65IhfX1l6eG8 IaQgA7KZxcBmzLHLWVhy6jxjKSd3mR7YIF+hXvW79Ioc+yllMpxu9kp2RfqnK8TNYq7k uhVtRGH3ANR7AEJ1Uk21v4WZm1leW/oM56RinMKEOv8EE0iYduRx4alSeC05ZM3Dfytn BzDowgGe37HMgrCN4hZsI2rMgLEeYf6L9ukaGWzDwYxQP+9iKSGyxa0HgJHdk1Tljz2y JqPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=7O48HlSfBjNVNTZIa0RcDXGprx4zRJryz7fmwPLcZJ4=; fh=J9HIrOqVDJm1trl/Lk3bpoULRQNgRD/IJ46MjC2l1N4=; b=UmXfNVn/vQCZd2Z8y2xP6kkBRgOm7zY8N1ovU66O112lEBshKSAfDy3BPuBH7CVW+W mtp3WAX+hcyQypl7L/6QKHjlh1aokuz2V4/BQ34vmuGaAoPoDH1Xy1LsQSZ5wOYNYKQf frF+idhGVxfPPlO/y2ZLD6LzzeGvDI8pqZbKzShvv6bcpcugOcAxw3yBFenHeHaWq3xi bV0g/SX//FYMtsMYJPG9S82fGubFme+oelxOgBNJskUgzX/6qAovWozcvfD6SWJSlwpP wB6W+l+Em7Q1xse3xveQWk9CQOFzFLt87Nvb8BylWn+/HIryQKZznsx5CBskya/Biw72 LbsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-147010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v21-20020a05620a441500b0078ef44664b4si2031245qkp.767.2024.04.16.07.28.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:28:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-147010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 28C721C2097B for ; Tue, 16 Apr 2024 14:28:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40260132C15; Tue, 16 Apr 2024 14:25:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9348512D1FD for ; Tue, 16 Apr 2024 14:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713277534; cv=none; b=qJOVSAzT/HjCf2hxJ1B61+AdlxuDmsz/TkqYBtOkqlHW9dS3Obor3kZu3Dw+RQOd4vW4/D/2rjqq0aR/xlQHDlBFhptWiKcO3K4iqekbD54TXWhZibIa5wOkoGRn5sJK68MGzcXV1zsSIfHeErRVOLl4AN5FkAdMkVVfrgOlipE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713277534; c=relaxed/simple; bh=NtzZhWCLoYDyDEaIaBdGSQB1n+vHC8iXmb9QjPQS5BU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=uZGZ4+SG75Z4jQK25EX7Ze1Q/h8sf/1jOWrTQXN8TqU8RrmI45LOIZ3vudcpo8FusZPuewsCdqsDoV/l2R+sGlEUXX/iSS0JkrBwOWjoXbefbsg71x6cqwMVrtjgnwY0LRcteeK/ravgHzjIxnwaXAA99QbdSZh7yWdlN5Qmxi8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37503339; Tue, 16 Apr 2024 07:25:58 -0700 (PDT) Received: from [10.1.26.17] (e133047.arm.com [10.1.26.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CE3F73F738; Tue, 16 Apr 2024 07:25:28 -0700 (PDT) Message-ID: <29b6f42f-6917-4584-a53a-4711754c6fcf@arm.com> Date: Tue, 16 Apr 2024 15:25:26 +0100 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 4/4] sched/core: split iowait state into two states From: Christian Loehle To: Jens Axboe , linux-kernel@vger.kernel.org Cc: peterz@infradead.org, tglx@linutronix.de References: <20240416121526.67022-1-axboe@kernel.dk> <20240416121526.67022-5-axboe@kernel.dk> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 16/04/2024 15:10, Christian Loehle wrote: >>[snip] >> + atomic_long_add(val, &task_rq(p)->nr_iowait); >> #else >> - atomic_inc(&task_rq(p)->nr_iowait); >> + int val = 1 + ((int) p->in_iowait_acct << 16); >> + atomic_add(val, &task_rq(p)->nr_iowait); >> #endif >> } >> >> static void task_iowait_dec(struct task_struct *p) >> { >> #ifdef CONFIG_64BIT >> - atomic_long_dec(&task_rq(p)->nr_iowait); >> + long val = 1 + ((long) p->in_iowait_acct << 32); >> + atomic_long_sub(val, &task_rq(p)->nr_iowait); >> #else >> - atomic_dec(&task_rq(p)->nr_iowait); >> + int val = 1 + ((int) p->in_iowait_acct << 16); >> + atomic_sub(val, &task_rq(p)->nr_iowait); >> #endif >> } >> >> int rq_iowait(struct rq *rq) >> { >> #ifdef CONFIG_64BIT >> - return atomic_long_read(&rq->nr_iowait); >> + return atomic_long_read(&rq->nr_iowait) & ((1UL << 32) - 1); >> +#else >> + return atomic_read(&rq->nr_iowait) & ((1U << 16) - 1); >> +#endif >> +} >> + >> +int rq_iowait_acct(struct rq *rq) >> +{ >> +#ifdef CONFIG_64BIT >> + return atomic_long_read(&rq->nr_iowait) >> 32; >> #else >> - return atomic_read(&rq->nr_iowait); >> + return atomic_read(&rq->nr_iowait) >> 16; >> #endif >> } >> >> @@ -5497,7 +5514,12 @@ unsigned long long nr_context_switches(void) >> * it does become runnable. >> */ >> >> -unsigned int nr_iowait_cpu(int cpu) >> +unsigned int nr_iowait_acct_cpu(int cpu) > > There is a comment above here by Daniel referring to "these two > interfaces [...]", originally referring to nr_iowait_cpu() and > get_iowait_load(). > get_iowait_load() was removed in commit a7fe5190c03f ("cpuidle: menu: Remove get_loadavg() from the performance multiplier") > but nr_iowait_cpu() remains, so the comment should remain above it. > Rewording is also way overdue, although that's hardly on your > patch ;) > FWIW, but also feel free to reword yourself. From ba66fe24c64f5615b9820b0fe24857ecbf18fc5f Mon Sep 17 00:00:00 2001 From: Christian Loehle Date: Tue, 16 Apr 2024 15:20:22 +0100 Subject: [PATCH] sched/core: Reword comment about iowait interface The original comment referenced an interface which was removed in the meantime by commit a7fe5190c03f ("cpuidle: menu: Remove get_loadavg() from the performance multiplier"). Furthermore the function has moved so move the comment accordingly. Signed-off-by: Christian Loehle --- kernel/sched/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d52d3118dd73..bb10b9bc37d6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5507,18 +5507,19 @@ unsigned long long nr_context_switches(void) return sum; } -/* - * Consumers of these two interfaces, like for example the cpuidle menu - * governor, are using nonsensical data. Preferring shallow idle state selection - * for a CPU that has IO-wait which might not even end up running the task when - * it does become runnable. - */ unsigned int nr_iowait_acct_cpu(int cpu) { return rq_iowait_acct(cpu_rq(cpu)); } +/* + * Consumers of this interface like the cpuidle menu governor are using + * nonsensical data. Preferring shallow idle state selection for a CPU that + * has IO-wait which might not even end up being selected for the task again + * when it does become runnable. + */ + unsigned nr_iowait_cpu(int cpu) { return rq_iowait(cpu_rq(cpu)); -- 2.34.1