From nobody Mon Dec 1 22:06:00 2025 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 D4E262FFF9D for ; Mon, 1 Dec 2025 09:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764580399; cv=none; b=Vln1vMixEG97dXQNKVkxzYwr0ta1f4bEQXgbM8U0qdE8CAkJQescqGU/Xo9vFenU5V5DAPQ8/9fTmXmbdX78g8KAXiplRPiFBiMK/cRg93dRg8q/VMW9KaGEYPhrEHIQgqIv3EKKY01toYCgxurDHrjIecEOBzYNHtVSSHtDf5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764580399; c=relaxed/simple; bh=FTHun3PMOq+CklxsBPL6XoRjxH2p1DjEDgtWxflTW+A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LMxr+/OeFBnpaw7R7iFDcR0PKjGlcR/Yz7/jNmerIz+kR1qRf9Ox02oVPpl864Z9ioJczBxhEhDrRt5v+eckTfLslePBZpm8C+OAGqmY+aRC01ADzIM2xB5eTswcN4OPUqYXoFdiROT0hIDPueoSi0H/Ptm+SpG3Wad4Jw4oJfY= 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=Ppreef/i; arc=none smtp.client-ip=209.85.221.43 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="Ppreef/i" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-42e2e52cc04so373531f8f.0 for ; Mon, 01 Dec 2025 01:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764580396; x=1765185196; 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=95eiwIqVqnWVfXykfzvRd1ip/6pVXilQ5gdb8x62/lM=; b=Ppreef/ilPsI2Kk34engXQoV6y37W9iatFh1X+dDIwwmtf0iUNTzfjXfOuc7X+B4F+ 67J2Rp7sckmVQCp1YEcGypFYpKrGze1mZyWDO00gEEGOW1PbXgSdsAmckhaxcNZAzsau X4cRHB6sh3aVzR6XreT6oj+3pEJcCJyQ3YMtBzJBJAjZd/+JjYLYbw8iKcBD3HTpdwNI jXXBCnEnIhwjSrL2Rf7QvQXzlyst0cZ4gM2c3nbKgSyjq/tluBRWlCZNVr5n7mYMXRt2 mL/mMCyr9yBvOsDiig4jPwM9DiVweUNVcU8Vu3jU+AjpvWxBIjY2ili6UztGaWkvzcyX 0PuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764580396; x=1765185196; 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=95eiwIqVqnWVfXykfzvRd1ip/6pVXilQ5gdb8x62/lM=; b=Q5XtKSVfxCAIyqysvAoci23mgQlE7S6zhqZOWoNVaybEWp9MKu7Jn9/s5P7Rc1cqwG FnpVveqJ/JcKVekKikXa2ZjaX/8mcEZ1X5VFTbgDQP4fjQ9xpwN9hv3DPKz/kxKfIhM0 kaFoeY+WNUCf4ONApusH9TYGZxENVRmSlSmYNIj0dH0mln/9DTK5F/U6w6YzmG7V94oT klUVF4Zq3xwuRMcOymMa+wgj4XtLiuuGxsh7bnWhiQ0rmDZ7zWHRUYxluRirMPk0zg3i j7qA5rWpBSN/+lPdsUhC7TKnZXClWqRbWG3vFLWFu0cK9KzPbPJ3iH3keSsaBrfCnas1 XG7w== X-Forwarded-Encrypted: i=1; AJvYcCX2AdbN20qDsIq+n7FxXNHlAEf1QerEXIkJZhZLEwoS1F3VMO+i6Je4j/nNGm7vhSDpaJcU+z4I/ATPq4c=@vger.kernel.org X-Gm-Message-State: AOJu0YwvfjWb0UMwg0GhVY3xmm65WF4KmhholdJnOLSpasBg/C+q9Z0W lmCrKkpcDFyvH1H/ZkegGIfQtb6ki0a5tEunlqxa+7qdCMMTwKrJg96JnDIuZczihjQ= X-Gm-Gg: ASbGncvLQH2e1rU/8TnKqhgDbhZYfwCX3T8j/BEYImuMYUI55PFxNn8ppMWttHWtBnD ac8ktYxmCR04O3/kJMt46QOqGjKzS4CYM7gmRg1oBDbg5eUGAhD6DhXBDRwF1niqBO7kpvgP/Th RIx3gb86oUQA3eDB7xWAo70rUv4YlbKKoIfoL8bXdxNXI0X3NhFzny5H5Q5SjpkA38TtNzsE8BN bBvsIGC3SvtdOMvp3DfX4BnyijJjaPnP1lPvKy/RWKxz5L/Vx4BTzMHtUgNvP+ryyD7q7lgMIEq Q+JImkhP1F0ZEIXiXu6FwTRB00Yf6wqEF2QF6r6+5aL6rdfgcm4ukO3YZ2jfxNQQI47bcVRwKwE WMILJEvdaW6dG+lvnLiYDUuNTNVMFvu7WoVyDzKv0D1GXZQ7KOSfPESU97uHHbGD01PAoe5+Z/q bcvClm1NPqaE2Dm51n1XcdXtGX64Ip4Q== X-Google-Smtp-Source: AGHT+IEXL0FW4FA4PxEHTN9REcRL69V6HM5QKNK233vETcLtWanPetqEVi1wgeCdVoKDJu7B6akfxQ== X-Received: by 2002:a5d:588c:0:b0:429:f14a:9807 with SMTP id ffacd0b85a97d-42e0f34fadbmr26712550f8f.40.1764580395918; Mon, 01 Dec 2025 01:13:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 01:13:14 -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 3/6 v7] sched/fair: Prepare select_task_rq_fair() to be called for new cases Date: Mon, 1 Dec 2025 10:13:05 +0100 Message-ID: <20251201091308.761711-4-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" Update select_task_rq_fair() to be called out of the 3 current cases which are : - wake up - exec - fork We wants to select a rq in some new cases like pushing a runnable task on a better CPU than the local one. In such case, it's not a wakeup , nor an exec nor a fork. We make sure to not distrub these cases but still go through EAS and fast-path. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f430ec890b72..80c4131fb35b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8518,6 +8518,7 @@ static int select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) { int sync =3D (wake_flags & WF_SYNC) && !(current->flags & PF_EXITING); + int want_sibling =3D !(wake_flags & (WF_EXEC | WF_FORK)); struct sched_domain *tmp, *sd =3D NULL; int cpu =3D smp_processor_id(); int new_cpu =3D prev_cpu; @@ -8535,16 +8536,21 @@ select_task_rq_fair(struct task_struct *p, int prev= _cpu, int wake_flags) if ((wake_flags & WF_CURRENT_CPU) && cpumask_test_cpu(cpu, p->cpus_ptr)) return cpu; + } =20 - if (!is_rd_overutilized(this_rq()->rd)) { - new_cpu =3D find_energy_efficient_cpu(p, prev_cpu); - if (new_cpu >=3D 0) - return new_cpu; - new_cpu =3D prev_cpu; - } + /* + * We don't want EAS to be called for exec or fork but it should be + * called for any other case such as wake up or push callback. + */ + if (!is_rd_overutilized(this_rq()->rd) && want_sibling) { + new_cpu =3D find_energy_efficient_cpu(p, prev_cpu); + if (new_cpu >=3D 0) + return new_cpu; + new_cpu =3D prev_cpu; + } =20 + if (wake_flags & WF_TTWU) want_affine =3D !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr); - } =20 rcu_read_lock(); for_each_domain(cpu, tmp) { @@ -8575,7 +8581,7 @@ select_task_rq_fair(struct task_struct *p, int prev_c= pu, int wake_flags) if (unlikely(sd)) { /* Slow path */ new_cpu =3D sched_balance_find_dst_cpu(sd, p, cpu, prev_cpu, sd_flag); - } else if (wake_flags & WF_TTWU) { /* XXX always ? */ + } else if (want_sibling) { /* Fast path */ new_cpu =3D select_idle_sibling(p, prev_cpu, new_cpu); } --=20 2.43.0