public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com.br>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Olivier Galibert <galibert@limsi.fr>,
	Stephan von Krawczynski <skraw@ithnet.com>,
	neilb@cse.unsw.edu.au,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: experiences beyond 4 GB RAM with 2.4.22
Date: Thu, 18 Sep 2003 09:12:49 +0200	[thread overview]
Message-ID: <20030918071249.GT906@suse.de> (raw)
In-Reply-To: <20030918070845.GS906@suse.de>

On Thu, Sep 18 2003, Jens Axboe wrote:
> On Wed, Sep 17 2003, Marcelo Tosatti wrote:
> > 
> > 
> > On Wed, 17 Sep 2003, Jens Axboe wrote:
> > 
> > > On Wed, Sep 17 2003, Alan Cox wrote:
> > > > On Maw, 2003-09-16 at 20:58, Olivier Galibert wrote:
> > > > > On Tue, Sep 16, 2003 at 04:29:02PM +0100, Alan Cox wrote:
> > > > > > The kernel has no idea what you will do with given ram. It does try to
> > > > > > make some guesses but you are basically trying to paper over hardware
> > > > > > limits.
> > > > > 
> > > > > Is there a way to specifically turn that ram into a tmpfs though?
> > > > 
> > > > 
> > > > Something like z2ram copied and hacked a little to kmap the blocks it
> > > > wants would give you a block device you could use for swap or for /tmp.
> > > > Im not sure tmpfs would work here
> > > 
> > > Aditionally, you need GFP_DMA32 or similar. Would also alleviate the
> > > nasty pressure on ZONE_NORMAL which is often quite stressed.
> > 
> > IMO such GFP_DMA32 flag is a bit intrusive for 2.4, isnt it?
> 
> Not really, it's just an extra zone. Maybe I can dig such a patch up, I
> had one for 2.4.2-pre something...

This is the latest I had, for 2.4.5. Pretty simple and nonintrusive at
that time.

diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.5/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- /opt/kernel/linux-2.4.5/arch/i386/mm/init.c	Sat Apr 21 01:15:20 2001
+++ linux/arch/i386/mm/init.c	Sun May 27 17:50:26 2001
@@ -25,6 +25,7 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/bootmem.h>
+#include <linux/pci.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -348,12 +349,15 @@
 	kmap_init();
 #endif
 	{
-		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
-		unsigned int max_dma, high, low;
+		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0, 0};
+		unsigned int max_dma, max_dma32, high, low, high32;
 
 		max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+		max_dma32 = PCI_MAX_DMA32 >> PAGE_SHIFT;
 		low = max_low_pfn;
-		high = highend_pfn;
+		high32 = high = highend_pfn;
+		if (high32 > max_dma32)
+			high32 = max_dma32 + 1;	/* first map in HIGHMEM */
 
 		if (low < max_dma)
 			zones_size[ZONE_DMA] = low;
@@ -361,12 +365,12 @@
 			zones_size[ZONE_DMA] = max_dma;
 			zones_size[ZONE_NORMAL] = low - max_dma;
 #ifdef CONFIG_HIGHMEM
-			zones_size[ZONE_HIGHMEM] = high - low;
+			zones_size[ZONE_DMA32] = high32 - low;
+			zones_size[ZONE_HIGHMEM] = high - high32;
 #endif
 		}
 		free_area_init(zones_size);
 	}
-	return;
 }
 
 /*
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.5/include/linux/mm.h linux/include/linux/mm.h
--- /opt/kernel/linux-2.4.5/include/linux/mm.h	Sat May 26 13:30:50 2001
+++ linux/include/linux/mm.h	Tue May 29 15:46:02 2001
@@ -476,8 +476,10 @@
 #define __GFP_IO	0x04
 #define __GFP_DMA	0x08
 #ifdef CONFIG_HIGHMEM
-#define __GFP_HIGHMEM	0x10
+#define __GFP_DMA32	0x10
+#define __GFP_HIGHMEM	0x20
 #else
+#define __GFP_DMA32	0x0 /* noop */
 #define __GFP_HIGHMEM	0x0 /* noop */
 #endif
 
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.5/include/linux/mmzone.h linux/include/linux/mmzone.h
--- /opt/kernel/linux-2.4.5/include/linux/mmzone.h	Sat May 26 13:30:50 2001
+++ linux/include/linux/mmzone.h	Sun May 27 18:26:59 2001
@@ -27,7 +27,8 @@
  *
  * ZONE_DMA	  < 16 MB	ISA DMA capable memory
  * ZONE_NORMAL	16-896 MB	direct mapped by the kernel
- * ZONE_HIGHMEM	 > 896 MB	only page cache and user processes
+ * ZONE_DMA32	> 892MB < 4GB	For 32-bit DMA
+ * ZONE_HIGHMEM	> 4GB		only page cache and user processes
  */
 typedef struct zone_struct {
 	/*
@@ -62,8 +63,9 @@
 
 #define ZONE_DMA		0
 #define ZONE_NORMAL		1
-#define ZONE_HIGHMEM		2
-#define MAX_NR_ZONES		3
+#define ZONE_DMA32		2
+#define ZONE_HIGHMEM		3
+#define MAX_NR_ZONES		4
 
 /*
  * One allocation request operates on a zonelist. A zonelist
@@ -81,7 +83,7 @@
 	int gfp_mask;
 } zonelist_t;
 
-#define NR_GFPINDEX		0x20
+#define NR_GFPINDEX		0x40
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
diff -ur --exclude-from /home/axboe/exclude /opt/kernel/linux-2.4.5/mm/page_alloc.c linux/mm/page_alloc.c
--- /opt/kernel/linux-2.4.5/mm/page_alloc.c	Sat May 26 13:30:50 2001
+++ linux/mm/page_alloc.c	Sun May 27 23:47:22 2001
@@ -598,6 +598,7 @@
 
 	while (pgdat) {
 		pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
+		pages += pgdat->node_zones[ZONE_DMA32].free_pages;
 		pgdat = pgdat->node_next;
 	}
 	return pages;
@@ -683,6 +684,8 @@
 		k = ZONE_NORMAL;
 		if (i & __GFP_HIGHMEM)
 			k = ZONE_HIGHMEM;
+		if (i & __GFP_DMA32)
+			k = ZONE_DMA32;
 		if (i & __GFP_DMA)
 			k = ZONE_DMA;
 
@@ -700,6 +703,14 @@
 #endif
 					zonelist->zones[j++] = zone;
 				}
+			case ZONE_DMA32:
+				zone = pgdat->node_zones + ZONE_DMA32;
+				if (zone->size) {
+#ifndef CONFIG_HIGHMEM
+					BUG();
+#endif
+					zonelist->zones[j++] = zone;
+				}
 			case ZONE_NORMAL:
 				zone = pgdat->node_zones + ZONE_NORMAL;
 				if (zone->size)
@@ -833,8 +844,11 @@
 		for (i = 0; i < size; i++) {
 			struct page *page = mem_map + offset + i;
 			page->zone = zone;
-			if (j != ZONE_HIGHMEM)
+			if (j != ZONE_HIGHMEM && j != ZONE_DMA32) {
 				page->virtual = __va(zone_start_paddr);
+			} else
+				page->virtual = NULL;
+
 			zone_start_paddr += PAGE_SIZE;
 		}
 

-- 
Jens Axboe


  reply	other threads:[~2003-09-18  7:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-09  9:01 experiences beyond 4 GB RAM with 2.4.22 Stephan von Krawczynski
2003-09-09 12:25 ` Andrea Arcangeli
2003-09-12  2:46 ` Neil Brown
2003-09-12  6:54   ` Stephan von Krawczynski
2003-09-12  7:11     ` Jens Axboe
2003-09-12  7:53     ` Mike Fedyk
2003-09-15 22:01     ` Marcelo Tosatti
2003-09-16  8:21       ` Stephan von Krawczynski
2003-09-16 12:05         ` Stephan von Krawczynski
2003-09-16 13:11         ` Marcelo Tosatti
2003-09-16 13:36           ` Stephan von Krawczynski
2003-09-16 13:55             ` Richard B. Johnson
2003-09-16 14:13               ` Stephan von Krawczynski
2003-09-16 14:33             ` Marcelo Tosatti
2003-09-16 14:36               ` Stephan von Krawczynski
2003-09-16 14:36             ` Alan Cox
2003-09-16 15:20               ` Stephan von Krawczynski
2003-09-16 15:29                 ` Alan Cox
2003-09-16 15:49                   ` Timothy Miller
2003-09-16 16:17                     ` Stephan von Krawczynski
2003-09-16 19:58                   ` Olivier Galibert
2003-09-17 15:10                     ` Alan Cox
2003-09-17 19:19                       ` Jens Axboe
2003-09-17 19:30                         ` Marcelo Tosatti
2003-09-17 22:18                           ` Stephan von Krawczynski
2003-09-18  7:08                           ` Jens Axboe
2003-09-18  7:12                             ` Jens Axboe [this message]
2003-09-18 11:22                               ` Stephan von Krawczynski
2003-09-18 15:05                             ` William Lee Irwin III
2003-09-16 17:10               ` Pavel Machek
2003-09-16 19:53                 ` Olivier Galibert
2003-09-16 20:04                   ` Pavel Machek
2003-09-16 21:16                   ` Marcelo Tosatti
2003-09-16 21:23                     ` Olivier Galibert
2003-09-17 11:14                       ` Stephan von Krawczynski
2003-09-17 13:08                         ` Olivier Galibert
2003-09-18  9:58                           ` Olivier Galibert
2003-09-18 10:13                             ` Stephan von Krawczynski
2003-09-18 11:22                               ` Olivier Galibert
2003-09-17  6:41               ` Rogier Wolff
2003-09-17 10:26                 ` Jens Axboe
2003-09-17 10:42                   ` Rogier Wolff
2003-09-17 10:53                     ` Jens Axboe
2003-09-17 19:19                   ` Pavel Machek
2003-09-18 11:39                     ` Rogier Wolff
2003-09-18 12:13                       ` Rogier Wolff
2003-09-16 15:22             ` Timothy Miller
2003-09-16 15:29             ` Martin J. Bligh

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=20030918071249.GT906@suse.de \
    --to=axboe@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=galibert@limsi.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com.br \
    --cc=neilb@cse.unsw.edu.au \
    --cc=skraw@ithnet.com \
    /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