All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: Linux MM <linux-mm@kvack.org>, David Hansen <dave@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Cody P Schafer <jmesmon@gmail.com>,
	Cody P Schafer <cody@linux.vnet.ibm.com>
Subject: [PATCH 5/9] mmzone: add pgdat_{end_pfn,is_empty}() helpers & consolidate.
Date: Thu, 17 Jan 2013 14:52:57 -0800	[thread overview]
Message-ID: <1358463181-17956-6-git-send-email-cody@linux.vnet.ibm.com> (raw)
In-Reply-To: <1358463181-17956-1-git-send-email-cody@linux.vnet.ibm.com>

From: Cody P Schafer <jmesmon@gmail.com>

Add pgdat_end_pfn() and pgdat_is_empty() helpers which match the similar
zone_*() functions.

Change node_end_pfn() to be a wrapper of pgdat_end_pfn().

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
---
 include/linux/mmzone.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 696cb7c..d7abff0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -772,11 +772,17 @@ typedef struct pglist_data {
 #define nid_page_nr(nid, pagenr) 	pgdat_page_nr(NODE_DATA(nid),(pagenr))
 
 #define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn)
+#define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid))
 
-#define node_end_pfn(nid) ({\
-	pg_data_t *__pgdat = NODE_DATA(nid);\
-	__pgdat->node_start_pfn + __pgdat->node_spanned_pages;\
-})
+static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat)
+{
+	return pgdat->node_start_pfn + pgdat->node_spanned_pages;
+}
+
+static inline bool pgdat_is_empty(pg_data_t *pgdat)
+{
+	return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
+}
 
 #include <linux/memory_hotplug.h>
 
-- 
1.8.0.3


WARNING: multiple messages have this Message-ID (diff)
From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: Linux MM <linux-mm@kvack.org>, David Hansen <dave@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Cody P Schafer <jmesmon@gmail.com>,
	Cody P Schafer <cody@linux.vnet.ibm.com>
Subject: [PATCH 5/9] mmzone: add pgdat_{end_pfn,is_empty}() helpers & consolidate.
Date: Thu, 17 Jan 2013 14:52:57 -0800	[thread overview]
Message-ID: <1358463181-17956-6-git-send-email-cody@linux.vnet.ibm.com> (raw)
In-Reply-To: <1358463181-17956-1-git-send-email-cody@linux.vnet.ibm.com>

From: Cody P Schafer <jmesmon@gmail.com>

Add pgdat_end_pfn() and pgdat_is_empty() helpers which match the similar
zone_*() functions.

Change node_end_pfn() to be a wrapper of pgdat_end_pfn().

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
---
 include/linux/mmzone.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 696cb7c..d7abff0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -772,11 +772,17 @@ typedef struct pglist_data {
 #define nid_page_nr(nid, pagenr) 	pgdat_page_nr(NODE_DATA(nid),(pagenr))
 
 #define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn)
+#define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid))
 
-#define node_end_pfn(nid) ({\
-	pg_data_t *__pgdat = NODE_DATA(nid);\
-	__pgdat->node_start_pfn + __pgdat->node_spanned_pages;\
-})
+static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat)
+{
+	return pgdat->node_start_pfn + pgdat->node_spanned_pages;
+}
+
+static inline bool pgdat_is_empty(pg_data_t *pgdat)
+{
+	return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
+}
 
 #include <linux/memory_hotplug.h>
 
-- 
1.8.0.3

--
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>

  parent reply	other threads:[~2013-01-17 22:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 22:52 [PATCH v2 0/9] mm: zone & pgdat accessors plus some cleanup Cody P Schafer
2013-01-17 22:52 ` Cody P Schafer
2013-01-17 22:52 ` [PATCH 1/9] mm: add SECTION_IN_PAGE_FLAGS Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-02-02  0:20   ` Andrew Morton
2013-02-02  0:20     ` Andrew Morton
2013-02-05 22:23     ` Cody P Schafer
2013-02-05 22:23       ` Cody P Schafer
2013-01-17 22:52 ` [PATCH 2/9] mm: add & use zone_end_pfn() and zone_spans_pfn() Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-01-17 22:52 ` [PATCH 3/9] mm: add zone_is_empty() and zone_is_initialized() Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-01-17 22:52 ` [PATCH 4/9] mm/page_alloc: add a VM_BUG in __free_one_page() if the zone is uninitialized Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-01-17 22:52 ` Cody P Schafer [this message]
2013-01-17 22:52   ` [PATCH 5/9] mmzone: add pgdat_{end_pfn,is_empty}() helpers & consolidate Cody P Schafer
2013-02-02  0:23   ` Andrew Morton
2013-02-02  0:23     ` Andrew Morton
2013-01-17 22:52 ` [PATCH 6/9] mm/page_alloc: add informative debugging message in page_outside_zone_boundaries() Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-02-02  0:28   ` Andrew Morton
2013-02-02  0:28     ` Andrew Morton
2013-02-02  0:29     ` Andrew Morton
2013-02-02  0:29       ` Andrew Morton
2013-02-05 22:20       ` Cody P Schafer
2013-02-05 22:20         ` Cody P Schafer
2013-01-17 22:52 ` [PATCH 7/9] mm: add helper ensure_zone_is_initialized() Cody P Schafer
2013-01-17 22:52   ` Cody P Schafer
2013-01-17 22:53 ` [PATCH 8/9] mm/memory_hotplug: use ensure_zone_is_initialized() Cody P Schafer
2013-01-17 22:53   ` Cody P Schafer
2013-01-17 22:53 ` [PATCH 9/9] mm/memory_hotplug: use pgdat_end_pfn() instead of open coding the same Cody P Schafer
2013-01-17 22:53   ` Cody P Schafer
2013-02-02  0:39 ` [PATCH v2 0/9] mm: zone & pgdat accessors plus some cleanup Andrew Morton
2013-02-02  0:39   ` Andrew Morton
2013-02-05 22:59   ` Cody P Schafer
2013-02-05 22:59     ` Cody P Schafer

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=1358463181-17956-6-git-send-email-cody@linux.vnet.ibm.com \
    --to=cody@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=jmesmon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.