[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200813120738.GB21578@linux.vnet.ibm.com>
Date: Thu, 13 Aug 2020 17:37:38 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Alexander Gordeev <agordeev@...ux.ibm.com>
Cc: Namhyung Kim <namhyung@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Satheesh Rajendran <sathnaga@...ux.vnet.ibm.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Balamuruhan S <bala24@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH v3 1/2] perf bench numa: use numa_node_to_cpus() to bind
tasks to nodes
* Alexander Gordeev <agordeev@...ux.ibm.com> [2020-08-13 13:32:48]:
> It is currently assumed that each node contains at most
> nr_cpus/nr_nodes CPUs and nodes' CPU ranges do not overlap.
> That assumption is generally incorrect as there are archs
> where a CPU number does not depend on to its node number.
>
> This update removes the described assumption by simply calling
> numa_node_to_cpus() interface and using the returned mask for
> binding CPUs to nodes.
>
> Also, variable types and names made consistent in functions
> using cpumask.
>
> Cc: Satheesh Rajendran <sathnaga@...ux.vnet.ibm.com>
> Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
> Cc: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
> Cc: Balamuruhan S <bala24@...ux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Alexander Gordeev <agordeev@...ux.ibm.com>
> ---
> @@ -310,13 +306,16 @@ static cpu_set_t bind_to_node(int target_node)
> for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
> CPU_SET(cpu, &mask);
> } else {
> - int cpu_start = (target_node + 0) * cpus_per_node;
> - int cpu_stop = (target_node + 1) * cpus_per_node;
> -
> - BUG_ON(cpu_stop > g->p.nr_cpus);
> + struct bitmask *cpumask = numa_allocate_cpumask();
>
> - for (cpu = cpu_start; cpu < cpu_stop; cpu++)
> - CPU_SET(cpu, &mask);
> + BUG_ON(!cpumask);
> + if (!numa_node_to_cpus(target_node, cpumask)) {
> + for (cpu = 0; cpu < (int)cpumask->size; cpu++) {
> + if (numa_bitmask_isbitset(cpumask, cpu))
> + CPU_SET(cpu, &mask);
> + }
> + }
> + numa_free_cpumask(cpumask);
> }
>
> ret = sched_setaffinity(0, sizeof(mask), &mask);
> --
> 1.8.3.1
>
Looks good to me.
Reviewed-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
--
Thanks and Regards
Srikar Dronamraju
Powered by blists - more mailing lists