LWN.net Logo

Re: 2.6.8-rc1-mm1

From:  Andrew Morton <akpm-AT-osdl.org>
To:  linux-kernel-AT-vger.kernel.org
Subject:  Re: 2.6.8-rc1-mm1
Date:  Wed, 14 Jul 2004 00:29:12 -0700
Cc:  "Jose R. Santos" <jrsantos-AT-austin.ibm.com>, David Howells <dhowells-AT-redhat.com>

Andrew Morton <akpm@osdl.org> wrote:
>
> 
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.8-rc1/2.6.8-rc1-mm1/
>

This kernel runs like a dessicated slug if you have more than 2G of memory
due to a 32-bit overflow.

Dentry cache hash table entries: 1 (order: -10, 4 bytes)
Inode-cache hash table entries: 1 (order: -10, 4 bytes)

The dcache is a singly-linked list.  Here's a (lame) fix:


--- 25/mm/page_alloc.c~making-i-dhash_entries-cmdline-work-as-it-use-to-fix	2004-07-14 00:11:26.437028752 -0700
+++ 25-akpm/mm/page_alloc.c	2004-07-14 00:24:56.461886256 -0700
@@ -2004,7 +2004,8 @@ void *__init alloc_large_system_hash(con
 				     unsigned int *_hash_shift,
 				     unsigned int *_hash_mask)
 {
-	unsigned long max, log2qty, size;
+	unsigned long long max;
+	unsigned long log2qty, size;
 	void *table;
 
 	/* allow the kernel cmdline to have a say */
@@ -2025,18 +2026,19 @@ void *__init alloc_large_system_hash(con
 	numentries = 1UL << (long_log2(numentries) + 1);
 
 	/* limit allocation size to 1/16 total memory */
-	max = ((nr_all_pages << PAGE_SHIFT)/16) / bucketsize;
+	max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4;
+	do_div(max, bucketsize);
 
 	if (numentries > max)
 		numentries = max;
 
 	log2qty = long_log2(numentries);
 
+	size = bucketsize << log2qty;
 	do {
-		size = bucketsize << log2qty;
-
-		table = (void *) alloc_bootmem(size);
-
+		table = alloc_bootmem(size);
+		if (!table)
+			size /= 2;
 	} while (!table && size > PAGE_SIZE);
 
 	if (!table)
_



btw, David, I'm wondering about this loop:

	do {
		size = bucketsize << log2qty;

		table = (void *) alloc_bootmem(size);

	} while (!table && size > PAGE_SIZE);

Is this a busy-wait-until-someone-plugs-in-more-ram-chips thing? ;)

I assume you meant something like the above?

btw, that (void *) cast was superfluous...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


(Log in to post comments)

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds