Commit a6bc080d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Use mark_page_accessed() in follow_page()

Touching a page via follow_page() counts as a reference so we should be
either setting the referenced bit in the pte or running mark_page_accessed().

Altering the pte is tricky because we haven't implemented an atomic
pte_mkyoung().  And mark_page_accessed() is better anyway because it has more
aging state: it can move the page onto the active list.
parent 597536e3
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
* ->swap_list_lock * ->swap_list_lock
* ->swap_device_lock (exclusive_swap_page, others) * ->swap_device_lock (exclusive_swap_page, others)
* ->mapping->page_lock * ->mapping->page_lock
*
* ->mmap_sem * ->mmap_sem
* ->i_shared_sem (various places) * ->i_shared_sem (various places)
* *
...@@ -69,10 +70,12 @@ ...@@ -69,10 +70,12 @@
* ->inode_lock * ->inode_lock
* ->sb_lock (fs/fs-writeback.c) * ->sb_lock (fs/fs-writeback.c)
* ->mapping->page_lock (__sync_single_inode) * ->mapping->page_lock (__sync_single_inode)
*
* ->page_table_lock * ->page_table_lock
* ->swap_device_lock (try_to_unmap_one) * ->swap_device_lock (try_to_unmap_one)
* ->private_lock (try_to_unmap_one) * ->private_lock (try_to_unmap_one)
* ->page_lock (try_to_unmap_one) * ->page_lock (try_to_unmap_one)
* ->zone.lru_lock (follow_page->mark_page_accessed)
*/ */
/* /*
......
...@@ -646,8 +646,12 @@ follow_page(struct mm_struct *mm, unsigned long address, int write) ...@@ -646,8 +646,12 @@ follow_page(struct mm_struct *mm, unsigned long address, int write)
if (pte_present(pte)) { if (pte_present(pte)) {
if (!write || (pte_write(pte) && pte_dirty(pte))) { if (!write || (pte_write(pte) && pte_dirty(pte))) {
pfn = pte_pfn(pte); pfn = pte_pfn(pte);
if (pfn_valid(pfn)) if (pfn_valid(pfn)) {
return pfn_to_page(pfn); struct page *page = pfn_to_page(pfn);
mark_page_accessed(page);
return page;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment