提交 308c05e3 编写于 作者: C Christoph Lameter 提交者: Linus Torvalds

sparsemem: vmemmap does not need section bits

A set of patches that attempts to improve page flag handling.  First of all a
method is introduced to generate the page flag functions using macros.  Then
the number of page flags used by sparsemem is reduced.  All page flag
operations will no longer be macros.  All flags will use inline function.

Then we add a way to export enum constants to the preprocessor which allows us
to get rid of __ZONE_COUNT and use the NR_PAGEFLAGS for the dynamic
calculation of actually available page flags for fields.

This patch:

Sparsemem vmemmap does not need any section bits.  This patch has the effect
of reducing the number of bits used in page->flags by at least 6.
Signed-off-by: NChristoph Lameter <clameter@sgi.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 23016969
...@@ -395,11 +395,11 @@ static inline void set_compound_order(struct page *page, unsigned long order) ...@@ -395,11 +395,11 @@ static inline void set_compound_order(struct page *page, unsigned long order)
* we have run out of space and have to fall back to an * we have run out of space and have to fall back to an
* alternate (slower) way of determining the node. * alternate (slower) way of determining the node.
* *
* No sparsemem: | NODE | ZONE | ... | FLAGS | * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
* with space for node: | SECTION | NODE | ZONE | ... | FLAGS | * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
* no space for node: | SECTION | ZONE | ... | FLAGS | * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
*/ */
#ifdef CONFIG_SPARSEMEM #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
#define SECTIONS_WIDTH SECTIONS_SHIFT #define SECTIONS_WIDTH SECTIONS_SHIFT
#else #else
#define SECTIONS_WIDTH 0 #define SECTIONS_WIDTH 0
...@@ -410,6 +410,9 @@ static inline void set_compound_order(struct page *page, unsigned long order) ...@@ -410,6 +410,9 @@ static inline void set_compound_order(struct page *page, unsigned long order)
#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED
#define NODES_WIDTH NODES_SHIFT #define NODES_WIDTH NODES_SHIFT
#else #else
#ifdef CONFIG_SPARSEMEM_VMEMMAP
#error "Vmemmap: No space for nodes field in page flags"
#endif
#define NODES_WIDTH 0 #define NODES_WIDTH 0
#endif #endif
...@@ -502,10 +505,12 @@ static inline struct zone *page_zone(struct page *page) ...@@ -502,10 +505,12 @@ static inline struct zone *page_zone(struct page *page)
return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
} }
#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
static inline unsigned long page_to_section(struct page *page) static inline unsigned long page_to_section(struct page *page)
{ {
return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
} }
#endif
static inline void set_page_zone(struct page *page, enum zone_type zone) static inline void set_page_zone(struct page *page, enum zone_type zone)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册