From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-numa@vger.kernel.org,
Mel Gorman <mel@csn.ul.ie>,
Christoph Lameter <cl@linux-foundation.org>,
Randy Dunlap <randy.dunlap@oracle.com>,
Nishanth Aravamudan <nacc@us.ibm.com>,
Adam Litke <agl@us.ibm.com>, Andy Whitcroft <apw@canonical.com>,
eric.whitney@hp.com, Lee Schermerhorn <lee.schermerhorn@hp.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [patch] nodemask: make NODEMASK_ALLOC more general
Date: Fri, 2 Oct 2009 15:16:07 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.1.00.0910021511030.18180@chino.kir.corp.google.com> (raw)
In-Reply-To: <20091001165832.32248.32725.sendpatchset@localhost.localdomain>
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.
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
include/linux/nodemask.h | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -486,14 +486,14 @@ static inline int num_node_state(enum node_states state)
/*
* For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h)
+ * NODEMASK_ALLOC(x, m) allocates an object of type 'x' with the name 'm'.
*/
-
#if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */
-#define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL)
-#define NODEMASK_FREE(m) kfree(m)
+#define NODEMASK_ALLOC(x, m) x *m = kmalloc(sizeof(*m), GFP_KERNEL)
+#define NODEMASK_FREE(m) kfree(m)
#else
-#define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m
-#define NODEMASK_FREE(m)
+#define NODEMASK_ALLOC(x, m) x _m, *m = &_m
+#define NODEMASK_FREE(m) do {} while (0)
#endif
/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */
@@ -502,8 +502,9 @@ struct nodemask_scratch {
nodemask_t mask2;
};
-#define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x)
-#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)
+#define NODEMASK_SCRATCH(x) \
+ NODEMASK_ALLOC(struct nodemask_scratch, x)
+#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x)
#endif /* __LINUX_NODEMASK_H */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-10-02 22:16 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 16:57 [PATCH 0/10] hugetlb: V8 numa control of persistent huge pages alloc/free Lee Schermerhorn
2009-10-01 16:57 ` [PATCH 1/10] hugetlb: rework hstate_next_node_* functions Lee Schermerhorn
2009-10-01 16:57 ` [PATCH 2/10] hugetlb: add nodemask arg to huge page alloc, free and surplus adjust fcns Lee Schermerhorn
2009-10-01 16:58 ` [PATCH 3/10] hugetlb: factor init_nodemask_of_node Lee Schermerhorn
2009-10-02 9:48 ` Mel Gorman
2009-10-02 11:38 ` Lee Schermerhorn
2009-10-03 17:25 ` Andrew Morton
2009-10-01 16:58 ` [PATCH 4/10] hugetlb: derive huge pages nodes allowed from task mempolicy Lee Schermerhorn
2009-10-02 10:11 ` Mel Gorman
2009-10-02 22:41 ` David Rientjes
2009-10-02 22:16 ` David Rientjes [this message]
2009-10-02 22:48 ` [patch] nodemask: make NODEMASK_ALLOC more general Christoph Lameter
2009-10-03 1:03 ` KAMEZAWA Hiroyuki
2009-10-06 3:46 ` David Rientjes
2009-10-03 0:59 ` KAMEZAWA Hiroyuki
2009-10-02 22:16 ` [PATCH 4/10] hugetlb: derive huge pages nodes allowed from task mempolicy David Rientjes
2009-10-02 23:23 ` Christoph Lameter
2009-10-05 11:15 ` Lee Schermerhorn
2009-10-05 20:58 ` David Rientjes
2009-10-06 2:54 ` Lee Schermerhorn
2009-10-06 3:33 ` David Rientjes
2009-10-01 16:58 ` [PATCH 5/10] hugetlb: add generic definition of NUMA_NO_NODE Lee Schermerhorn
2009-10-01 16:58 ` [PATCH 6/10] hugetlb: add per node hstate attributes Lee Schermerhorn
2009-10-01 16:58 ` [PATCH 7/10] hugetlb: update hugetlb documentation for NUMA controls Lee Schermerhorn
2009-10-01 19:47 ` Randy Dunlap
2009-10-02 11:43 ` Lee Schermerhorn
2009-10-01 16:58 ` [PATCH 8/10] hugetlb: use only nodes with memory for huge pages Lee Schermerhorn
2009-10-01 16:59 ` [PATCH 9/10] hugetlb: handle memory hot-plug events Lee Schermerhorn
2009-10-01 16:59 ` [PATCH 10/10] hugetlb: offload per node attribute registrations Lee Schermerhorn
2010-03-31 11:23 ` [APPLIED] [PATCH 0/10] hugetlb: V8 numa control of persistent huge pages alloc/free Andy Whitcroft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.00.0910021511030.18180@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=agl@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=cl@linux-foundation.org \
--cc=eric.whitney@hp.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=lee.schermerhorn@hp.com \
--cc=linux-mm@kvack.org \
--cc=linux-numa@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=nacc@us.ibm.com \
--cc=randy.dunlap@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox