diff mbox series

[net-next,1/2] sched/topology: Expose sched_numa_find_closest

Message ID 20220717052301.19067-2-tariqt@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series mlx5: Use NUMA distance metrics | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16714 this patch: 16714
netdev/cc_maintainers warning 9 maintainers not CCed: rostedt@goodmis.org song.bao.hua@hisilicon.com bristot@redhat.com bsegall@google.com vschneid@redhat.com lukasz.luba@arm.com viresh.kumar@linaro.org dietmar.eggemann@arm.com mgorman@suse.de
netdev/build_clang success Errors and warnings before: 3042 this patch: 3042
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 15970 this patch: 15970
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tariq Toukan July 17, 2022, 5:23 a.m. UTC
This logic can help device drivers prefer some remote cpus
over others, according to the NUMA distance metrics.

Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 include/linux/sched/topology.h | 2 ++
 kernel/sched/topology.c        | 1 +
 2 files changed, 3 insertions(+)

Comments

Peter Zijlstra July 18, 2022, 10:19 a.m. UTC | #1
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 <gal@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>  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?
Tariq Toukan July 18, 2022, 11:42 a.m. UTC | #2
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 <gal@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
>> ---
>>   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
diff mbox series

Patch

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 */