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 CA287346FCA for ; Fri, 20 Feb 2026 13:43:44 +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=1771595027; cv=none; b=W19lO6R6N4RCaRrBrg4mJ0nfojil1iedXYjgDqNfxyDQa11Ca6CRzH8leWOpCH2cfa76rNQUzBewTaWHUNL24v8R1xk34Av++W1hBvbxIQiipju2Oynaw3CFZiX9O5NiZMLLPKmb9vS6iyhNDxveIyRudC45r+hPaX+ysW42ReU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771595027; c=relaxed/simple; bh=1fdX7RNzATShZYtgBLgYxfukATctH8w6czZxtySOesg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SeNbkVnYv32kfA+T4kgvq8/RgIWfugz81M8bHW9hEbKmFqO3Wj5nom/XSOuLjxwoKoj0iGvHptxuj+MTt5MoBQlOw0Qkn9oxNRrPHku0TTf+qGfieqhJv5mBcG65dhJsUjeE+66UKIPDzrdkERVT/BjHZt3DYd9iCa9DlH7D4G4= 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=f4g6J47d; 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="f4g6J47d" 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=J4A7HXSvr/xWekAMwnLtB/mYdZV6MeLRRIr3VXxPQus=; b=f4g6J47d95InvG/Mg88kBON6ci S8XL4B8KcSXzry4xvQZC9MEH2jRVnPmL3tlvgj6MrE/oo9dt/KLBxIa58OIy3KbRrsjG2A6m/kSRz ksyHAXge3KfYOsMT445Ag7kFFZFqnOzJ8oS2wUS43rm85VFcujOHbnoAuAzdXKq2eun7IrBRdVndp 3P5zyWzkBuQc2G7ZhzcIcJZyDraXhu/hdEHBr8/Z1WmjCcC0hUMlgxb6otPSjekz6oFPD/3hfNLie JKiSnw3x7ziYqJ40iRoCLZJaeFo16YpZy6LF2W5e7qOyO+RdtA2D76N7KwLkQG6ZOvfikSTngye1y gKQsdeDg==; 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 1vtQmi-00000002drC-3GiS; Fri, 20 Feb 2026 13:43:09 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2D68A301BD5; Fri, 20 Feb 2026 14:43:02 +0100 (CET) Date: Fri, 20 Feb 2026 14:43:02 +0100 From: Peter Zijlstra To: Tim Chen Cc: 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 , Chen Yu , Adam Li , Aaron Lu , Tim Chen , Josh Don , Gavin Guo , Qais Yousef , Libo Chen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 09/21] sched/cache: Count tasks prefering destination LLC in a sched group Message-ID: <20260220134302.GS1395416@noisy.programming.kicks-ass.net> References: <20260220125248.GQ1395266@noisy.programming.kicks-ass.net> 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: <20260220125248.GQ1395266@noisy.programming.kicks-ass.net> On Fri, Feb 20, 2026 at 01:52:48PM +0100, Peter Zijlstra wrote: > On Tue, Feb 10, 2026 at 02:18:49PM -0800, Tim Chen wrote: > > > @@ -11034,6 +11037,9 @@ static inline void update_sg_lb_stats(struct lb_env *env, > > { > > int i, nr_running, local_group, sd_flags = env->sd->flags; > > bool balancing_at_rd = !env->sd->parent; > > +#ifdef CONFIG_SCHED_CACHE > > + int dst_llc = llc_id(env->dst_cpu); > > +#endif > > > > memset(sgs, 0, sizeof(*sgs)); > > > > @@ -11054,6 +11060,15 @@ static inline void update_sg_lb_stats(struct lb_env *env, > > if (cpu_overutilized(i)) > > *sg_overutilized = 1; > > > > +#ifdef CONFIG_SCHED_CACHE > > + if (sched_cache_enabled() && llc_id(i) != dst_llc) { > > If you write that like: > > if (sched_cache_enabled && llc_id(i) != llc_id(env->dst_cpu)) > > You can get rid of that dst_llc variable, but more importantly its > ifdeffery. Ah, you're perhaps wanting to not re-load on the dst_llc usage below? Do the compilers DTRT when you mark llc_id() as __pure? > > + struct sched_domain *sd_tmp = rcu_dereference(rq->sd); > > + > > + if (valid_llc_buf(sd_tmp, dst_llc)) > > + sgs->nr_pref_dst_llc += sd_tmp->pf[dst_llc]; > > + } > > +#endif > >