nodemask_t definitions [1/7]
Subsystems (4)
PATCH 1/1 nodemask_t definitions [1/7]
nodemask_t-01-definitions.patch - The basic definitions of the nodemask_t type: include/linux/nodemask.h, include/asm-generic/{nodemask.h, nodemask_arith.h, nodemask_array.h, nodemask_const_reference.h, nodemask_const_value.h, nodemask_nonuma.h}, and some small changes to include/linux/mmzone.h (removing extistant definition of node_online_map and helper functions).
include/asm-generic/nodemask.h +44 -0
@@ -0,0 +1,44 @@ +#ifndef __ASM_GENERIC_NODEMASK_H +#define __ASM_GENERIC_NODEMASK_H + +#include <linux/config.h> +#include <linux/kernel.h> +#include <linux/numa.h> +#include <linux/types.h> +#include <linux/bitmap.h> + + +#if MAX_NUMNODES >BITS_PER_LONG + +#define NODE_ARRAY_SIZE BITS_TO_LONGS(MAX_NUMNODES) +struct nodemask +{ +unsigned long mask[NODE_ARRAY_SIZE ]; +}; +typedef struct nodemask nodemask_t ; + +#else /* MAX_NUMNODES <= BITS_PER_LONG */ +typedef unsigned long nodemask_t ; +#endif + + +#ifdef CONFIG_NUMA + +#if MAX_NUMNODES >BITS_PER_LONG +#include <asm-generic/nodemask_array.h> +#else +#include <asm-generic/nodemask_arith.h> +#endif + +#else /* !CONFIG_NUMA */ +#include <asm-generic/nodemask_nonuma.h> +#endif /* CONFIG_NUMA */ + + +#if MAX_NUMNODES <=4 *BITS_PER_LONG +#include <asm-generic/nodemask_const_value.h> +#else +#include <asm-generic/nodemask_const_reference.h> +#endif + +#endif /* __ASM_GENERIC_NODEMASK_H */
include/asm-generic/nodemask_arith.h +48 -0
48 lines not on this page · raw message
include/asm-generic/nodemask_array.h +51 -0
51 lines not on this page · raw message
include/asm-generic/nodemask_const_reference.h +27 -0
@@ -0,0 +1,27 @@ +#ifndef __ASM_GENERIC_NODEMASK_CONST_REFERENCE_H +#define __ASM_GENERIC_NODEMASK_CONST_REFERENCE_H + +struct nodemask_ref { +const nodemask_t *val; +}; + +typedef const struct nodemask_ref nodemask_const_t ; + +#define mk_nodemask_const (map) ((nodemask_const_t){ &(map) }) +#define node_isset_const (node, map) node_isset(node, *(map).val) + +#define nodes_and_const (dst,src1,src2) nodes_and(dst,*(src1).val,*(src2).val) +#define nodes_or_const (dst,src1,src2) nodes_or(dst,*(src1).val,*(src2).val) +#define nodes_equal_const (map1, map2) nodes_equal(*(map1).val, *(map2).val) +#define nodes_copy_const (map1, map2) bitmap_copy((map1).mask, (map2).val->mask, MAX_NUMNODES) + +#define nodes_empty_const (map) nodes_empty(*(map).val) +#define nodes_weight_const (map) nodes_weight(*(map).val) +#define first_node_const (map) first_node(*(map).val) +#define next_node_const (node, map) next_node(node, *(map).val) + +/* only ever use this for things that are _never_ used on large boxen */ +#define nodes_coerce_const (map) nodes_coerce(*(map).val) +#define any_online_node_const (map) any_online_node(*(map).val) + +#endif /* __ASM_GENERIC_NODEMASK_CONST_REFERENCE_H */
include/asm-generic/nodemask_const_value.h +21 -0
@@ -0,0 +1,21 @@ +#ifndef __ASM_GENERIC_NODEMASK_CONST_VALUE_H +#define __ASM_GENERIC_NODEMASK_CONST_VALUE_H + +typedef const nodemask_t nodemask_const_t ; + +#define mk_nodemask_const (map) (map) +#define node_isset_const (node, map) node_isset(node, map) +#define nodes_and_const (dst,src1,src2) nodes_and(dst, src1, src2) +#define nodes_or_const (dst,src1,src2) nodes_or(dst, src1, src2) +#define nodes_equal_const (map1, map2) nodes_equal(map1, map2) +#define nodes_empty_const (map) nodes_empty(map) +#define nodes_copy_const (map1, map2) do { map1 = (nodemask_t)map2; } while (0) +#define nodes_weight_const (map) nodes_weight(map) +#define first_node_const (map) first_node(map) +#define next_node_const (node, map) next_node(node, map) + +/* only ever use this for things that are _never_ used on large boxen */ +#define nodes_coerce_const (map) nodes_coerce(map) +#define any_online_node_const (map) any_online_node(map) + +#endif /* __ASM_GENERIC_NODEMASK_CONST_VALUE_H */
include/asm-generic/nodemask_nonuma.h +47 -0
47 lines not on this page · raw message
include/linux/mmzone.h +1 -30
@@ -11,6 +11,7 @@#include <linux/cache.h> #include <linux/threads.h> #include <linux/numa.h> +#include <linux/nodemask.h> #include <asm/atomic.h> /* Free memory management - zoned buddy allocator. */
@@ -218,7 +219,6 @@ typedef struct pglist_data {#define node_present_pages (nid) (NODE_DATA(nid)->node_present_pages)#define node_spanned_pages (nid) (NODE_DATA(nid)->node_spanned_pages) -extern int numnodes;extern struct pglist_data *pgdat_list; void get_zone_counts(unsigned long *active, unsigned long *inactive,
@@ -336,35 +336,6 @@ extern struct pglist_data contig_page_da#error ZONES_SHIFT > MAX_ZONES_SHIFT#endif -extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES); - -#if defined(CONFIG_DISCONTIGMEM ) || defined(CONFIG_NUMA ) - -#define node_online (node) test_bit(node, node_online_map) -#define node_set_online (node) set_bit(node, node_online_map) -#define node_set_offline (node) clear_bit(node, node_online_map) -static inline unsigned int num_online_nodes (void ) -{ -int i, num =0 ; - -for (i =0 ; i <MAX_NUMNODES ; i++){ -if (node_online (i)) - num++; - } -return num; -} - -#else /* !CONFIG_DISCONTIGMEM && !CONFIG_NUMA */ - -#define node_online (node) \ - ({ BUG_ON((node) != 0); test_bit(node, node_online_map); }) -#define node_set_online (node) \ - ({ BUG_ON((node) != 0); set_bit(node, node_online_map); }) -#define node_set_offline (node) \ - ({ BUG_ON((node) != 0); clear_bit(node, node_online_map); }) -#define num_online_nodes () 1 - -#endif /* CONFIG_DISCONTIGMEM || CONFIG_NUMA */ #endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _LINUX_MMZONE_H */
include/linux/nodemask.h +44 -0
44 lines not on this page · raw message