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

Andrea Arcangeli (andrea@suse.de)
Sat, 4 Sep 1999 18:56:38 +0200 (CEST)


On 30 Aug 1999, david parsons wrote:

>fixed now. This patch should simply work, with no fuss, muss, or
>bother.

You PAGE_ALIGN the starting address without decreasing the size of the
area so you may end adding one page of non-memory to the freelist.

Fix against 2.3.17-pre1:

--- 2.3.17-pre1/arch/i386/mm/init.c Wed Sep 1 09:29:44 1999
+++ 2.3.17-pre1-d117/arch/i386/mm/init.c Sat Sep 4 17:50:38 1999
@@ -375,7 +375,7 @@
int datapages = 0;
int initpages = 0;
unsigned long tmp;
- unsigned long addr;
+ unsigned long addr, size;
int i, avail;

end_mem &= PAGE_MASK;
@@ -415,14 +415,17 @@
for (avail = i = 0; i < e820.nr_map; i++) {
if (e820.map[i].type != 1) /* not usable memory */
continue;
+
+ /* honour page alignment */
+ addr = e820.map[i].addr;
+ size = e820.map[i].size;
+ size -= PAGE_ALIGN(addr) - addr;
+ addr = PAGE_ALIGN(addr) + PAGE_OFFSET;
+ size >>= PAGE_SHIFT;
+
printk("memory region: %luk @ %08lx\n",
- ((long)(e820.map[i].size)) / 1024,
- (long)(e820.map[i].addr) );
- for (addr=PAGE_ALIGN(((long)(e820.map[i].addr)))+PAGE_OFFSET,
- tmp = 0;
- tmp < (unsigned long)(e820.map[i].size);
- tmp += PAGE_SIZE,
- addr += PAGE_SIZE) {
+ size << (PAGE_SHIFT-10), addr);
+ for (tmp = 0; tmp < size; tmp++, addr += PAGE_SIZE) {

/* this little bit of grossness is for dealing
* with memory borrowing for system bookkeeping

Andrea

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