From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 BA0022BF00A for ; Fri, 20 Feb 2026 18:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771611726; cv=none; b=N5fB+i16RBmW4gW3be3ybFRxbmcm6C3GFc9eYFjR8edDsUnHZFNqyBJbkPeIT5wIJBCdhCXP/uwEMeNW8VfjIwhhjdSfnkmamX89yvZTbfjAEbw3Y39JnM+kXNDah/JQuMD3Y1QiEEJUwaBBZ6MOyhHhN/xkvk+OSMleeeSDAwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771611726; c=relaxed/simple; bh=32+gzzVq2g0V9yMsJGoIFetl96p2iFPF+z4cv/3tEvw=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=l9YhNeX2JpZYg8rSWzUGss+PCYzQ0oi+9Aqvj3++ty8ouPcTyy7u0pLrp+TJ2ByRYeWLG6j6MDWMLYFbbhPNyzJUMsCiC1N1DqMew1f0TL2mkwv1/HLEB5lHQxEnFaMRoAPretxKw8I+M/a8diHhLJCLPkhPad4TnFOlxkmJSyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UD9OEFF0; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UD9OEFF0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771611726; x=1803147726; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=32+gzzVq2g0V9yMsJGoIFetl96p2iFPF+z4cv/3tEvw=; b=UD9OEFF0kp2WUHNlNk6M1LsLGQeczVr3U7HTigOPHvZrptyAsHoK7vAl RkAgernNV+V7gkVutbEAiHE2M6IYi2ljaEOJBVXqvV2T3C2o0422zYOmV CYjOlXwci07wUAWg+I8d1HH9uiBgAsJXRBYAh+EC53kLobzDbkiZJLd25 C/N2AMk+RYKtIQ9IrtLjNhsQ0iaMMNwd2SaTsFNKrdmsu8WgwgJgRlvJ0 0WW8b3VFXgYpsxaa+sbo7RiZsPwf5DE0bJdTH2snsqzPZ4q3N9SQCBOuF Q1/7SYpT6Gko3nb/LdxfFfz1voVBguE/5dOdUZ7pAu1O7sH1RRrDLK4ma A==; X-CSE-ConnectionGUID: d5nXRiL1S/Wl6B0sdG+j5Q== X-CSE-MsgGUID: ai/UzuNWQ1aER2rYWsdlyg== X-IronPort-AV: E=McAfee;i="6800,10657,11707"; a="76572334" X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="76572334" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 10:22:05 -0800 X-CSE-ConnectionGUID: QVwolcWDQiqT6R7+U2yBcQ== X-CSE-MsgGUID: ao1POJbSQBqD2ygs827W5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="214920658" Received: from spandruv-mobl5.amr.corp.intel.com (HELO [10.125.110.105]) ([10.125.110.105]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 10:22:05 -0800 Message-ID: Subject: Re: [PATCH v3 13/21] sched/cache: Handle moving single tasks to/from their preferred LLC From: Tim Chen To: Peter Zijlstra 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 Date: Fri, 20 Feb 2026 10:22:04 -0800 In-Reply-To: <20260220135301.GR1395266@noisy.programming.kicks-ass.net> References: <92fa33fc26f069d8044bac3b0efc3598f53131de.1770760558.git.tim.c.chen@linux.intel.com> <20260220135301.GR1395266@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-02-20 at 14:53 +0100, Peter Zijlstra wrote: > 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. >=20 > I'm thinking this wants more explanation; yes it might break locality, > but why is that bad? That's to prevent regular load balance from migrating a task that prefers the current LLC, but the load level and imbalance doesn't warrant breaking LLC preference per can_migrate_llc() policy. Okay, will add more comments. Tim >=20 > This way you're inhibiting a full LLC from being able to power down. >=20 > > +/* > > + * 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 =3D=3D env->src_rq->cfs.h_nr_run= nable) { > > + unsigned long util =3D 0; > > + struct task_struct *cur; > > + > > + if (env->src_rq->nr_running <=3D 1) > > + return true; > > + > > + /* > > + * Reach here in load balance with > > + * rcu_read_lock() protected. > > + */ >=20 > Not sure that comment helps much. rcu_dereference() itself will already > cause complaints if the constraints are violated. Okay, will remove this. >=20 > > + cur =3D rcu_dereference(env->src_rq->curr); > > + if (cur) > > + util =3D task_util(cur); > > + > > + if (can_migrate_llc(env->src_cpu, env->dst_cpu, > > + util, false) =3D=3D mig_forbid) > > + return true; > > + } > > + > > + return false; > > +} >=20 >=20