[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
adding symetric test case for change_page_attr
Hi,
This is just a suggested patch for arch/i386/mm/pageattr.c
I was fooled into thinking that there was a problem with caching using
change_page_attr(virt_to_page(address),1,PAGE_KERNEL);
because if the page is already PAGE_KERNEL, it incorrectly decrements
the count field.
In the case of using
change_page_attr(virt_to_page(address),1,PAGE_KERNEL_NOCACHE);
if the page is already not cached, the count is handled correctly.
The patch applies the same logic for the symmetric case.
The same logic should be used in the other architectures to prevent this
problem.
morrow
*** pageattr.c.orig 2004-12-21 15:29:35.000000000 -0700
--- pageattr.c 2004-12-21 15:41:53.000000000 -0700
***************
*** 130,137 ****
set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL));
}
} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) {
! set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
! __put_page(kpte_page);
}
if (cpu_has_pse && (page_count(kpte_page) == 1)) {
--- 130,141 ----
set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL));
}
} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) {
! pte_t old = *kpte;
! pte_t standard = mk_pte(page, PAGE_KERNEL);
! if (!pte_same(old,standard)) {
! set_pte_atomic(kpte, standard);
! __put_page(kpte_page);
! }
}
if (cpu_has_pse && (page_count(kpte_page) == 1)) {