From nobody Mon Dec 1 22:06:00 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 EE5B93002AA for ; Mon, 1 Dec 2025 09:13:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764580397; cv=none; b=nUUVMS6C9TCOKz2m+UGQrNtYC9xHoF8rnu8JKymfzHhRo/W6ch4GM3F2HrTCuaIDxV4SWLuG6hNdHTZFTXtam2pLmfCbL3Q4BeIBZc3J7zRWg5ILdCxeTlPuW0YHYWpOTLQ5AcA67vztaEx2pc/gwf3jpdo1po3/Zxr6S1cRcd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764580397; c=relaxed/simple; bh=zV8/cEhPE7YZs10VV/3SNSRu2hQIU2zJ8NKh0SZ9GTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oCNbKo9ELAkmWUiB82FYNR3DF7zdS1FU/rr7PF6Zho9y02sQnLHM69hVAmruBB84A9ClL9/TaVBcNHU8KeCD3Se9NwHMv7dtuQcG+VzHS8uGvpQ2c687fv0BBugBk2xXZE9LBzeKWPd2TwOOEyip3Ny4Dr88efymiXDuM3FXtmw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UctolfIt; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UctolfIt" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-42e2d5e119fso644701f8f.2 for ; Mon, 01 Dec 2025 01:13:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764580393; x=1765185193; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OwX/olriHOAxoNjW5iw4IZ+oz3oFzlu8t83MnxTRx/U=; b=UctolfIttpGws+/h6k+ef5UHIjIeNQczHMQw8TPc4Y/f+EVqqBfhr8s6IcXDSbQVkF 2TEs2Z0r2l1GkZlHQV8Iu6SRCvimnyqYGMKK2VRVfCCB1+ZmJDbMnQ9W4z1eNU79Nmt+ +5S3BFyo57abXDev7KZX++GhDapWoJt349p8F5q9Y7DJC6ZmMFcub7F1dXaO5qxhOcfA w5ieOZ8NKXlBJ0X7gRRaJ/1tgd+bPWA/dVf6GsUv6DFciZX8O6z4lg+UgmzA0g7wuEun QgvBk4/afx2CNOaN/sI+zjy6IK6bwNJUDtwbixH5JFkHiCt3GBBRZj+Q6vJwIRAFrYcf h1Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764580393; x=1765185193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OwX/olriHOAxoNjW5iw4IZ+oz3oFzlu8t83MnxTRx/U=; b=OgfThU6nCaEcRW0kdYoZieAdN9WDf6g/zwZDnsLRtnOnEaIxAmzqH8JnPB2npUGeDb Sz6bzH5z17n5Fl5JzGG3NTa5E+yKAj7IT85Ffq/9mbRXJJaGmRfuTEHpRlRWkWmcSwxG EDgMO+U7BgV+ol5qfcuBuRGjbmFdsY5TAMhuTgxRNSS8/P7eaopb5HkknA3umB9575QT 0GkojBLC1RaBjEE9lLTSDX8GsXJiwU3hE+ozfmQlRfO9Tiwz3ZzBtoioKUtXp4R9h4Zj LwXK6AHDihJRYahn0vAHTov6RUJKMkaqbDfZdAnqjmqRD7YByvTu3RwkKoXDCRtbBs5t MqYw== X-Forwarded-Encrypted: i=1; AJvYcCVNSOkjjhoBWlrNGAPkKrWBVZfFjfv2FqsMgLaxHsmwnb1Dkzu3cHM9ln2az2Xietk4zESZiTEyTtaajBE=@vger.kernel.org X-Gm-Message-State: AOJu0YwHPZE/0uT3yOkBuhjrE0hI2PsSrLXPWbfWZoAMVQKagTFoCg0h G7Tr5u/DOr7A7MvIXBSI1oN6jm0Rl1u7Sm00cy/vpn6vJLOUi4iDDeNNuTdLgtVBGIU= X-Gm-Gg: ASbGncswADHLlPB/gQKU+P6VH2dApceEw0Up01yJr2lYXlpq7Ou0RbZs6uy2AM5w8aP fCbjcwzSO8m1y6je3+CwleSclsW6tuL/U9k9ejh9VzTWYXM8BNmPJ7p9pIxCHOb4M1n9qISU4bj yz2hcQ2wurzI7xcJAmI1cYuOa6+PallpexK/cPuF+u9Af/4viZJ0tYiQ5f02fkWXCaRLKO0Rnl1 yQpsmOwRWBuc4aV/BBYRS4YOxbkvtsSqiqj/VNNy3Le7pgP1yEDhQLgAjgV+NEGuo/xwKXRTfrv TUjpGuK6Y9tA49xr+8WT34PERiMvJq0bvmOJx3dcFVPqLGUz016P32KrJnlJkc3UE4B3sxCmXwt WvqvUZBNjcm3wfglCJ6B0hZ2RZI6RZuZ8Xz5SfGWxoX/09c/yuPmr+G8aTcA3QVfxfx7kFWj0wb PHoU0H1MqDmTjVG+jxKUVmKoldOtBQ7g== X-Google-Smtp-Source: AGHT+IEITz2BTVLYYbRegTBFRIeCOG40K9cpljUqZ4AWg5n55qXnDrUrMakteG+U0d0IcxvPwua9Vw== X-Received: by 2002:a05:6000:18a9:b0:42b:3e60:18e9 with SMTP id ffacd0b85a97d-42cc1ab8bf8mr37104043f8f.10.1764580393051; Mon, 01 Dec 2025 01:13:13 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:77d1:da59:4ce1:741c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1caa767dsm25344110f8f.38.2025.12.01.01.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 01:13:11 -0800 (PST) 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, vschneid@redhat.com, linux-kernel@vger.kernel.org, pierre.gondois@arm.com, kprateek.nayak@amd.com Cc: qyousef@layalina.io, hongyan.xia2@arm.com, christian.loehle@arm.com, luis.machado@arm.com, Vincent Guittot Subject: [PATCH 1/6 v7] sched/fair: Filter false overloaded_group case for EAS Date: Mon, 1 Dec 2025 10:13:03 +0100 Message-ID: <20251201091308.761711-2-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251201091308.761711-1-vincent.guittot@linaro.org> References: <20251201091308.761711-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With EAS, a group should be set overloaded if at least 1 CPU in the group is overutilized but it can happen that a CPU is fully utilized by tasks because of clamping the compute capacity of the CPU. In such case, the CPU is not overutilized and as a result should not be set overloaded as well. group_overloaded being a higher priority than group_misfit, such group can be selected as the busiest group instead of a group with a mistfit task and prevents load_balance to select the CPU with the misfit task to pull the latter on a fitting CPU. Signed-off-by: Vincent Guittot Tested-by: Pierre Gondois --- kernel/sched/fair.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1855975b8248..b10f04715251 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9987,6 +9987,7 @@ struct sg_lb_stats { unsigned int group_asym_packing; /* Tasks should be moved to preferred CP= U */ unsigned int group_smt_balance; /* Task on busy SMT be moved */ unsigned long group_misfit_task_load; /* A CPU has a task too big for its= capacity */ + unsigned int group_overutilized; /* At least one CPU is overutilized in t= he group */ #ifdef CONFIG_NUMA_BALANCING unsigned int nr_numa_running; unsigned int nr_preferred_running; @@ -10219,6 +10220,13 @@ group_has_capacity(unsigned int imbalance_pct, str= uct sg_lb_stats *sgs) static inline bool group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) { + /* + * With EAS and uclamp, 1 CPU in the group must be overutilized to + * consider the group overloaded. + */ + if (sched_energy_enabled() && !sgs->group_overutilized) + return false; + if (sgs->sum_nr_running <=3D sgs->group_weight) return false; =20 @@ -10402,14 +10410,12 @@ sched_reduced_capacity(struct rq *rq, struct sche= d_domain *sd) * @group: sched_group whose statistics are to be updated. * @sgs: variable to hold the statistics for this group. * @sg_overloaded: sched_group is overloaded - * @sg_overutilized: sched_group is overutilized */ static inline void update_sg_lb_stats(struct lb_env *env, struct sd_lb_stats *sds, struct sched_group *group, struct sg_lb_stats *sgs, - bool *sg_overloaded, - bool *sg_overutilized) + bool *sg_overloaded) { int i, nr_running, local_group, sd_flags =3D env->sd->flags; bool balancing_at_rd =3D !env->sd->parent; @@ -10431,7 +10437,7 @@ static inline void update_sg_lb_stats(struct lb_env= *env, sgs->sum_nr_running +=3D nr_running; =20 if (cpu_overutilized(i)) - *sg_overutilized =3D 1; + sgs->group_overutilized =3D 1; =20 /* * No need to call idle_cpu() if nr_running is not 0 @@ -11103,13 +11109,15 @@ static inline void update_sd_lb_stats(struct lb_e= nv *env, struct sd_lb_stats *sd update_group_capacity(env->sd, env->dst_cpu); } =20 - update_sg_lb_stats(env, sds, sg, sgs, &sg_overloaded, &sg_overutilized); + update_sg_lb_stats(env, sds, sg, sgs, &sg_overloaded); =20 if (!local_group && update_sd_pick_busiest(env, sds, sg, sgs)) { sds->busiest =3D sg; sds->busiest_stat =3D *sgs; } =20 + sg_overutilized |=3D sgs->group_overutilized; + /* Now, start updating sd_lb_stats */ sds->total_load +=3D sgs->group_load; sds->total_capacity +=3D sgs->group_capacity; --=20 2.43.0