linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* sparc64: Fix NR_PAGEFLAGS check V2
@ 2008-04-14 18:40 Christoph Lameter
  2008-04-14 21:33 ` David Miller, Christoph Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Lameter @ 2008-04-14 18:40 UTC (permalink / raw)
  To: akpm; +Cc: David S. Miller, linux-mm

Update checks to make sure that we can place the cpu number in the
upper portion of the page flags.

Its okay if we use less than 32 page flags. There can only be a problem if
the page flags grow beyond 32 bits to reach into the area reserved for the
cpu number.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 arch/sparc64/mm/init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.25-rc8-mm2/arch/sparc64/mm/init.c
===================================================================
--- linux-2.6.25-rc8-mm2.orig/arch/sparc64/mm/init.c	2008-04-11 19:21:24.000000000 -0700
+++ linux-2.6.25-rc8-mm2/arch/sparc64/mm/init.c	2008-04-11 19:26:00.000000000 -0700
@@ -1300,10 +1300,21 @@
 	 * functions like clear_dcache_dirty_cpu use the cpu mask
 	 * in 13-bit signed-immediate instruction fields.
 	 */
-	BUILD_BUG_ON(BITS_PER_LONG - NR_PAGEFLAGS != 32);
+
+	/*
+	 * Page flags must not reach into upper 32 bits that are used
+	 * for the cpu number
+	 */
+	BUILD_BUG_ON(NR_PAGEFLAGS > 32);
+
+	/*
+	 * The bit fields placed in the high range must not reach below
+	 * the 32 bit boundary. Otherwise we cannot place the cpu field
+	 * at the 32 bit boundary.
+	 */
 	BUILD_BUG_ON(SECTIONS_WIDTH + NODES_WIDTH + ZONES_WIDTH +
-		ilog2(roundup_pow_of_two(NR_CPUS)) >
-				BITS_PER_LONG - NR_PAGEFLAGS);
+		ilog2(roundup_pow_of_two(NR_CPUS)) > 32);
+
 	BUILD_BUG_ON(NR_CPUS > 4096);
 
 	kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sparc64: Fix NR_PAGEFLAGS check V2
  2008-04-14 18:40 sparc64: Fix NR_PAGEFLAGS check V2 Christoph Lameter
@ 2008-04-14 21:33 ` David Miller, Christoph Lameter
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller, Christoph Lameter @ 2008-04-14 21:33 UTC (permalink / raw)
  To: clameter; +Cc: akpm, linux-mm

> Update checks to make sure that we can place the cpu number in the
> upper portion of the page flags.
> 
> Its okay if we use less than 32 page flags. There can only be a problem if
> the page flags grow beyond 32 bits to reach into the area reserved for the
> cpu number.
> 
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>

Acked-by: David S. Miller <davem@davemloft.net>

Looks good.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-14 21:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 18:40 sparc64: Fix NR_PAGEFLAGS check V2 Christoph Lameter
2008-04-14 21:33 ` David Miller, Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).