mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Klaus Kusche <klaus.kusche@computerix.info>
To: Chen Yu <yu.c.chen@intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	"Badole, Vishal" <Vishal.Badole@amd.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	K Prateek Nayak <KPrateek.Nayak@amd.com>,
	ricardo.neri@intel.com
Subject: Re: Cache-aware scheduling does not work well with amd big/little cores
Date: Wed, 16 Sep 2026 16:52:00 +0200	[thread overview]
Message-ID: <8aea0f25-0317-42ac-b59f-1a008c6eb106@computerix.info> (raw)
In-Reply-To: <aqfy8PjSUOYI-_Ju@chenyu-dev>


I don't know what your last patch does (does it dynamically disable 
cache aware scheduling on big/little CPU's?),
but it makes my two build tests running at almost the same speed
on a kernel with cache aware scheduling
compared to a kernel without cache aware scheduling, 
which means it is rougly 2 % faster 
than earlier cache aware scheduling kernels.

Just by looking at the core bar graph,
I also didn't see any obviously misplaced processes.

Klaus Kusche

On 14/09/2026 15:13, Chen Yu wrote:
> On Mon, Sep 14, 2026 at 12:27:53PM +0200, Klaus Kusche wrote:
>>
>> I did some very quick tests.
>>
>> 1.) /sys/kernel/sched/debug/domains/* does not exist on my system,
>> not even with debug_fs on.
>>
>> /sys/kernel/debug/x86/sched_itmt_enabled is "Y",
>> /sys/kernel/debug/x86/sched_core_priority looks good
>> (big cores have values almost twice as high as small cores)
>>
>> 2.) The situation with 7.2.5 which seems to include 
>> https://lore.kernel.org/lkml/20260825174112.2580942-1-tim.c.chen@linux.intel.com/
>> is almost unchanged: Without cache aware scheduling, 
>> my build jobs run faster (wallclock time):
>> Just 6:16 compared to 6:19 for my kernel build with full LTO,
>> but 4:50 compared to 5:20 (???) for my python uv build
>> (the python uv build seems to be a very interesting test case?)
>>
>> However, with cache sched enabled, in spite of the longer 
>> wallclock time, cpu seconds are sometimes a little bit lower.
>>
>> 3.) https://lore.kernel.org/lkml/20260810033742.1688718-1-yu.c.chen@intel.com/
> 
> This patch inhibits ASYM_PACKING and favors Cache-Aware-Scheduling,
> which is the opposite of what your platform expects.
> 
>> seems to make things much worse:
>> Kernel builds had the LTO step and the CC compressed step
>> placed on little cores for significant amounts of time,
>> resulting in total build times above 8 minutes.
>> Same impression by watching the bar graph for individual cores
>> for the uv build.
>>
> 
> After a second thought, I wonder if we should disable Cache-Aware
> Scheduling if ASYM_PACKING is enabled, because the latter would
> prefer a higher priority CPU rather than just choosing a random
> L3 to aggregate the threads. Would the following patch work
> for you? (just compile tested, as I do not have a multi-LLC hybrid
> AMD platform for testing) Thanks.
> 
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 0248227d983a..07bc8a302574 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -684,6 +684,7 @@ DEFINE_PER_CPU(struct sched_domain __rcu *, sd_asym_cpucapacity);
>  
>  DEFINE_STATIC_KEY_FALSE(sched_asym_cpucapacity);
>  DEFINE_STATIC_KEY_FALSE(sched_cluster_active);
> +DEFINE_STATIC_KEY_FALSE(sched_asym_packing_active);
>  
>  static void update_top_cache_domain(int cpu)
>  {
> @@ -957,6 +958,11 @@ static void _sched_cache_active_set(void)
>  		return;
>  	}
>  
> +	if (static_branch_unlikely(&sched_asym_packing_active)) {
> +		static_branch_disable_cpuslocked(&sched_cache_active);
> +		return;
> +	}
> +
>  	/*
>  	 * user wants it or not ?
>  	 * TBD: read before writing the static key.
> @@ -3085,6 +3091,7 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>  	int i, ret = -ENOMEM;
>  	bool has_asym = false;
>  	bool has_cluster = false;
> +	bool has_asym_packing = false;
>  
>  	if (WARN_ON(cpumask_empty(cpu_map)))
>  		goto error;
> @@ -3204,6 +3211,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>  
>  		if (lowest_flag_domain(i, SD_CLUSTER))
>  			has_cluster = true;
> +
> +		if (highest_flag_domain(i, SD_ASYM_PACKING))
> +			has_asym_packing = true;
>  	}
>  	rcu_read_unlock();
>  
> @@ -3213,6 +3223,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>  	if (has_cluster)
>  		static_branch_inc_cpuslocked(&sched_cluster_active);
>  
> +	if (has_asym_packing)
> +		static_branch_inc_cpuslocked(&sched_asym_packing_active);
> +
>  	if (rq && sched_debug_verbose)
>  		pr_info("root domain span: %*pbl\n", cpumask_pr_args(cpu_map));
>  
> @@ -3318,6 +3331,9 @@ static void detach_destroy_domains(const struct cpumask *cpu_map)
>  	if (static_branch_unlikely(&sched_cluster_active))
>  		static_branch_dec_cpuslocked(&sched_cluster_active);
>  
> +	if (rcu_access_pointer(per_cpu(sd_asym_packing, cpu)))
> +		static_branch_dec_cpuslocked(&sched_asym_packing_active);
> +
>  	rcu_read_lock();
>  	for_each_cpu(i, cpu_map)
>  		cpu_attach_domain(NULL, &def_root_domain, i);


      reply	other threads:[~2026-09-16 14:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 15:42 Klaus Kusche
2026-08-31  1:53 ` Mario Limonciello
2026-08-31  2:08   ` Chen, Yu C
2026-08-31 11:24     ` Klaus Kusche
2026-08-31 17:29       ` Tim Chen
2026-08-31 18:49         ` Klaus Kusche
2026-08-31 18:53           ` Mario Limonciello
2026-09-05 15:40         ` Klaus Kusche
2026-09-08 21:54           ` Tim Chen
2026-09-09  8:59             ` Klaus Kusche
2026-09-09 13:19               ` Mario Limonciello
2026-09-09 19:51                 ` Tim Chen
2026-09-10  1:29                   ` Chen, Yu C
2026-09-14 10:27                     ` Klaus Kusche
2026-09-14 13:13                       ` Chen Yu
2026-09-16 14:52                         ` Klaus Kusche [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8aea0f25-0317-42ac-b59f-1a008c6eb106@computerix.info \
    --to=klaus.kusche@computerix.info \
    --cc=KPrateek.Nayak@amd.com \
    --cc=Vishal.Badole@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=peterz@infradead.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ricardo.neri@intel.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=x86@kernel.org \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®