Re: [PATCH RESEND v3] sched/isolation: Prefer housekeeping cpu in local node

From: Srikar Dronamraju
Date: Fri Jun 28 2019 - 02:58:12 EST


* Wanpeng Li <kernellwp@xxxxxxxxx> [2019-06-28 08:43:13]:


>
> +/*
> + * sched_numa_find_closest() - given the NUMA topology, find the cpu
> + * closest to @cpu from @cpumask.
> + * cpumask: cpumask to find a cpu from
> + * cpu: cpu to be close to
> + *
> + * returns: cpu, or >= nr_cpu_ids when nothing found (or !NUMA).

One nit:
I dont see sched_numa_find_closest returning anything greater than
nr_cpu_ids. So 's/>= //' for the above comment.

> + */
> +int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
> +{
> +#ifdef CONFIG_NUMA
> + int i, j = cpu_to_node(cpu);
> +
> + for (i = 0; i < sched_domains_numa_levels; i++) {
> + cpu = cpumask_any_and(cpus, sched_domains_numa_masks[i][j]);
> + if (cpu < nr_cpu_ids)
> + return cpu;
> + }
> +#endif
> + return nr_cpu_ids;
> +}
> +

Should we have a static function for sched_numa_find_closest instead of
having #ifdef in the function?

> static int __sdt_alloc(const struct cpumask *cpu_map)
> {
> struct sched_domain_topology_level *tl;

--
Thanks and Regards
Srikar Dronamraju