From nobody Mon May 25 00:09:08 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 AC74B3E6385; Wed, 20 May 2026 08:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779266091; cv=none; b=Yhmb6LVK3YyMrwYlIn1sqk6sJZrcnRXBhgJHkYrcxkfL/8yGu1Q0hJVHxALQwxgb/jxP9Ahv51sGCeHDElDDgRAYOpDZe3UuC0anPRWN75LBFpsluwqYBj7Af1cfn2IIALz0js4DYwDu11vTeBKWj1vox749/jSKxRHwRIfBlQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779266091; c=relaxed/simple; bh=UhWeQ2S5rLjZ7wJlCnLrCU1of4zJ0FX7II+bM0mZEGY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=CaeZ8bZvejOGysYsLKLLiLK+Pk7/DzkJoDt+1coZMbblY7MvPN9JrL1VvIvIm7N4BGlvsT1hOFWSSmTMYUuWbdnRLZb2WkH9jgln0qXpkEm6rIAFICrR1LEM4g1dSx0OLnXxFMU++uRU2vYevwoY6ym40gvDSIAq7jc1VE3uqZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yCbcJzkU; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=8HdwE/Cw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yCbcJzkU"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="8HdwE/Cw" Date: Wed, 20 May 2026 08:34:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779266088; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wz4fg49HDQW0x4ewLxXLsuox6gHwZ3lHc2rEf1Jn2T0=; b=yCbcJzkUHdNdEiodu6mzDUO5a3Ic4rh99Q89soT56LzjcxSfi16shTvUMwwppawDCAs4H0 +8VAICQoVUy70fLgG0z5zJFb+HXVjc2QPgwAkcKW7joIkvaBDInms52kBjw8CUpX39/vei AJRcCMPHSZowLEQA/bP/XktqHQo7jhjQz0b0ft1+g7994JZ1VS019OeuwEgoYaZ05h9K/W O+ZOY4FwcRf5n1ngvAiSJ/dAyiRac+6Tl4uNwEFgKUVNQOw0D4POmtaTMn5/Xn8TO5TQeG 8ki7AMw+UYg2t0BkqnS2Rlvckq0vs2PMti16y+oo2odOC72j2C3aybDx9skMDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779266088; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wz4fg49HDQW0x4ewLxXLsuox6gHwZ3lHc2rEf1Jn2T0=; b=8HdwE/CwZ6KRRwPI3Xl/Z6EQW85G8ZgZjdbZA+Ei2x3RdkSxaZs0Ke3y9puAj68+Jo3YXx g/GSv7hSG/pBPZBw== From: "tip-bot2 for Tim Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/cache: Add migrate_llc_task migration type for cache-aware balancing Cc: Chen Yu , Tim Chen , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3Cb9df27c19cc5121ddb2a7d1be7f9d52fec1563dc=2E1775065?= =?utf-8?q?312=2Egit=2Etim=2Ec=2Echen=40linux=2Eintel=2Ecom=3E?= References: =?utf-8?q?=3Cb9df27c19cc5121ddb2a7d1be7f9d52fec1563dc=2E17750653?= =?utf-8?q?12=2Egit=2Etim=2Ec=2Echen=40linux=2Eintel=2Ecom=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177926608706.711.14635119293390454450.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: e4c9a4cb244a273c58e8fd86d7c04e2502822e64 Gitweb: https://git.kernel.org/tip/e4c9a4cb244a273c58e8fd86d7c04e250= 2822e64 Author: Tim Chen AuthorDate: Wed, 01 Apr 2026 14:52:25 -07:00 Committer: Peter Zijlstra CommitterDate: Thu, 09 Apr 2026 15:49:51 +02:00 sched/cache: Add migrate_llc_task migration type for cache-aware balancing Introduce a new migration type, migrate_llc_task, to support cache-aware load balancing. After identifying the busiest sched_group (having the most tasks preferring the destination LLC), mark migrations with this type. During load balancing, each runqueue in the busiest sched_group is examined, and the runqueue with the highest number of tasks preferring the destination CPU is selected as the busiest runqueue. Co-developed-by: Chen Yu Signed-off-by: Chen Yu Signed-off-by: Tim Chen Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/b9df27c19cc5121ddb2a7d1be7f9d52fec1563dc.177= 5065312.git.tim.c.chen@linux.intel.com --- kernel/sched/fair.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ba4ee9a..68032ef 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9946,7 +9946,8 @@ enum migration_type { migrate_load =3D 0, migrate_util, migrate_task, - migrate_misfit + migrate_misfit, + migrate_llc_task }; =20 #define LBF_ALL_PINNED 0x01 @@ -10560,6 +10561,10 @@ static int detach_tasks(struct lb_env *env) =20 env->imbalance =3D 0; break; + + case migrate_llc_task: + env->imbalance--; + break; } =20 detach_task(p, env); @@ -12179,6 +12184,15 @@ static inline void calculate_imbalance(struct lb_e= nv *env, struct sd_lb_stats *s return; } =20 +#ifdef CONFIG_SCHED_CACHE + if (busiest->group_type =3D=3D group_llc_balance) { + /* Move a task that prefer local LLC */ + env->migration_type =3D migrate_llc_task; + env->imbalance =3D 1; + return; + } +#endif + if (busiest->group_type =3D=3D group_imbalanced) { /* * In the group_imb case we cannot rely on group-wide averages @@ -12485,7 +12499,10 @@ static struct rq *sched_balance_find_src_rq(struct= lb_env *env, { struct rq *busiest =3D NULL, *rq; unsigned long busiest_util =3D 0, busiest_load =3D 0, busiest_capacity = =3D 1; + unsigned int __maybe_unused busiest_pref_llc =3D 0; + struct sched_domain __maybe_unused *sd_tmp; unsigned int busiest_nr =3D 0; + int __maybe_unused dst_llc; int i; =20 for_each_cpu_and(i, sched_group_span(group), env->cpus) { @@ -12613,6 +12630,23 @@ static struct rq *sched_balance_find_src_rq(struct= lb_env *env, =20 break; =20 + case migrate_llc_task: +#ifdef CONFIG_SCHED_CACHE + sd_tmp =3D rcu_dereference_all(rq->sd); + dst_llc =3D llc_id(env->dst_cpu); + + if (sd_tmp && (unsigned)dst_llc < sd_tmp->llc_max) { + unsigned int this_pref_llc =3D + sd_tmp->llc_counts[dst_llc]; + + if (busiest_pref_llc < this_pref_llc) { + busiest_pref_llc =3D this_pref_llc; + busiest =3D rq; + } + } +#endif + break; + } } =20 @@ -12776,6 +12810,8 @@ static void update_lb_imbalance_stat(struct lb_env = *env, struct sched_domain *sd case migrate_misfit: __schedstat_add(sd->lb_imbalance_misfit[idle], env->imbalance); break; + case migrate_llc_task: + break; } } =20