Skip to content

Commit

Permalink
tools/: replace open encodings for NUMA_NO_NODE
Browse files Browse the repository at this point in the history
This replaces all open encodings in tools with NUMA_NO_NODE.  Also
linux/numa.h is now needed for the perf build.

[[email protected]: fix for replace open encodings for NUMA_NO_NODE]
  Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Stephen Rothwell <[email protected]>
Signed-off-by: Anshuman Khandual <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Doug Ledford <[email protected]>		[drivers/infiniband]
Cc: Hans Verkuil <[email protected]>
Cc: Jeff Kirsher <[email protected]>	[ixgbe]
Cc: Jens Axboe <[email protected]>			[mtip32xx]
Cc: Joseph Qi <[email protected]>
Cc: Michael Ellerman <[email protected]>		[powerpc]
Cc: Vinod Koul <[email protected]>			[dmaengine.c]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sfrothwell authored and torvalds committed Mar 6, 2019
1 parent 98fa15f commit 7c9eefe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions tools/include/linux/numa.h
Original file line number Diff line number Diff line change
@@ -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 */
7 changes: 4 additions & 3 deletions tools/perf/bench/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <sys/types.h>
#include <linux/kernel.h>
#include <linux/time64.h>
#include <linux/numa.h>

#include <numa.h>
#include <numaif.h>
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7c9eefe

Please sign in to comment.