2022-07-17 05:44:13

by Tariq Toukan

[permalink] [raw]
Subject: [PATCH net-next 1/2] sched/topology: Expose sched_numa_find_closest

This logic can help device drivers prefer some remote cpus
over others, according to the NUMA distance metrics.

Reviewed-by: Gal Pressman <[email protected]>
Signed-off-by: Tariq Toukan <[email protected]>
---
include/linux/sched/topology.h | 2 ++
kernel/sched/topology.c | 1 +
2 files changed, 3 insertions(+)

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 56cffe42abbc..d467c30bdbb9 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -61,6 +61,8 @@ static inline int cpu_numa_flags(void)
{
return SD_NUMA;
}
+
+int sched_numa_find_closest(const struct cpumask *cpus, int cpu);
#endif

extern int arch_asym_cpu_priority(int cpu);
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 05b6c2ad90b9..688334ac4980 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2066,6 +2066,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)

return found;
}
+EXPORT_SYMBOL(sched_numa_find_closest);

#endif /* CONFIG_NUMA */

--
2.21.0


2022-07-18 10:42:37

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH net-next 1/2] sched/topology: Expose sched_numa_find_closest

On Sun, Jul 17, 2022 at 08:23:00AM +0300, Tariq Toukan wrote:
> This logic can help device drivers prefer some remote cpus
> over others, according to the NUMA distance metrics.
>
> Reviewed-by: Gal Pressman <[email protected]>
> Signed-off-by: Tariq Toukan <[email protected]>
> ---
> include/linux/sched/topology.h | 2 ++
> kernel/sched/topology.c | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 56cffe42abbc..d467c30bdbb9 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -61,6 +61,8 @@ static inline int cpu_numa_flags(void)
> {
> return SD_NUMA;
> }
> +
> +int sched_numa_find_closest(const struct cpumask *cpus, int cpu);
> #endif
>
> extern int arch_asym_cpu_priority(int cpu);
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 05b6c2ad90b9..688334ac4980 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2066,6 +2066,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
>
> return found;
> }
> +EXPORT_SYMBOL(sched_numa_find_closest);

EXPORT_SYMBOL_GPL() if anything.

Also, this thing will be subject to sched_domains, that means that if
someone uses cpusets or other means to partition the machine, that
effects the result.

Is that what you want?

2022-07-18 12:31:01

by Tariq Toukan

[permalink] [raw]
Subject: Re: [PATCH net-next 1/2] sched/topology: Expose sched_numa_find_closest



On 7/18/2022 1:19 PM, Peter Zijlstra wrote:
> On Sun, Jul 17, 2022 at 08:23:00AM +0300, Tariq Toukan wrote:
>> This logic can help device drivers prefer some remote cpus
>> over others, according to the NUMA distance metrics.
>>
>> Reviewed-by: Gal Pressman <[email protected]>
>> Signed-off-by: Tariq Toukan <[email protected]>
>> ---
>> include/linux/sched/topology.h | 2 ++
>> kernel/sched/topology.c | 1 +
>> 2 files changed, 3 insertions(+)
>>
>> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
>> index 56cffe42abbc..d467c30bdbb9 100644
>> --- a/include/linux/sched/topology.h
>> +++ b/include/linux/sched/topology.h
>> @@ -61,6 +61,8 @@ static inline int cpu_numa_flags(void)
>> {
>> return SD_NUMA;
>> }
>> +
>> +int sched_numa_find_closest(const struct cpumask *cpus, int cpu);
>> #endif
>>
>> extern int arch_asym_cpu_priority(int cpu);
>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
>> index 05b6c2ad90b9..688334ac4980 100644
>> --- a/kernel/sched/topology.c
>> +++ b/kernel/sched/topology.c
>> @@ -2066,6 +2066,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
>>
>> return found;
>> }
>> +EXPORT_SYMBOL(sched_numa_find_closest);
>
> EXPORT_SYMBOL_GPL() if anything.

I'll fix.

>
> Also, this thing will be subject to sched_domains, that means that if
> someone uses cpusets or other means to partition the machine, that
> effects the result.
>
> Is that what you want?

Yes, it's good enough, at least as a first phase and basic functionality.
Later we might introduce whatever enhancements we find necessary.


Thanks,
Tariq