From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 8D4B034A795 for ; Fri, 20 Feb 2026 13:53:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771595620; cv=none; b=WVS7BFUqhr5jIWnFUKK17fJGq3BWnF5uH5MLpT2wN5OA0hJPUtedRQhWRTK7Yc82GU9//izG/GZxcp4MkFIu4CBkirmI+HN8NUc1oKU9aABdYzmAbgYMxBoddgL/l2OpJ44PTmC/Vb5ZNd1HyIavz/Pw+bbhF40HOJSiAdptVB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771595620; c=relaxed/simple; bh=E2pADF0iRA7yjoNjpkQ8JnI4tFNi6xjqlqvW4YUMvwI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oM4FexbNANnqPfQzLz5qw4NKwGnrn/wN1twkTM+QEB3JPp/yOaASReFNHqx+vTcVV/vjnald67an+orBHt+1+MtTVctuHa8GuGf7TRCRalP5hVXRhqAo/fQ1jE9e9kibq8f5gYr3lhioPOJlxmpiXMsZn7mToBFoYlDeQiQdlN4= 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=mnSjdt7t; arc=none smtp.client-ip=90.155.50.34 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="mnSjdt7t" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=Ni5QUNfy0WC+0C9b3lzGwCo8LP9Q12dakS/MG4RmN74=; b=mnSjdt7tPD354hFi0B23pwxO13 j01oxxqPorM3cYCpF7HP3CeMmEUJZ5S4xT7y9knxLa7442LtcfDjx8raWkI5MD5Xq0ZLiy/dnE51W Mfpq8ZgpZFbXvj/w85PSqbftYeyMOpEeYXvrPjhHE7nO/IQGLxVxUtZlnN6irtfLqwWqXrCChGr0x agMeMXHTbP6cf5I9yfcfE+VFC8SpDuTAvpFxDOu0Tq/Zv9eoIe0UjfzK5BonhFYH+QnGQRf2NpIMt 5bQpx3C6o0GXFqIihGYwQdtyfiHCbkCdXU7kg/IiRjMb6jvL5UDNlfw5JZG2+mYNBTzfZW9kvLtiV 4Jurm2dA==; 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 casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vtQwI-00000009ZuD-051w; Fri, 20 Feb 2026 13:53:02 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 0C386301BD5; Fri, 20 Feb 2026 14:53:01 +0100 (CET) Date: Fri, 20 Feb 2026 14:53:01 +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 13/21] sched/cache: Handle moving single tasks to/from their preferred LLC Message-ID: <20260220135301.GR1395266@noisy.programming.kicks-ass.net> References: <92fa33fc26f069d8044bac3b0efc3598f53131de.1770760558.git.tim.c.chen@linux.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: <92fa33fc26f069d8044bac3b0efc3598f53131de.1770760558.git.tim.c.chen@linux.intel.com> On Tue, Feb 10, 2026 at 02:18:53PM -0800, Tim Chen wrote: > In the generic load balance(non-cache-aware-load-balance), > if the busiest runqueue has only one task, active balancing may be > invoked to move it. However, this migration might break LLC locality. I'm thinking this wants more explanation; yes it might break locality, but why is that bad? This way you're inhibiting a full LLC from being able to power down. > +/* > + * Check if active load balance breaks LLC locality in > + * terms of cache aware load balance. > + */ > +static inline bool > +alb_break_llc(struct lb_env *env) > +{ > + if (!sched_cache_enabled()) > + return false; > + > + if (cpus_share_cache(env->src_cpu, env->dst_cpu)) > + return false; > + /* > + * All tasks prefer to stay on their current CPU. > + * Do not pull a task from its preferred CPU if: > + * 1. It is the only task running there; OR > + * 2. Migrating it away from its preferred LLC would violate > + * the cache-aware scheduling policy. > + */ > + if (env->src_rq->nr_pref_llc_running && > + env->src_rq->nr_pref_llc_running == env->src_rq->cfs.h_nr_runnable) { > + unsigned long util = 0; > + struct task_struct *cur; > + > + if (env->src_rq->nr_running <= 1) > + return true; > + > + /* > + * Reach here in load balance with > + * rcu_read_lock() protected. > + */ Not sure that comment helps much. rcu_dereference() itself will already cause complaints if the constraints are violated. > + cur = rcu_dereference(env->src_rq->curr); > + if (cur) > + util = task_util(cur); > + > + if (can_migrate_llc(env->src_cpu, env->dst_cpu, > + util, false) == mig_forbid) > + return true; > + } > + > + return false; > +}