[PATCH] follow_page invalid pte_page
From: Hugh Dickins
Date: Wed Jun 02 2004 - 15:08:26 EST
The follow_page write-access case is relying on pte_page before checking
pfn_valid: rearrange that - and we don't need three struct page *pages.
(I notice mempolicy.c's verify_pages is also relying on pte_page, but
I'll leave that to Andi: maybe it ought to be failing on, or skipping
over, VM_IO or VM_RESERVED vmas?)
Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
mm/memory.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
--- 2.6.7-rc2/mm/memory.c 2004-05-30 11:36:39.000000000 +0100
+++ linux/mm/memory.c 2004-06-02 16:31:33.037399304 +0100
@@ -637,15 +637,11 @@ follow_page(struct mm_struct *mm, unsign
if (pte_present(pte)) {
if (write && !pte_write(pte))
goto out;
- if (write && !pte_dirty(pte)) {
- struct page *page = pte_page(pte);
- if (!PageDirty(page))
- set_page_dirty(page);
- }
pfn = pte_pfn(pte);
if (pfn_valid(pfn)) {
- struct page *page = pfn_to_page(pfn);
-
+ page = pfn_to_page(pfn);
+ if (write && !pte_dirty(pte) && !PageDirty(page))
+ set_page_dirty(page);
mark_page_accessed(page);
return page;
}
-
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/