[2/9] sched/balancing: Remove reliance on 'enum cpu_idle_type' ordering when iterating [CPU_MAX_IDLE_TYPES] arrays in show_schedstat()
Message ID | 20240304094831.3639338-3-mingo@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1316775dyc; Mon, 4 Mar 2024 01:50:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUO4gJoiwuFmTkcRJw/scpNrCjhpmp5Q9xLZZ43XsQbuxDoeI0A31BPEgeI9XgmLKu8OdF8jRkaVsyAUftX57u8cToIOg== X-Google-Smtp-Source: AGHT+IFLJhHmalX2q8yVw2qEFeczq2f9w94vSpDTkxHlDzIV3QhH/MNUZ+/iWQwUAZXsIW0R2FfA X-Received: by 2002:a05:6870:f715:b0:21e:daef:1372 with SMTP id ej21-20020a056870f71500b0021edaef1372mr10902815oab.28.1709545821429; Mon, 04 Mar 2024 01:50:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709545821; cv=pass; d=google.com; s=arc-20160816; b=aFIHKJDNl6MgQkO/Z8drdEgv1pIo/r+F3fQm/VWsJ8kVZger6msU17WBTQckqIh7IM 4mWqEhhZ43ckYzaMvs+/J8RJNFaXUqtMZ+OHGV2knz2ZEOQ+my+EqJ2FMEPaJ30xkbei kYJpsAolvi6bHYAFN9G/tk+TzIAsz1zxmTKH4F0R2/TRADDQJbuq4h4DrZJfb0wj3JlI ziycVPMrcvqLhmT/sxxgvE77ivboC/whWC8wxoR6kBagPq+Vnw1PKmMrde6w6jK1OoCu 1PmatlvgkwWHb2BwTEaZuh2TQnYyz04xPeoDpD9brQUNScB2nTNZBj7n+D9PGpBx5yUW fLPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:sender:dkim-signature; bh=dPxGhOU8RasJef8Q2V28r0rMSdjIoPzVN4GRwFqx08I=; fh=vtn8BV17FxZCrT5lfDoFHvvFiNhej5/zWe1lGP7P6Og=; b=GsQFx43+sS7dL5ESuJabWj0HaKPo15EbiIKpMKOlKqKamoU8i1SLeJLTnfW97Gp5My v7SGlvqRhOrg9wFM5S7rax0TYXbanGzdL+p+EeOa6KUer1vnoTn9xQKG5AsnGiLFyqJx odoo4gOUemtmLW22F+njwq5MEvazlKwSyx6kwYNCLmA0cIPGB51jIWElXcop+RvlSXWF Le76DA4iad27mTq7Q09vcTImyUqSm8tYbKPL/NUOJtf+1tyE9/0k6yVWiUe57otWeP0e H4NuoYzKo0+SYO7xnYjTRgWtjAcdGLUj0rch64GOcO9d1zeRkq9SiZ7WZQQfXAiFJu1G Z0Tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bnAzd6Kv; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h1-20020a056a00170100b006e52c6bf906si8117296pfc.353.2024.03.04.01.50.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:50:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bnAzd6Kv; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90347-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 3D3D52813AC for <ouuuleilei@gmail.com>; Mon, 4 Mar 2024 09:50:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F48C364B7; Mon, 4 Mar 2024 09:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bnAzd6Kv" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 220E4249F3 for <linux-kernel@vger.kernel.org>; Mon, 4 Mar 2024 09:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; cv=none; b=M67OQ4VGQPP6vq0c2LfnHlqD3XTccMGkkOErxckpGx4kHH7dl2VwYHfjnOkp/06O3WqRRiiM1kkWcaicv/jrO1r4RIfUq5S1zd+B4VhlprPjZmCSEnYvz/14kma9O5QQN8Fz7lhm4ndZvfo2a5kOEbHnk+2TzhH4SerwKczfaSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545727; c=relaxed/simple; bh=MzgCGm4DkmCkgSo9Fwl5qScTKTAx39yHwF+oGgxbR/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hoyh+sCDJ892DCDwxUXYWTK+2U0cz/LyjMSzOlnBXPjzDSLJZ+1AZ+icunGqcIrTtWH39e88+UtPiUMB4nxeEoF0rPgbATKaPjwOdvnz5t7hOdnNXVJCzduJFZDeac54wF35qGvBIBe6CCatrDR4o3uFw0aY2s7JvLbsLEDktHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bnAzd6Kv; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a36126ee41eso648191366b.2 for <linux-kernel@vger.kernel.org>; Mon, 04 Mar 2024 01:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709545724; x=1710150524; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=dPxGhOU8RasJef8Q2V28r0rMSdjIoPzVN4GRwFqx08I=; b=bnAzd6Kvkktz8mW7ZoNQHCfR3gSVTxJNhmKFw4pubL1TIZZfNUp5qJBuf9je+nnzpe OPe1MgbEIWpq/Gb9X7gkOmJYMHI3Lb+oLgj7Ha73plpARl7u3A/MnoGXfM+RoUGBsK44 HdLTl8S5BjfQizD08ME24X/KA0UFfQKyWdMs4yzOJZx8Mylc4e1JzrXjoPgs3WZIIIBj EkC9zpdgJz+ce8/d74o+BElEszHnLKecFSwll4Me8cL7epGiWyxgBsYonhyoPkNv1n1E m6GVoccSsWS45bJIp6cQXAPHth1ADedZmuoVfAOdKNHaw8pE9ek/e3lg08o7vBNuWMFS pLVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545724; x=1710150524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dPxGhOU8RasJef8Q2V28r0rMSdjIoPzVN4GRwFqx08I=; b=mnYlTY1gsM0iODKoJirCMTvQv1b01n8siQr7hS+XXMNcOyVJHzB3K59tVMluCtjN4K +Xz29Bh9O3oOelAXinbxt6HX7hKT01qAwPhDWhzQRAEdDv65QT6J4qDEN948sCElheIy yFnVpJ61XOR7OzG7ghnNiYAGMkctd07x5qCzjqJxKgfyCyl/Nj3Q/zYsKmdJlYROiHfZ ZfdW5+2NZqgmXySs9uwkKLq39LDrOnL7x0PjPtJDG0LHi8OezOleybHZnsRLiB88jg4m n4+EqOXPJW8Vs/5NbQFGbfNLBlYXuC1T4j7WQtUwEWpf9xR+b6220k9/tpW3VeNjM1eq Mz/Q== X-Gm-Message-State: AOJu0Yz8NRNUIOL6i2AxIuUTpezGARUDZZZO5G4gEtwrMS4JpwF3poyR 4BCAYPoGCh1Eq+VBe8tl9vD4UJVfoNrdCC5tqXOuUefnRwAwghcx/pwwC4ETH3c= X-Received: by 2002:a17:906:6b94:b0:a45:26fd:f5aa with SMTP id l20-20020a1709066b9400b00a4526fdf5aamr2226490ejr.17.1709545724507; Mon, 04 Mar 2024 01:48:44 -0800 (PST) Received: from kepler.redhat.com (1F2EF13F.nat.pool.telekom.hu. [31.46.241.63]) by smtp.gmail.com with ESMTPSA id s22-20020a170906501600b00a42e2bc82dbsm4569839ejj.169.2024.03.04.01.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:48:44 -0800 (PST) Sender: Ingo Molnar <mingo.kernel.org@gmail.com> From: Ingo Molnar <mingo@kernel.org> To: linux-kernel@vger.kernel.org Cc: Shrikanth Hegde <sshegde@linux.ibm.com>, Peter Zijlstra <peterz@infradead.org>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Linus Torvalds <torvalds@linux-foundation.org>, Valentin Schneider <vschneid@redhat.com> Subject: [PATCH 2/9] sched/balancing: Remove reliance on 'enum cpu_idle_type' ordering when iterating [CPU_MAX_IDLE_TYPES] arrays in show_schedstat() Date: Mon, 4 Mar 2024 10:48:24 +0100 Message-Id: <20240304094831.3639338-3-mingo@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240304094831.3639338-1-mingo@kernel.org> References: <20240304094831.3639338-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792588719159708746 X-GMAIL-MSGID: 1792588719159708746 |
Series |
sched/balancing: Misc updates & cleanups
|
|
Commit Message
Ingo Molnar
March 4, 2024, 9:48 a.m. UTC
From: Shrikanth Hegde <sshegde@linux.ibm.com> Shrikanth Hegde reported that show_schedstat() output broke when the ordering of the definitions in 'enum cpu_idle_type' is changed, because show_schedstat() assumed that 'CPU_IDLE' is 0. Fix it before we change the definition order & values. [ mingo: Added changelog. ] Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Valentin Schneider <vschneid@redhat.com> --- kernel/sched/stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 3/4/24 3:18 PM, Ingo Molnar wrote: > From: Shrikanth Hegde <sshegde@linux.ibm.com> > > Shrikanth Hegde reported that show_schedstat() output broke when > the ordering of the definitions in 'enum cpu_idle_type' is changed, > because show_schedstat() assumed that 'CPU_IDLE' is 0. > Hi Ingo. Feel free to drop me from the changelog. > @@ -150,8 +150,7 @@ static int show_schedstat(struct seq_file *seq, void *v) > > seq_printf(seq, "domain%d %*pb", dcount++, > cpumask_pr_args(sched_domain_span(sd))); > - for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; > - itype++) { > + for (itype = 0; itype < CPU_MAX_IDLE_TYPES; itype++) { It would still not be same order as current documentation of schedstat. no? The documentation would need changes too. Change SCHEDSTAT_VERSION to 16? Current documentation says this. -------------------- The next 24 are a variety of load_balance() statistics in grouped into types of idleness (idle, busy, and newly idle): Above code will do. (busy, idle and newly idle) -------------------- Verified with the v3 patch as well using the previous method. Before patch: cpu0 0 0 4400 1485 1624 1229 301472313236 120382198 7714 [-------- idle --------][-----------busy--------][-------new-idle--] domain0 00000000,00000000,00000055 1661 1661 0 0 0 0 0 1661 2495 2495 0 0 0 0 0 2495 67 66 1 2 0 0 0 66 0 0 0 0 0 0 0 0 0 133 38 0 domain1 ff000000,00ff0000,ffffffff 382 369 13 13 4 0 2 207 198 195 3 36 0 0 0 195 67 64 3 3 0 0 0 64 4 0 4 0 0 0 0 0 0 124 9 0 domain2 ff00ffff,00ffffff,ffffffff 586 585 1 6 0 0 0 365 118 116 2 96 0 0 0 116 67 67 0 0 0 0 0 67 0 0 0 0 0 0 0 0 0 59 0 0 domain3 ffffffff,ffffffff,ffffffff 481 479 2 58 0 0 0 387 97 97 0 0 0 0 0 96 67 67 0 0 0 0 0 67 0 0 0 0 0 0 0 0 0 79 0 0 After patch: cpu0 0 0 3924 728 1940 1540 302019558490 425784368 8793 [-------- busy ----------][-----------idle--------][-------new-idle--] domain0 00000000,00000000,00000055 2494 2489 3 37 2 0 0 2489 1691 1691 0 0 0 0 0 1691 21 19 0 2 2 0 0 19 0 0 0 0 0 0 0 0 0 89 2 0 domain1 ff000000,00ff0000,ffffffff 196 193 3 44 0 0 0 193 411 400 10 2060 4 1 4 260 19 16 3 1028 0 0 0 16 3 0 3 0 0 0 0 0 0 59 2 0 domain2 ff00ffff,00ffffff,ffffffff 116 116 0 0 0 0 0 116 590 588 2 3 0 0 0 447 19 18 1 2 0 0 0 18 0 0 0 0 0 0 0 0 0 192 0 0 domain3 ffffffff,ffffffff,ffffffff 97 97 0 0 0 0 0 96 457 457 0 0 0 0 0 427 19 18 1 27 0 0 0 18 0 0 0 0 0 0 0 0 0 60 0 0 > seq_printf(seq, " %u %u %u %u %u %u %u %u", > sd->lb_count[itype], > sd->lb_balanced[itype],
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 857f837f52cb..85277953cc72 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -150,8 +150,7 @@ static int show_schedstat(struct seq_file *seq, void *v) seq_printf(seq, "domain%d %*pb", dcount++, cpumask_pr_args(sched_domain_span(sd))); - for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; - itype++) { + for (itype = 0; itype < CPU_MAX_IDLE_TYPES; itype++) { seq_printf(seq, " %u %u %u %u %u %u %u %u", sd->lb_count[itype], sd->lb_balanced[itype],