From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC3C1287518 for ; Mon, 8 Dec 2025 18:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765219410; cv=none; b=s47fPBrlnheyUmZCj6+bW7e2wNseoI4LyRkGUx4qm5snyMsyK+S38mhXIqYMhG4RZNS5c1yP974I2uu8dRTPNp1uCHdKLfghe1H3LeXZpwt17Np8vzqrSqhpCBR5AuFF2qXs7NYmwi1h0xIybbanzRJRc5TLB1HE/k5s+TP6wmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765219410; c=relaxed/simple; bh=6xCOJLd3rhq7m+oEK4oNw94HJWtsCd/h/ofVR/ptmBU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kw2tunBiNWulRpWfHsLP8ON7eYZ9ejZJLBxE0hr2vvL1FjqsQsaTlAdnK3+UB2Mui4LaEI7X7usqWtamTV2wtNYsT5MSebqpmk7AmPz5qB59mg/PeyS4sFcJcgE1wJxbwzZeMNYm4zqODp1iTFXgp1v5NxNL7vH6LfZgKbE6YVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 510031691; Mon, 8 Dec 2025 10:43:19 -0800 (PST) Received: from [192.168.0.16] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 800D23F740; Mon, 8 Dec 2025 10:43:23 -0800 (PST) Message-ID: <01d82628-7ae8-4e85-9e0d-e18a1c93f284@arm.com> Date: Mon, 8 Dec 2025 18:43:16 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 5/6 v8] sched/fair: Enable idle core tracking for !SMT To: Vincent Guittot , 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, luis.machado@arm.com References: <20251202181242.1536213-1-vincent.guittot@linaro.org> <20251202181242.1536213-6-vincent.guittot@linaro.org> Content-Language: en-US From: Christian Loehle In-Reply-To: <20251202181242.1536213-6-vincent.guittot@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/2/25 18:12, Vincent Guittot wrote: > Enable has_idle_cores at llc level feature for !SMT system for which > CPU equals core. > > We don't enable has_idle_core feature of select_idle_cpu to be > conservative and don't parse all CPUs of LLC. > > At now, has_idle_cores can be cleared even if a CPU is idle because of > SIS_UTIL but it looks reasonnable as the probablity to get an idle CPU is > low anyway. > > Signed-off-by: Vincent Guittot > --- > kernel/sched/fair.c | 29 +++++++---------------------- > kernel/sched/sched.h | 42 +++++++++++++++++++++++++++++------------- > 2 files changed, 36 insertions(+), 35 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 252254168c92..0c0c675f39cf 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > [snip] > @@ -7849,80 +7831,83 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) > } > > /* > * For asymmetric CPU capacity systems, our domain of interest is > * sd_asym_cpucapacity rather than sd_llc. > */ > if (sched_asym_cpucap_active()) { > sd = rcu_dereference(per_cpu(sd_asym_cpucapacity, target)); > /* > * On an asymmetric CPU capacity system where an exclusive > * cpuset defines a symmetric island (i.e. one unique > * capacity_orig value through the cpuset), the key will be set > * but the CPUs within that cpuset will not have a domain with > * SD_ASYM_CPUCAPACITY. These should follow the usual symmetric > * capacity path. > */ > if (sd) { > i = select_idle_capacity(p, sd, target); > return ((unsigned)i < nr_cpumask_bits) ? i : target; > } > } > > sd = rcu_dereference(per_cpu(sd_llc, target)); > if (!sd) > return target; > > if (sched_smt_active()) { > has_idle_core = test_idle_cores(target); > > if (!has_idle_core && cpus_share_cache(prev, target)) { > i = select_idle_smt(p, sd, prev); > if ((unsigned int)i < nr_cpumask_bits) > return i; > } > } > > i = select_idle_cpu(p, sd, has_idle_core, target); > if ((unsigned)i < nr_cpumask_bits) > return i; > > + if (!sched_smt_active()) > + set_idle_cores(target, 0); I have added some more context for the patch that makes it rather obvious that this is broken. For asym systems (and their subset EAS which this series is concerned with) the above is unreachable as either select_idle_capacity() will find a CPU or target is returned. Thus this code here is never reached and idle_cores will be set but never stopped and the push mechanism keep triggering when it shouldn't be.