mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: linux-kernel@vger.kernel.org
Cc: "Jose R. Santos" <jrsantos@austin.ibm.com>,
	David Howells <dhowells@redhat.com>
Subject: Re: 2.6.8-rc1-mm1
Date: Wed, 14 Jul 2004 00:29:12 -0700	[thread overview]
Message-ID: <20040714002912.26ed0e66.akpm@osdl.org> (raw)
In-Reply-To: <20040713182559.7534e46d.akpm@osdl.org>

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

  reply	other threads:[~2004-07-14  7:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-14  1:25 2.6.8-rc1-mm1 Andrew Morton
2004-07-14  7:29 ` Andrew Morton [this message]
2004-07-14  8:11 ` 2.6.8-rc1-mm1 David Howells
2004-07-14 16:36 ` 2.6.8-rc1-mm1 John Cherry
2004-07-14 18:49 ` [patch] 2.6.8-rc1-mm1: USB w9968cf compile error Adrian Bunk
2004-07-14 19:03   ` Greg KH
2004-07-14 19:08   ` Adrian Bunk
2004-07-14 20:29 ` 2.6.8-rc1-mm1 Dominik Karall
2004-07-14 20:43   ` [patch] 2.6.8-rc1-mm1: 8139too: uninline rtl8139_start_thread Adrian Bunk
2004-07-14 20:45     ` Jeff Garzik
2004-07-27 18:00     ` Jeff Garzik
2004-07-14 21:08 ` 2.6.8-rc1-mm1 Dominik Karall
2004-07-14 21:53 ` 2.6.8-rc1-mm1 Tim Bird
2004-07-15 10:35 ` 2.6.8-rc1-mm1 Ralf Hildebrandt
2004-07-18  3:53 ` [patch] 2.6.8-rc1-mm1: work around broken USB DocBook generation Adrian Bunk
2004-07-20  0:02 ` 2.6.8-rc1-mm1 J.A. Magallon
2004-07-22 12:56   ` 2.6.8-rc1-mm1 Jens Axboe
2004-07-20  0:05 ` 2.6.8-rc1-mm1 J.A. Magallon
2004-07-15  3:33 2.6.8-rc1-mm1 Diffie

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=20040714002912.26ed0e66.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=jrsantos@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome