From: Andy Whitcroft <apw@shadowen.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: Andrew Morton <akpm@osdl.org>,
linux-mm@kvack.org, Andy Whitcroft <apw@shadowen.org>,
Dave Hansen <haveblue@us.ibm.com>
Subject: [PATCH] zoneid fix up calculations for ZONEID_PGSHIFT
Date: Fri, 6 Oct 2006 15:45:35 +0100 [thread overview]
Message-ID: <20061006144535.GA18583@shadowen.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0610021008510.12554@schroedinger.engr.sgi.com>
Ok, it seems the sensible thing is to actually calculate
ZONEID_PGSHIFT and ZONEID_SHIFT off of the actual fields we want
it to contain. The id is either the NODE,ZONE or the SECTION,ZONE
depending on whats available. For each field we have the location
of its right hand edge. The right hand edge of the combined field
is the lower of the two. It is possible for there to be no bits
in our identifier in the non-numa single zone case, so we also need
to take the overall width being zero (to avoid a shift error).
I think the following should do the trick. I've tested this outside
the kernel in all the combinations I could think of and it seems to
do the right thing. I've build tested on a few machines, but there
seems to be so many unrelated problems about with 2.6.19-mm3 that
I've not tested it as extensivly as I might prefer.
How does this look, against 2.6.19-mm3.
-apw
=== 8< ===
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>
---
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d9d0b46..98ed057 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -418,15 +418,15 @@ #define ZONES_PGSHIFT (ZONES_PGOFF * (Z
/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */
#ifdef NODE_NOT_IN_PAGEFLAGS
#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
+#define ZONEID_PGOFF ((SECTIONS_PGOFF < ZONES_PGOFF)? \
+ SECTIONS_PGOFF : ZONES_PGOFF)
#else
#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT)
+#define ZONEID_PGOFF ((NODES_PGOFF < ZONES_PGOFF)? \
+ NODES_PGOFF : ZONES_PGOFF)
#endif
-#if ZONES_WIDTH > 0
-#define ZONEID_PGSHIFT ZONES_PGSHIFT
-#else
-#define ZONEID_PGSHIFT NODES_PGOFF
-#endif
+#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
@@ -452,7 +452,6 @@ static inline enum zone_type page_zonenu
*/
static inline int page_zone_id(struct page *page)
{
- BUILD_BUG_ON(ZONEID_PGSHIFT == 0 && ZONEID_MASK);
return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
}
--
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:[~2006-10-06 14:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 19:21 [PATCH] Get rid of zone_table V2 Christoph Lameter
2006-09-18 20:28 ` Andrew Morton
2006-09-18 22:51 ` Christoph Lameter
2006-09-18 23:15 ` Andrew Morton
2006-09-18 23:46 ` Christoph Lameter
2006-09-18 23:58 ` Andrew Morton
2006-09-19 0:08 ` Christoph Lameter
2006-09-19 0:14 ` Christoph Lameter
2006-09-19 0:31 ` Andrew Morton
2006-09-19 1:20 ` Christoph Lameter
2006-09-19 6:12 ` Christoph Lameter
2006-09-19 6:33 ` Andrew Morton
2006-09-19 14:10 ` Christoph Lameter
2006-09-19 15:38 ` Andrew Morton
2006-09-19 15:41 ` Christoph Lameter
2006-09-19 16:23 ` Nick Piggin
2006-09-19 16:45 ` Nick Piggin
2006-09-19 17:50 ` Christoph Lameter
2006-09-19 18:24 ` Andi Kleen
2006-09-19 16:17 ` Nick Piggin
2006-09-24 10:06 ` Andrew Morton
2006-09-24 16:58 ` Christoph Lameter
2006-09-27 9:19 ` Andrew Morton
2006-09-27 9:26 ` Andy Whitcroft
2006-09-27 11:23 ` [PATCH] zone table removal miss merge Andy Whitcroft
2006-09-27 16:19 ` Christoph Lameter
2006-09-27 11:27 ` [PATCH] Get rid of zone_table V2 Andy Whitcroft
2006-09-27 16:24 ` Andrew Morton
2006-09-30 18:47 ` Christoph Lameter
2006-09-30 18:48 ` Christoph Lameter
2006-09-30 20:08 ` Andrew Morton
2006-10-02 15:57 ` Christoph Lameter
2006-10-02 17:10 ` Christoph Lameter
2006-10-04 10:10 ` Andy Whitcroft
2006-10-06 14:45 ` Andy Whitcroft [this message]
2006-10-06 17:00 ` [PATCH] zoneid fix up calculations for ZONEID_PGSHIFT Christoph Lameter
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=20061006144535.GA18583@shadowen.org \
--to=apw@shadowen.org \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=haveblue@us.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox