Linux-kernel mailing list archive 1999-36,: Re: [patch] 2.3.17-pre1 mem_init [Re: [PATCH] 2.3.15 fancy memory

# Re: [patch] 2.3.17-pre1 mem_init [Re: [PATCH] 2.3.15 fancy memory

list.kernel@iahastie.clara.net
5 Sep 1999 11:10:41 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: list.kernel@iahastie.clara.net: "Re: 2.3.16, ide-scsi cdrom errors on audio CDs"
- Previous message: list.kernel@iahastie.clara.net: "Even more bizarre 2.3.x(x >=15) behavior"

In article <linux.kernel.7qt95f$v65$1@alfie.demon.co.uk>,
Nick Holloway <Nick.Holloway@alfie.demon.co.uk> wrote:
>torvalds@transmeta.com (Linus Torvalds) writes:
>> unsigned long start = e820.map[i].addr;
>> unsigned long end = start + e820.map[i].size;
>>
>> start = PAGE_ALIGN(start) + PAGE_OFFSET;
>> end = (end & PAGE_MASK) + PAGE_OFFSET;
>
>Doesn't this end up wasting 1 page of memory at the start (as PAGE_ALIGN
>already takes you to the next page boundary)?

(I'm not Linux, but...) The entire ia32 universe is shifted PAGE_OFFSET
up from the start of memory. If you don't PAGE_OFFSET, you get some
really hilarious crashes as soon as kswapd needs to swap some pages
out.

Since Linus pointed out that the page whitelisting was, umm, a bit
confusing, I revisited the patch-on-a-patch again and blatantly
ripped off his code. I also got rid of the magic number 1 and
replaced it with a constant, and, in the grand tradition of putting
unrelated things into my patches, upped the printk buffer from 16 to
32k because even with the binfmt_aout spamming turned off my
2.3.17pre1 kernel would overflow the 16k buffer before klogd could
harvest any of it. (Tested on one machine overnight via a 2gb
bonnie run and a couple of kernel rebuilds)

--- linux-2.3.16-orig/include/asm-i386/e820.h Mon Aug 30 10:47:02 1999
+++ linux-2.3.16/include/asm-i386/e820.h Sun Sep 5 10:55:31 1999
@@ -28,6 +28,7 @@
long type; /* type of memory segment */
} map[E820MAX];
};
+#define E820_IS_RAM 1 /* memory region contains usable memory */
extern struct e820map e820;
#endif/*!__ASSEMBLY__*/
--- linux-2.3.16-orig/arch/i386/kernel/setup.c Sun Sep 5 04:03:19 1999
+++ linux-2.3.16/arch/i386/kernel/setup.c Sun Sep 5 10:57:23 1999
@@ -422,8 +422,8 @@
mem_size = (ALT_MEM_K < EXT_MEM_K) ? EXT_MEM_K : ALT_MEM_K;
- add_memory_region(0, LOWMEMSIZE(), 1);
- add_memory_region(HIGH_MEMORY, mem_size << 10, 1);
+ add_memory_region(0, LOWMEMSIZE(), E820_IS_RAM);
+ add_memory_region(HIGH_MEMORY, mem_size << 10, E820_IS_RAM);
}
} /* setup_memory_region */
@@ -503,7 +503,7 @@
*/
e820.nr_map = 0;
usermem = 1;
- add_memory_region(0, LOWMEMSIZE(), 1);
+ add_memory_region(0, LOWMEMSIZE(), E820_IS_RAM);
}
mem_size = memparse(from+4, &from);
if (*from == '@')
@@ -512,7 +512,7 @@
start_at = HIGH_MEMORY;
mem_size -= HIGH_MEMORY;
}
- add_memory_region(start_at, mem_size, 1);
+ add_memory_region(start_at, mem_size, E820_IS_RAM);
}
}
c = *(from++);
@@ -530,12 +530,7 @@
memory_end = 0;
for (i=0; i < e820.nr_map; i++) {
- printk("type=%d, addr=%08x, size=%08x",
- e820.map[i].type,
- e820.map[i].addr,
- e820.map[i].size);
- /* RAM? */
- if (e820.map[i].type == 1) {
+ if (e820.map[i].type == E820_IS_RAM) {
unsigned long end = e820.map[i].addr + e820.map[i].size;
if (end > memory_end)
--- linux-2.3.16-orig/arch/i386/mm/init.c Sun Sep 5 04:01:01 1999
+++ linux-2.3.16/arch/i386/mm/init.c Sun Sep 5 10:58:22 1999
@@ -415,7 +415,7 @@
for (avail = i = 0; i < e820.nr_map; i++) {
unsigned long start, end;
- if (e820.map[i].type != 1) /* not usable memory */
+ if (e820.map[i].type != E820_IS_RAM) /* not usable memory */
continue;
printk("memory region: %luk @ %08lx\n",
((long)(e820.map[i].size)) / 1024,
--- linux-2.3.16-orig/kernel/printk.c Mon Aug 23 11:15:53 1999
+++ linux-2.3.16/kernel/printk.c Sun Sep 5 11:00:06 1999
@@ -22,7 +22,7 @@
#include <asm/uaccess.h>
-#define LOG_BUF_LEN (16384)
+#define LOG_BUF_LEN (32768)
#define LOG_BUF_MASK (LOG_BUF_LEN-1)
static char buf[1024];

____
david parsons \bi/ maybe this will satisfy the boundary conditions.
\/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: list.kernel@iahastie.clara.net: "Re: 2.3.16, ide-scsi cdrom errors on audio CDs"
- Previous message: list.kernel@iahastie.clara.net: "Even more bizarre 2.3.x(x >=15) behavior"