aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nodemask.h
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2009-12-14 20:58:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:12 -0500
commit4e7b8a6cef64a4c1f1194f9926f794c2b75ebdd7 (patch)
treec95a6e4e34e09f8d622451c85b88fe2961fbb6ac /include/linux/nodemask.h
parent6d9c285a632b39ab83c6ae14cbff0e606d4042ee (diff)
nodemask: make NODEMASK_ALLOC more general
This is a series of patches to provide control over the location of the allocation and freeing of persistent huge pages on a NUMA platform. Please consider for merging into mmotm. This series uses two mechanisms to constrain the nodes from which persistent huge pages are allocated: 1) the task NUMA mempolicy of the task modifying a new sysctl "nr_hugepages_mempolicy", based on a suggestion by Mel Gorman; and 2) a subset of the hugepages hstate sysfs attributes have been added [in V4] to each node system device under: /sys/devices/node/node[0-9]*/hugepages The per node attibutes allow direct assignment of a huge page count on a specific node, regardless of the task's mempolicy or cpuset constraints. This patch: NODEMASK_ALLOC(x, m) assumes x is a type of struct, which is unnecessary. It's perfectly reasonable to use this macro to allocate a nodemask_t, which is anonymous, either dynamically or on the stack depending on NODES_SHIFT. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Nishanth Aravamudan <nacc@us.ibm.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Rientjes <rientjes@google.com> Cc: Adam Litke <agl@us.ibm.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Eric Whitney <eric.whitney@hp.com> Cc: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/nodemask.h')
-rw-r--r--include/linux/nodemask.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b359c4a9ec9e..ca9b489a27f8 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -481,14 +481,14 @@ static inline int num_node_state(enum node_states state)
481 481
482/* 482/*
483 * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) 483 * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h)
484 * NODEMASK_ALLOC(x, m) allocates an object of type 'x' with the name 'm'.
484 */ 485 */
485
486#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ 486#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */
487#define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL) 487#define NODEMASK_ALLOC(x, m) x *m = kmalloc(sizeof(*m), GFP_KERNEL)
488#define NODEMASK_FREE(m) kfree(m) 488#define NODEMASK_FREE(m) kfree(m)
489#else 489#else
490#define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m 490#define NODEMASK_ALLOC(x, m) x _m, *m = &_m
491#define NODEMASK_FREE(m) 491#define NODEMASK_FREE(m) do {} while (0)
492#endif 492#endif
493 493
494/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ 494/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */
@@ -497,8 +497,9 @@ struct nodemask_scratch {
497 nodemask_t mask2; 497 nodemask_t mask2;
498}; 498};
499 499
500#define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x) 500#define NODEMASK_SCRATCH(x) \
501#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) 501 NODEMASK_ALLOC(struct nodemask_scratch, x)
502#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)
502 503
503 504
504#endif /* __LINUX_NODEMASK_H */ 505#endif /* __LINUX_NODEMASK_H */