patch-2.4.26.bz2, it wastes unnecessary 2 TIMES get_one_pte(mm, old_addr);

From: jc-nospam
Date: Wed Apr 14 2004 - 16:16:02 EST


Hi ;)

>From mm/mremap.c of patch-2.4.26.bz2: "It wastes unnecessary 2 TIMES
get_one_pte(mm, old_addr);"

diff -urN linux-2.4.25/mm/mremap.c linux-2.4.26/mm/mremap.c
--- linux-2.4.25/mm/mremap.c 2004-02-18 05:36:32.000000000 -0800
+++ linux-2.4.26/mm/mremap.c 2004-04-14 06:05:41.000000000 -0700
@@ -77,12 +77,16 @@
static int move_one_page(struct mm_struct *mm, unsigned long old_addr, unsigned
long new_addr)
{
int error = 0;
- pte_t * src;
+ pte_t * src, * dst;

spin_lock(&mm->page_table_lock);
src = get_one_pte(mm, old_addr);
- if (src)
- error = copy_one_pte(mm, src, alloc_one_pte(mm, new_addr));
+ if (src) {
+ dst = alloc_one_pte(mm, new_addr);
+ src = get_one_pte(mm, old_addr);
+ if (src)
+ error = copy_one_pte(mm, src, dst);
+ }
spin_unlock(&mm->page_table_lock);
return error;
}

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