From nobody Mon Feb 9 10:34:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7AA7C0015E for ; Tue, 11 Jul 2023 08:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbjGKIOL (ORCPT ); Tue, 11 Jul 2023 04:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjGKIOF (ORCPT ); Tue, 11 Jul 2023 04:14:05 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B9EE4B for ; Tue, 11 Jul 2023 01:14:03 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so56537425e9.3 for ; Tue, 11 Jul 2023 01:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689063242; x=1691655242; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4S5VQld6DUPIPHyaiomd1pydQF9NTtq/i3Ejp02y1Iw=; b=eywoMGOxzSBQFd1hDBBI6K6LFUOjyfsXmJWfuZrGjGGoDM5BQk56onazWMoUQxOXKR Usz1OyXgfHVmm9vxkB+jBMHRO5oCTpMWrH76syCbuZ9oMZNuNfhQ8+KZKC0KWUmdt+y1 mCF3wp4ulljLY2+KmlTluQvx1ObJKd8dRz4h863V445p1fVF5hLnVEp1Ete74RMoV0Sw wvCJub65l56SZFhKlGQ71fwchKQA5UdgvH29GdRsVJyiGcqpSSPEpNk3Y5/40OC93Dof rdGbDECXNaxIiom/dz68sWoIV2KtAXNeQ7YPJ5Xnuz1hqFLNUQkUSCFx/9qPz9lSGZbN aifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689063242; x=1691655242; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4S5VQld6DUPIPHyaiomd1pydQF9NTtq/i3Ejp02y1Iw=; b=btWgzv0Sv5JvXILnbUvXcfyKJuJI68n4ud7Hrd1zjViPv17+eBvRj9CaKRcxztyrln J77mmUaKgkJAFRr1a/VHIJfQQHixkQxp0wqYJs+vQrdX588VYpkd/re5wZVAhKbwU2WI ztxS7YrhXyIju+9mEls8Y2h2Sb+O4NHZPdnIl2KMglxqSWc2mV4vg9FbK/GmqDa7I09B P+iDebjwkzivFjhN3BBWkTULiABwd3uAZsK8kNmzpDNlj/Jbd9iGDIWIcBHgLwrg4tds 6jUOPNO75+ZUFMjFrSxhv9amx7rTHVIOcr7HB/MmgrJaQdelpQLl5MCEUGtUIYIbFnv+ sjmw== X-Gm-Message-State: ABy/qLalHEaQH6dvBLWcD1kyADGby225UMt+gyQw/UZgL/QKaOjjh0Fh DmnZLVPAavwJDNksAHy6EgZ6U3kM0MRwR0Bcx9w= X-Google-Smtp-Source: APBJJlFIF92eKTO5jqJkcsH4+paSoH0SQB1tCqNoyYZi/gjv/ApcSFGEkdkKJW9gP0ghpQutRy3imw== X-Received: by 2002:a5d:48d2:0:b0:314:9b6:6362 with SMTP id p18-20020a5d48d2000000b0031409b66362mr13138619wrs.57.1689063241943; Tue, 11 Jul 2023 01:14:01 -0700 (PDT) Received: from vingu-book.. ([2a01:e0a:f:6020:dee8:b15f:d20f:eee9]) by smtp.gmail.com with ESMTPSA id h7-20020a5d5487000000b0030ae901bc54sm1531792wrv.62.2023.07.11.01.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 01:14:01 -0700 (PDT) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, jiahao.os@bytedance.com Cc: Vincent Guittot Subject: [PATCH] sched/fair: stabilize asym cpu capacity system idle cpu selection Date: Tue, 11 Jul 2023 10:13:59 +0200 Message-Id: <20230711081359.868862-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" select_idle_capacity() not only looks for an idle cpu that fits for the waking task but also for cpu with highest bandwidth when no cpu fits. Start the loop with target cpu so it will be selected 1st when no cpu fits but several cpus shared the same bandwidth. Starting with target cpu prevents the task to migrate between cpus with same bandwidth at every wakeup when no cpu fits. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a80a73909dc2..0ee116f992f4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7065,7 +7065,7 @@ select_idle_capacity(struct task_struct *p, struct sc= hed_domain *sd, int target) util_min =3D uclamp_eff_value(p, UCLAMP_MIN); util_max =3D uclamp_eff_value(p, UCLAMP_MAX); =20 - for_each_cpu_wrap(cpu, cpus, target + 1) { + for_each_cpu_wrap(cpu, cpus, target) { unsigned long cpu_cap =3D capacity_of(cpu); =20 if (!available_idle_cpu(cpu) && !sched_idle_cpu(cpu)) --=20 2.34.1