Skip to content

Commit c1e6c8d

Browse files
Lee Schermerhorntorvalds
authored andcommitted
hugetlb: factor init_nodemask_of_node()
Factor init_nodemask_of_node() out of the nodemask_of_node() macro. This will be used to populate the huge pages "nodes_allowed" nodemask for a single node when basing nodes_allowed on a preferred/local mempolicy or when a persistent huge page pool page count is modified via a per node sysfs attribute. Signed-off-by: Lee Schermerhorn <[email protected]> Acked-by: Mel Gorman <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Nishanth Aravamudan <[email protected]> Acked-by: David Rientjes <[email protected]> Cc: Adam Litke <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Eric Whitney <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6ae11b2 commit c1e6c8d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

include/linux/nodemask.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,19 @@ static inline int __next_node(int n, const nodemask_t *srcp)
245245
return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
246246
}
247247

248+
static inline void init_nodemask_of_node(nodemask_t *mask, int node)
249+
{
250+
nodes_clear(*mask);
251+
node_set(node, *mask);
252+
}
253+
248254
#define nodemask_of_node(node) \
249255
({ \
250256
typeof(_unused_nodemask_arg_) m; \
251257
if (sizeof(m) == sizeof(unsigned long)) { \
252-
m.bits[0] = 1UL<<(node); \
258+
m.bits[0] = 1UL << (node); \
253259
} else { \
254-
nodes_clear(m); \
255-
node_set((node), m); \
260+
init_nodemask_of_node(&m, (node)); \
256261
} \
257262
m; \
258263
})

0 commit comments

Comments
 (0)