···1717#include <linux/init.h>1818#include <linux/bootmem.h>1919#include <linux/module.h>2020+#include <linux/random.h>2021#include <asm/mmzone.h>2122#include <asm/numa.h>2223···50495150 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);5251}5252+5353+/*5454+ * Return the bit number of a random bit set in the nodemask.5555+ * (returns -1 if nodemask is empty)5656+ */5757+int __node_random(const nodemask_t *maskp)5858+{5959+ int w, bit = -1;6060+6161+ w = nodes_weight(*maskp);6262+ if (w)6363+ bit = bitmap_ord_to_pos(maskp->bits,6464+ get_random_int() % w, MAX_NUMNODES);6565+ return bit;6666+}6767+EXPORT_SYMBOL(__node_random);53685469#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)5570/*