[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9RzvWMiHWqiO2v7@slm.duckdns.org>
Date: Fri, 14 Mar 2025 08:21:49 -1000
From: Tejun Heo <tj@...nel.org>
To: Andrea Righi <arighi@...dia.com>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/8] sched_ext: idle: Extend topology optimizations to
all tasks
Hello,
On Fri, Mar 14, 2025 at 10:45:35AM +0100, Andrea Righi wrote:
...
> - if (p->nr_cpus_allowed >= num_possible_cpus()) {
> - if (static_branch_maybe(CONFIG_NUMA, &scx_selcpu_topo_numa))
> - numa_cpus = numa_span(prev_cpu);
> -
> - if (static_branch_maybe(CONFIG_SCHED_MC, &scx_selcpu_topo_llc))
> - llc_cpus = llc_span(prev_cpu);
> + if (static_branch_maybe(CONFIG_NUMA, &scx_selcpu_topo_numa)) {
> + struct cpumask *cpus = numa_span(prev_cpu);
> +
> + if (cpus && !cpumask_equal(cpus, p->cpus_ptr)) {
> + if (cpumask_subset(cpus, p->cpus_ptr)) {
> + numa_cpus = cpus;
> + } else {
> + numa_cpus = this_cpu_cpumask_var_ptr(local_numa_idle_cpumask);
> + if (!cpumask_and(numa_cpus, cpus, p->cpus_ptr))
> + numa_cpus = NULL;
> + }
> + }
> + }
> + if (static_branch_maybe(CONFIG_SCHED_MC, &scx_selcpu_topo_llc)) {
> + struct cpumask *cpus = llc_span(prev_cpu);
> +
> + if (cpus && !cpumask_equal(cpus, p->cpus_ptr)) {
> + if (cpumask_subset(cpus, p->cpus_ptr)) {
> + llc_cpus = cpus;
> + } else {
> + llc_cpus = this_cpu_cpumask_var_ptr(local_llc_idle_cpumask);
> + if (!cpumask_and(llc_cpus, cpus, p->cpus_ptr))
> + llc_cpus = NULL;
> + }
> + }
>
Wouldn't it still make sense to special case p->nr_cpus_allowed >=
num_possible_cpus()? That'd be vast majority of cases and we can skip all
the cpumask comparisons for them.
Thanks.
--
tejun
Powered by blists - more mailing lists