From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1629EEBA for ; Wed, 10 Dec 2025 15:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765379818; cv=none; b=NcSlelAMs4ZQKFkKh89VOSHpyVchZ+G9JbW5IAAb16f0hiAMw2t7SFden3lGipsgXzfKE2ePSuQ7Gne2/i8xUcsbEBEMtjva06199/KKq/vI3qxZyy4z0K9/PjO6XlJ0qBvihiIKc+Vyvsw88KR+Y8YPrsyFBbp7vhLKkj7+/vQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765379818; c=relaxed/simple; bh=Apjx8BWWRt01vyMgB5cuKWQG4zwdbarlBBjSSOhhQ74=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XzGkhygiai5Ou9KgOyA83zg69na30ChUW+YtregNQDKnefsjeRnr3+lfLKRsFHuM/SgUfjLDRycbP/iDSU85wdIW+BYR0Cz2YoOmKDsuQ26XOs13CNxhwZmAPAryf+DU6GLbl/um5sxdujXicGzURx/0qwBS/g0iUNYpQp3w4fw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=WFTpjZL7; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WFTpjZL7" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZOCk8tp5Pw8Pj2c7Yz2tmGbqMkR6c6uh6RG6/QBx23U=; b=WFTpjZL7cO7aWOpoWUzhoKv5oF 1BTf/JqF6tkZ0/ndpVBUBHe+dDgoa4B4viJNK//Q6WhCXBszjoJ94YEQhIL4oYxB6NATUiu81hw0y 0gYl1hLlMXWy6MWxoTciLgkvFRRp/tWka5W/6o50EB6WVO9xkbhqui/8ueMg5cLbcyYIpPSscPXMO DIQ09dmBfORbsfvWQepLkfblvFI+9p8xNKzyNZKRhzbsi50ogjKwHkGSCNFgDTL9wPmJ4HCQken9m RYw2+hPxscjhH60k6MDx7ynuJjGH3h27QnPsNWhoDs7LE/te22oAEsMJQ1naZ5qVhYd1W2Mmdp/6T NVfvEuAA==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vTL3w-0000000DUDL-319U; Wed, 10 Dec 2025 14:21:04 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BE258302EC2; Wed, 10 Dec 2025 16:16:21 +0100 (CET) Date: Wed, 10 Dec 2025 16:16:21 +0100 From: Peter Zijlstra To: "Chen, Yu C" Cc: Tim Chen , Ingo Molnar , K Prateek Nayak , "Gautham R . Shenoy" , Vincent Guittot , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , Hillf Danton , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , Vern Hao , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 09/23] sched/cache: Count tasks prefering destination LLC in a sched group Message-ID: <20251210151621.GM3707837@noisy.programming.kicks-ass.net> References: <1eb6a231ec82b37483208983f0cf10eec823ec9d.1764801860.git.tim.c.chen@linux.intel.com> <20251210125233.GT3707891@noisy.programming.kicks-ass.net> <5613f6eb-7319-464e-9723-2d82ddaca0c9@intel.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <5613f6eb-7319-464e-9723-2d82ddaca0c9@intel.com> On Wed, Dec 10, 2025 at 11:05:33PM +0900, Chen, Yu C wrote: > On 12/10/2025 9:52 PM, Peter Zijlstra wrote: > > On Wed, Dec 03, 2025 at 03:07:28PM -0800, Tim Chen wrote: > > > During LLC load balancing, tabulate the number of tasks on each runqueue > > > that prefer the LLC contains the env->dst_cpu in a sched group. > > > > > > For example, consider a system with 4 LLC sched groups (LLC0 to LLC3) > > > balancing towards LLC3. LLC0 has 3 tasks preferring LLC3, LLC1 has > > > 2, and LLC2 has 1. LLC0, having the most tasks preferring LLC3, is > > > selected as the busiest source to pick tasks from. > > > > > > Within a source LLC, the total number of tasks preferring a destination > > > LLC is computed by summing counts across all CPUs in that LLC. For > > > instance, if LLC0 has CPU0 with 2 tasks and CPU1 with 1 task preferring > > > LLC3, the total for LLC0 is 3. > > > > > > These statistics allow the load balancer to choose tasks from source > > > sched groups that best match their preferred LLCs. > > > > > > Signed-off-by: Tim Chen > > > --- > > > > > > Notes: > > > v1->v2: > > > Convert nr_pref_llc array in sg_lb_stats to a single > > > variable as only the dst LLC stat is needed. > > > (K Prateek Nayak) > > > > > > kernel/sched/fair.c | 12 ++++++++++++ > > > 1 file changed, 12 insertions(+) > > > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > > index b0e87616e377..4d7803f69a74 100644 > > > --- a/kernel/sched/fair.c > > > +++ b/kernel/sched/fair.c > > > @@ -10445,6 +10445,9 @@ struct sg_lb_stats { > > > unsigned int nr_numa_running; > > > unsigned int nr_preferred_running; > > > #endif > > > +#ifdef CONFIG_SCHED_CACHE > > > + unsigned int nr_pref_llc; > > > +#endif > > > > At this point I have to note that rq->nr_pref_llc seems like a horrible > > misnomer, for it being an array, and not an actual number like the > > naming suggests. > > In the v2 it seems that rq->nr_pref_llc is not an array anymore, it >From two patches ago: + unsigned int *nr_pref_llc; Its a pointer of some sort. > indicates > the number of tasks that want to be migrated to the env->dst_cpu (dst_llc), > because > these tasks' preferred LLC are env->dst_cpu(dst_llc). Maybe renaming it to > rq->nr_pref_dst_llc? Like I said in: https://lkml.kernel.org/r/20251210125114.GS3707891@noisy.programming.kicks-ass.net it might make sense to put it in struct sched_domain instead of struct rq, since then you can allocate and swap it right along with the rest of the domain tree.