aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/nodemask.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index cbd521a03127..454997cccbd8 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -485,15 +485,17 @@ static inline int num_node_state(enum node_states state)
485#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 485#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
486 486
487/* 487/*
488 * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) 488 * For nodemask scrach area.
489 * NODEMASK_ALLOC(x, m) allocates an object of type 'x' with the name 'm'. 489 * NODEMASK_ALLOC(type, name) allocates an object with a specified type and
490 * name.
490 */ 491 */
491#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ 492#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */
492#define NODEMASK_ALLOC(x, m) x *m = kmalloc(sizeof(*m), GFP_KERNEL) 493#define NODEMASK_ALLOC(type, name, gfp_flags) \
493#define NODEMASK_FREE(m) kfree(m) 494 type *name = kmalloc(sizeof(*name), gfp_flags)
495#define NODEMASK_FREE(m) kfree(m)
494#else 496#else
495#define NODEMASK_ALLOC(x, m) x _m, *m = &_m 497#define NODEMASK_ALLOC(type, name, gfp_flags) type _name, *name = &_name
496#define NODEMASK_FREE(m) do {} while (0) 498#define NODEMASK_FREE(m) do {} while (0)
497#endif 499#endif
498 500
499/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ 501/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */
@@ -502,8 +504,9 @@ struct nodemask_scratch {
502 nodemask_t mask2; 504 nodemask_t mask2;
503}; 505};
504 506
505#define NODEMASK_SCRATCH(x) \ 507#define NODEMASK_SCRATCH(x) \
506 NODEMASK_ALLOC(struct nodemask_scratch, x) 508 NODEMASK_ALLOC(struct nodemask_scratch, x, \
509 GFP_KERNEL | __GFP_NORETRY)
507#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) 510#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)
508 511
509 512