Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176252
b: refs/heads/master
c: bad44b5
h: refs/heads/master
v: v3
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Dec 15, 2009
1 parent 06237d0 commit 9bef94c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39da08cb074cf19cb249832a2a955dfb28837e65
refs/heads/master: bad44b5be84cf3bb1ff900bec02ee61e1993328c
21 changes: 12 additions & 9 deletions trunk/include/linux/nodemask.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,15 +485,17 @@ static inline int num_node_state(enum node_states state)
#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)

/*
* For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h)
* NODEMASK_ALLOC(x, m) allocates an object of type 'x' with the name 'm'.
* For nodemask scrach area.
* NODEMASK_ALLOC(type, name) allocates an object with a specified type and
* name.
*/
#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */
#define NODEMASK_ALLOC(x, m) x *m = kmalloc(sizeof(*m), GFP_KERNEL)
#define NODEMASK_FREE(m) kfree(m)
#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */
#define NODEMASK_ALLOC(type, name, gfp_flags) \
type *name = kmalloc(sizeof(*name), gfp_flags)
#define NODEMASK_FREE(m) kfree(m)
#else
#define NODEMASK_ALLOC(x, m) x _m, *m = &_m
#define NODEMASK_FREE(m) do {} while (0)
#define NODEMASK_ALLOC(type, name, gfp_flags) type _name, *name = &_name
#define NODEMASK_FREE(m) do {} while (0)
#endif

/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */
Expand All @@ -502,8 +504,9 @@ struct nodemask_scratch {
nodemask_t mask2;
};

#define NODEMASK_SCRATCH(x) \
NODEMASK_ALLOC(struct nodemask_scratch, x)
#define NODEMASK_SCRATCH(x) \
NODEMASK_ALLOC(struct nodemask_scratch, x, \
GFP_KERNEL | __GFP_NORETRY)
#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)


Expand Down
5 changes: 3 additions & 2 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
int nid;
unsigned long count;
struct hstate *h;
NODEMASK_ALLOC(nodemask_t, nodes_allowed);
NODEMASK_ALLOC(nodemask_t, nodes_allowed, GFP_KERNEL | __GFP_NORETRY);

err = strict_strtoul(buf, 10, &count);
if (err)
Expand Down Expand Up @@ -1857,7 +1857,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
proc_doulongvec_minmax(table, write, buffer, length, ppos);

if (write) {
NODEMASK_ALLOC(nodemask_t, nodes_allowed);
NODEMASK_ALLOC(nodemask_t, nodes_allowed,
GFP_KERNEL | __GFP_NORETRY);
if (!(obey_mempolicy &&
init_nodemask_of_mempolicy(nodes_allowed))) {
NODEMASK_FREE(nodes_allowed);
Expand Down

0 comments on commit 9bef94c

Please sign in to comment.