[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 1 Feb 2013 16:23:59 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Cody P Schafer <cody@...ux.vnet.ibm.com>
Cc: Linux MM <linux-mm@...ck.org>,
David Hansen <dave@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Catalin Marinas <catalin.marinas@....com>,
Cody P Schafer <jmesmon@...il.com>
Subject: Re: [PATCH 5/9] mmzone: add pgdat_{end_pfn,is_empty}() helpers &
consolidate.
On Thu, 17 Jan 2013 14:52:57 -0800
Cody P Schafer <cody@...ux.vnet.ibm.com> wrote:
> From: Cody P Schafer <jmesmon@...il.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().
>
> ...
>
> --- 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))
I wonder if these could be implemented in nice C code rather than nasty
cpp code.
> -#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;
> +}
It wouldn't hurt to add a little comment pointing out that this returns
"end pfn plus one", or similar. ie, it is exclusive, not inclusive.
Ditto the "zone_*() functions", if needed.
> +static inline bool pgdat_is_empty(pg_data_t *pgdat)
> +{
> + return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists