[PATCH] sched: dynamic config sd_flags if described in DT

Peter Zijlstra peterz at infradead.org
Tue Mar 15 02:29:11 PDT 2022


On Tue, Mar 15, 2022 at 12:58:54AM -0700, Qing Wang wrote:
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1527,6 +1527,7 @@ sd_init(struct sched_domain_topology_level *tl,
>  	struct sched_domain *sd = *per_cpu_ptr(sdd->sd, cpu);
>  	int sd_id, sd_weight, sd_flags = 0;
>  	struct cpumask *sd_span;
> +	int ret;
>  
>  #ifdef CONFIG_NUMA
>  	/*
> @@ -1539,6 +1540,15 @@ sd_init(struct sched_domain_topology_level *tl,
>  
>  	if (tl->sd_flags)
>  		sd_flags = (*tl->sd_flags)();
> +
> +#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
> +	ret = cpus_share_self_cache(cpu_map);
> +	if (ret == 1)
> +		sd_flags |= SD_SHARE_PKG_RESOURCES;
> +	else if (ret == 0)
> +		sd_flags &= ~SD_SHARE_PKG_RESOURCES;
> +#endif
> +
>  	if (WARN_ONCE(sd_flags & ~TOPOLOGY_SD_FLAGS,
>  			"wrong sd_flags in topology description\n"))
>  		sd_flags &= TOPOLOGY_SD_FLAGS;

Still NAK, you don't have to touch generic code for any of this.



More information about the linux-riscv mailing list