Re: [PATCH 3/8] sched_ext: idle: Extend topology optimizations to all tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux