From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 2D39017993 for ; Fri, 6 Feb 2026 18:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770401013; cv=none; b=h1vqkeWmTKHmTljnZjr62a0DyOKyHWG7rnXEeu6+LofBd2YSefN44Bp/+LK8sNnMZFrAJTrtDxzC1tgZZJAm3+JE5QHbRXO520ZZWKkdrgEzI6m6v0ZM7lBo3uC7u1L1f1+xexIfX/11L1jRXHx1/eyXib9xVq5c3FnD/mvRIvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770401013; c=relaxed/simple; bh=E4YRbiHZoEBW0uHJrBnJKhEi2YM+paMfuLRZ0ldoaa8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CBGcAeHUfqRyLBnEiH5Tcf0ohlythgxX5MsAeoCBvIkhZNL0C/Gz5IerKM7ap4HwwyYfM4EF1lRHkoQmZ4z+K/Rbc2Z/U5RVRYxVw7iND/apEzv8/ll+ByVITOQqTYwoknepxVA+t5mqTygGluewNVqxvmFvLK6mMvsSlrWrD+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io; spf=pass smtp.mailfrom=layalina.io; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b=s6aCSPRB; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="s6aCSPRB" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-b884a84e622so422954566b.1 for ; Fri, 06 Feb 2026 10:03:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1770401011; x=1771005811; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pCVDLa8oL4KULspXLRQQSrbd7w8tpraR6uPi+J/uskI=; b=s6aCSPRBxjCqZoBWpyXWIgXbodT7hqT7mNXMIVI0fbeWdGrhZvRNgHbqdHQLoHv+k6 R0YefYgSpCOVghund+O0MTP+WdZVsiJfKuZdtse/3/wVYZ7uw0hk6iIiKxc3wxBd65m1 x53EWRRhcjLZKhvhAMu8xRt2zvTECNJ2ltF1Fp+0/Gq+dsYBgP9d+Sr65+cjQDPC6+16 Tng9qZwM34MmtUvL2ub0DR5OisxKwN9CXi6+yDzUa5GskcW9nzg5ELcjH4PDJhfkJ3Xx G1lcgteJR9s1/5BWLvauPNw1CT/np4c3LEHt2EKUp00gLb6UgCjTqGBwdq5rLtzHjsqQ SZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770401011; x=1771005811; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pCVDLa8oL4KULspXLRQQSrbd7w8tpraR6uPi+J/uskI=; b=CKcQabaRtERXAeYIeBA5R1+LWcRg1jZT/oK1PBO1Sp/KEslOU2WnA2cpzQZpS/hT7S GAZMRsSEGoMs7V48ZyKkwMyRrVphpzKcFlDv2hm0Vzfdi09YueyG22lCbtjIqTQgLZv7 2j2C8VjcbimVw3JLv4AFNwbJT6BM4YWFu/6HCNkWl/44bFg//RuiJpZQlmxOw+MMfUf/ qxcyyQgVquCU9NcLsUmCnWFPIs8U0mnIxkcX+Og7hV7ktMhNh9usO7bbjm/KIBOnlQVl 89/h/S71PwzxzYSgWh5YslenDBaDzKwfzHDvcFy4xo/I7iG2kRfmE3oW5bLEiVbnBCyJ Dl2w== X-Forwarded-Encrypted: i=1; AJvYcCVKEwNTj5NwdELUXJimElZIaq9M1/eA5HB/TLQ1KPyFtUI1LTME0Db6aAfUMZSKJEzkFmwuabRIRlcAXU4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5dqgKmizBi1VI6dSuRY5gZdi9b16D3I4jOJDL9EJBdy1Si5R/ g1Dkf8wsJfv11D4YnTCUohJshSLsGWnrL5icASjuiTkII7cusUu5q6DqTmO3AcTb01s= X-Gm-Gg: AZuq6aKmzRtIqBoJcfXR4fFjw/GAczqgAisTGnscygLiJvXHQEE5UZjWC+M3I4M/2+I sRBFAVCGPJeGpHQi8WqxaOYGcCNYfEInd+zCc66und7v4xcBo5J31S4mZXb24mYiIgBDPwoFbJT /6kYyo5iPCiSXCtc3mtf94NSx4bNStMw3o8vDiNOcE1NKmPk0WqZZ50UDindW/Gmp/XuayHpq+9 Q+jTqNrVDzQScEWIefmUpNXITFxz7jcUBiE6KnW3FIFiDN/Tg+GD/YCPlu2aZ25xqhXsakmDLgH xc30BL69bl2AjPQBrQcZDDpmEebVwzC4SgUHhdvtFzJxpcziUPXgTs0cxk6TjdbLZD8hcac69eV 0wfjYNwUFDjFYpxmvbouS2d+LROAyZ8UD0VGgpnvl5DQCaRv9Kpl/piSQKNm+7mpRQSMD7VMF7U iaoatHapXositDE6wZ4pGCyWfR6K0gJEZ+syZaJoeb5wQmIy8lWGwGtHOOVZOmg1I= X-Received: by 2002:a17:906:dc95:b0:b84:1fc7:944f with SMTP id a640c23a62f3a-b8edf35046fmr213593766b.45.1770401011346; Fri, 06 Feb 2026 10:03:31 -0800 (PST) Received: from airbuntu (host109-153-232-30.range109-153.btcentralplus.com. [109.153.232.30]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8eda7dd3acsm101705566b.28.2026.02.06.10.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 10:03:31 -0800 (PST) Date: Fri, 6 Feb 2026 18:03:29 +0000 From: Qais Yousef To: Vincent Guittot Cc: 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, hongyan.xia2@arm.com, christian.loehle@arm.com, luis.machado@arm.com Subject: Re: [PATCH 3/6 v8] sched/fair: Prepare select_task_rq_fair() to be called for new cases Message-ID: <20260206180329.w4eduxwprf5etgs6@airbuntu> References: <20251202181242.1536213-1-vincent.guittot@linaro.org> <20251202181242.1536213-4-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-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20251202181242.1536213-4-vincent.guittot@linaro.org> On 12/02/25 19:12, Vincent Guittot wrote: > 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. I'd add we have a fallback mechanism when moving between cpusets causes to pick a random cpu. We have been carrying out of tree hack in Android for a while to make this use the wake up path. Especially on HMP system, a random cpu could mean bad placement decision as not all cores are equal. And it seems server market is catching up with quirky caching systems. > > Signed-off-by: Vincent Guittot Reviewed-by: Qais Yousef > --- > 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 = (wake_flags & WF_SYNC) && !(current->flags & PF_EXITING); > + int want_sibling = !(wake_flags & (WF_EXEC | WF_FORK)); > struct sched_domain *tmp, *sd = NULL; > int cpu = smp_processor_id(); > int new_cpu = 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; > + } > > - if (!is_rd_overutilized(this_rq()->rd)) { > - new_cpu = find_energy_efficient_cpu(p, prev_cpu); > - if (new_cpu >= 0) > - return new_cpu; > - new_cpu = 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 = find_energy_efficient_cpu(p, prev_cpu); > + if (new_cpu >= 0) > + return new_cpu; > + new_cpu = prev_cpu; > + } > > + if (wake_flags & WF_TTWU) > want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr); > - } > > rcu_read_lock(); > for_each_domain(cpu, tmp) { > @@ -8575,7 +8581,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > if (unlikely(sd)) { > /* Slow path */ > new_cpu = 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 = select_idle_sibling(p, prev_cpu, new_cpu); > } > -- > 2.43.0 >