aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/numa.c17
-rw-r--r--include/linux/bitmap.h1
-rw-r--r--include/linux/nodemask.h8
-rw-r--r--kernel/fork.c4
-rw-r--r--lib/bitmap.c2
5 files changed, 1 insertions, 31 deletions
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 10c27bb1e95f..550df481accd 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -2,7 +2,6 @@
2#include <linux/topology.h> 2#include <linux/topology.h>
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/bootmem.h> 4#include <linux/bootmem.h>
5#include <linux/random.h>
6 5
7#ifdef CONFIG_DEBUG_PER_CPU_MAPS 6#ifdef CONFIG_DEBUG_PER_CPU_MAPS
8# define DBG(x...) printk(KERN_DEBUG x) 7# define DBG(x...) printk(KERN_DEBUG x)
@@ -66,19 +65,3 @@ const struct cpumask *cpumask_of_node(int node)
66} 65}
67EXPORT_SYMBOL(cpumask_of_node); 66EXPORT_SYMBOL(cpumask_of_node);
68#endif 67#endif
69
70/*
71 * Return the bit number of a random bit set in the nodemask.
72 * (returns -1 if nodemask is empty)
73 */
74int __node_random(const nodemask_t *maskp)
75{
76 int w, bit = -1;
77
78 w = nodes_weight(*maskp);
79 if (w)
80 bit = bitmap_ord_to_pos(maskp->bits,
81 get_random_int() % w, MAX_NUMNODES);
82 return bit;
83}
84EXPORT_SYMBOL(__node_random);
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 6fb2720882fc..daf8c480c786 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -141,7 +141,6 @@ extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
141extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 141extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
142extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 142extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
143extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 143extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
144extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
145 144
146#define BITMAP_LAST_WORD_MASK(nbits) \ 145#define BITMAP_LAST_WORD_MASK(nbits) \
147( \ 146( \
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 8a8f1d09c133..dba35e413371 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -66,8 +66,6 @@
66 * int num_online_nodes() Number of online Nodes 66 * int num_online_nodes() Number of online Nodes
67 * int num_possible_nodes() Number of all possible Nodes 67 * int num_possible_nodes() Number of all possible Nodes
68 * 68 *
69 * int node_random(mask) Random node with set bit in mask
70 *
71 * int node_online(node) Is some node online? 69 * int node_online(node) Is some node online?
72 * int node_possible(node) Is some node possible? 70 * int node_possible(node) Is some node possible?
73 * 71 *
@@ -432,10 +430,6 @@ static inline void node_set_offline(int nid)
432 node_clear_state(nid, N_ONLINE); 430 node_clear_state(nid, N_ONLINE);
433 nr_online_nodes = num_node_state(N_ONLINE); 431 nr_online_nodes = num_node_state(N_ONLINE);
434} 432}
435
436#define node_random(mask) __node_random(&(mask))
437extern int __node_random(const nodemask_t *maskp);
438
439#else 433#else
440 434
441static inline int node_state(int node, enum node_states state) 435static inline int node_state(int node, enum node_states state)
@@ -466,8 +460,6 @@ static inline int num_node_state(enum node_states state)
466 460
467#define node_set_online(node) node_set_state((node), N_ONLINE) 461#define node_set_online(node) node_set_state((node), N_ONLINE)
468#define node_set_offline(node) node_clear_state((node), N_ONLINE) 462#define node_set_offline(node) node_clear_state((node), N_ONLINE)
469
470static inline int node_random(const nodemask_t mask) { return 0; }
471#endif 463#endif
472 464
473#define node_online_map node_states[N_ONLINE] 465#define node_online_map node_states[N_ONLINE]
diff --git a/kernel/fork.c b/kernel/fork.c
index bf9fef6d1bfe..b6cce14ba047 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1086,10 +1086,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1086 } 1086 }
1087 mpol_fix_fork_child_flag(p); 1087 mpol_fix_fork_child_flag(p);
1088#endif 1088#endif
1089#ifdef CONFIG_CPUSETS
1090 p->cpuset_mem_spread_rotor = node_random(p->mems_allowed);
1091 p->cpuset_slab_spread_rotor = node_random(p->mems_allowed);
1092#endif
1093#ifdef CONFIG_TRACE_IRQFLAGS 1089#ifdef CONFIG_TRACE_IRQFLAGS
1094 p->irq_events = 0; 1090 p->irq_events = 0;
1095#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW 1091#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
diff --git a/lib/bitmap.c b/lib/bitmap.c
index d7137e7e06e8..ffb78c916ccd 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -672,7 +672,7 @@ static int bitmap_pos_to_ord(const unsigned long *buf, int pos, int bits)
672 * 672 *
673 * The bit positions 0 through @bits are valid positions in @buf. 673 * The bit positions 0 through @bits are valid positions in @buf.
674 */ 674 */
675int bitmap_ord_to_pos(const unsigned long *buf, int ord, int bits) 675static int bitmap_ord_to_pos(const unsigned long *buf, int ord, int bits)
676{ 676{
677 int pos = 0; 677 int pos = 0;
678 678