Re: [PATCH 1/5] freepgt: free_pgtables use vma list

David S. Miller
2005-03-23T00:09:13Z

Ok, this patch, on top of Hugh's original freepgt patch, gets
me a working system. It includes Hugh's bug fix, plus the
ceiling masking roll-over fix of mine.

It should get ppc working too, I bet.

--- mm/memory.c.hugh 2005-03-22 16:01:07.000000000 -0800
+++ mm/memory.c 2005-03-22 16:00:08.000000000 -0800
@@ -127,11 +127,6 @@
unsigned long next;
unsigned long start;

- if (end - 1 > ceiling - 1)
- end -= PMD_SIZE;
- if (addr > end - 1)
- return;
-
start = addr;
pmd = pmd_offset(pud, addr);
do {
@@ -144,7 +139,11 @@
start &= PUD_MASK;
if (start < floor)
return;
- ceiling &= PUD_MASK;
+ if (ceiling) {
+ ceiling &= PUD_MASK;
+ if (!ceiling)
+ return;
+ }
if (end - 1 > ceiling - 1)
return;

@@ -173,7 +172,11 @@
start &= PGDIR_MASK;
if (start < floor)
return;
- ceiling &= PGDIR_MASK;
+ if (ceiling) {
+ ceiling &= PGDIR_MASK;
+ if (!ceiling)
+ return;
+ }
if (end - 1 > ceiling - 1)
return;

@@ -201,8 +204,14 @@
if (!addr)
return;
}
- ceiling &= PMD_MASK;
- if (addr > ceiling - 1)
+ if (ceiling) {
+ ceiling &= PMD_MASK;
+ if (!ceiling)
+ return;
+ }
+ if (end - 1 > ceiling - 1)
+ end -= PMD_SIZE;
+ if (addr > end - 1)
return;

start = addr;
@@ -214,7 +223,7 @@
free_pud_range(tlb, pgd, addr, next, floor, ceiling);
} while (pgd++, addr = next, addr != end);

- if (!tlb_is_full_mm(tlb) && start < end)
+ if (!tlb_is_full_mm(tlb))
flush_tlb_pgtables(tlb->mm, start, end);
}