From: Stephen Rothwell Date: Tue, 5 Mar 2019 23:43:01 +0000 (-0800) Subject: tools/: replace open encodings for NUMA_NO_NODE X-Git-Tag: v5.4-rc1~1517^2~131 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c9eefe82ca1efec5890678c33e66d5d520c06f4;p=platform%2Fkernel%2Flinux-rpi.git tools/: replace open encodings for NUMA_NO_NODE This replaces all open encodings in tools with NUMA_NO_NODE. Also linux/numa.h is now needed for the perf build. [sfr@canb.auug.org.au: fix for replace open encodings for NUMA_NO_NODE] Link: http://lkml.kernel.org/r/20190108131141.730e9c4f@canb.auug.org.au Link: http://lkml.kernel.org/r/1545127933-10711-3-git-send-email-anshuman.khandual@arm.com Signed-off-by: Stephen Rothwell Signed-off-by: Anshuman Khandual Signed-off-by: Stephen Rothwell Cc: David Hildenbrand Cc: Doug Ledford [drivers/infiniband] Cc: Hans Verkuil Cc: Jeff Kirsher [ixgbe] Cc: Jens Axboe [mtip32xx] Cc: Joseph Qi Cc: Michael Ellerman [powerpc] Cc: Vinod Koul [dmaengine.c] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/tools/include/linux/numa.h b/tools/include/linux/numa.h new file mode 100644 index 0000000..110b0e5 --- /dev/null +++ b/tools/include/linux/numa.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_NUMA_H +#define _LINUX_NUMA_H + + +#ifdef CONFIG_NODES_SHIFT +#define NODES_SHIFT CONFIG_NODES_SHIFT +#else +#define NODES_SHIFT 0 +#endif + +#define MAX_NUMNODES (1 << NODES_SHIFT) + +#define NUMA_NO_NODE (-1) + +#endif /* _LINUX_NUMA_H */ diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 4419551..98ad783 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -298,7 +299,7 @@ static cpu_set_t bind_to_node(int target_node) CPU_ZERO(&mask); - if (target_node == -1) { + if (target_node == NUMA_NO_NODE) { for (cpu = 0; cpu < g->p.nr_cpus; cpu++) CPU_SET(cpu, &mask); } else { @@ -339,7 +340,7 @@ static void bind_to_memnode(int node) unsigned long nodemask; int ret; - if (node == -1) + if (node == NUMA_NO_NODE) return; BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8); @@ -1363,7 +1364,7 @@ static void init_thread_data(void) int cpu; /* Allow all nodes by default: */ - td->bind_node = -1; + td->bind_node = NUMA_NO_NODE; /* Allow all CPUs by default: */ CPU_ZERO(&td->bind_cpumask);