aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2007-02-10 04:43:14 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:19 -0500
commitbd8029b66069d29fd02c304599411ca9bb7fa38c (patch)
tree2b4088813f060afc40c00ac668c2c3d183e156ad
parent5ac6da669e2476dbdac89b357b05b5a79bc5b657 (diff)
[PATCH] zoneid: fix up calculations for ZONEID_PGSHIFT
Currently if we have a non-zero ZONES_SHIFT we assume we are able to rely on that as the bottom edge of the ZONEID, if not then we use the NODES_PGOFF as the right end of either NODES _or_ SECTION. This latter is more luck than judgement and would be incorrect if we reordered the SECTION,NODE,ZONE options in the fields space. Really what we want is the lower of the right hand end of the two fields we are using (either NODE,ZONE or SECTION,ZONE). Codify that explicitly. As always allow for there being no bits in either of the fields, such as might be valid in a non-numa machine with only a zone NORMAL. I have checked that the compiler is still able to constant fold all of this away correctly. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Acked-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mm.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bb793a4c8e9e..26adfcc0d61a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -437,15 +437,15 @@ static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
437/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */ 437/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */
438#ifdef NODE_NOT_IN_PAGEFLAGS 438#ifdef NODE_NOT_IN_PAGEFLAGS
439#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) 439#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
440#define ZONEID_PGOFF ((SECTIONS_PGOFF < ZONES_PGOFF)? \
441 SECTIONS_PGOFF : ZONES_PGOFF)
440#else 442#else
441#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT) 443#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT)
444#define ZONEID_PGOFF ((NODES_PGOFF < ZONES_PGOFF)? \
445 NODES_PGOFF : ZONES_PGOFF)
442#endif 446#endif
443 447
444#if ZONES_WIDTH > 0 448#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
445#define ZONEID_PGSHIFT ZONES_PGSHIFT
446#else
447#define ZONEID_PGSHIFT NODES_PGOFF
448#endif
449 449
450#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 450#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
451#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 451#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
@@ -471,7 +471,6 @@ static inline enum zone_type page_zonenum(struct page *page)
471 */ 471 */
472static inline int page_zone_id(struct page *page) 472static inline int page_zone_id(struct page *page)
473{ 473{
474 BUILD_BUG_ON(ZONEID_PGSHIFT == 0 && ZONEID_MASK);
475 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; 474 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
476} 475}
477 476