Skip to content

Commit 7c9eefe

Browse files
sfrothwelltorvalds
authored andcommitted
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 <sfr@canb.auug.org.au> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: David Hildenbrand <david@redhat.com> Cc: Doug Ledford <dledford@redhat.com> [drivers/infiniband] Cc: Hans Verkuil <hverkuil@xs4all.nl> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> [ixgbe] Cc: Jens Axboe <axboe@kernel.dk> [mtip32xx] Cc: Joseph Qi <jiangqi903@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> [powerpc] Cc: Vinod Koul <vkoul@kernel.org> [dmaengine.c] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 98fa15f commit 7c9eefe

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎tools/include/linux/numa.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _LINUX_NUMA_H
3+
#define _LINUX_NUMA_H
4+
5+
6+
#ifdef CONFIG_NODES_SHIFT
7+
#define NODES_SHIFT CONFIG_NODES_SHIFT
8+
#else
9+
#define NODES_SHIFT 0
10+
#endif
11+
12+
#define MAX_NUMNODES (1 << NODES_SHIFT)
13+
14+
#define NUMA_NO_NODE (-1)
15+
16+
#endif /* _LINUX_NUMA_H */

‎tools/perf/bench/numa.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <sys/types.h>
3535
#include <linux/kernel.h>
3636
#include <linux/time64.h>
37+
#include <linux/numa.h>
3738

3839
#include <numa.h>
3940
#include <numaif.h>
@@ -298,7 +299,7 @@ static cpu_set_t bind_to_node(int target_node)
298299

299300
CPU_ZERO(&mask);
300301

301-
if (target_node == -1) {
302+
if (target_node == NUMA_NO_NODE) {
302303
for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
303304
CPU_SET(cpu, &mask);
304305
} else {
@@ -339,7 +340,7 @@ static void bind_to_memnode(int node)
339340
unsigned long nodemask;
340341
int ret;
341342

342-
if (node == -1)
343+
if (node == NUMA_NO_NODE)
343344
return;
344345

345346
BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
@@ -1363,7 +1364,7 @@ static void init_thread_data(void)
13631364
int cpu;
13641365

13651366
/* Allow all nodes by default: */
1366-
td->bind_node = -1;
1367+
td->bind_node = NUMA_NO_NODE;
13671368

13681369
/* Allow all CPUs by default: */
13691370
CPU_ZERO(&td->bind_cpumask);

0 commit comments

Comments
 (0)