On Thu, 2008-01-17 at 16:05 -0800, Andrew Morton wrote:
In that case, pte_unmap is free, pte_offset_map is just a bit of math.
So yeah, we can simplify this. How about:
diff -r 5595adaea70f fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c Thu Jan 17 13:26:54 2008 -0600
+++ b/fs/proc/task_mmu.c Thu Jan 17 18:11:13 2008 -0600
@@ -582,20 +583,20 @@
{
struct pagemapread *pm = private;
pte_t *pte;
- int err = 0;
+ int offset = 0, err = 0;
- pte = pte_offset_map(pmd, addr);
- for (; addr != end; pte++, addr += PAGE_SIZE) {
+ for (; addr != end; offset++, addr += PAGE_SIZE) {
u64 pfn = PM_NOT_PRESENT;
- if (is_swap_pte(*pte))
- pfn = swap_pte_to_pagemap_entry(*pte);
- else if (pte_present(*pte))
- pfn = pte_pfn(*pte);
+ pte = pte_offset_map(pmd, addr);
+ if (is_swap_pte(pte[offset]))
+ pfn = swap_pte_to_pagemap_entry(pte[offset]);
+ else if (pte_present(pte[offset]))
+ pfn = pte_pfn(pte[offset]);
+ pte_unmap(pte);
err = add_to_pagemap(addr, pfn, pm);
if (err)
return err;
}
- pte_unmap(pte - 1);
cond_resched();
--
Mathematics is the supreme nostalgia of our time.
--