mm: trivial mark_page_accessed() cleanup
PATCH 1/1 mm: trivial mark_page_accessed() cleanup
This avoids duplicated PageReferenced() calls.
No behavior change.
Signed-off-by Fengguang Wu <[email protected]>
--- mm/swap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
mm/swap.c +9 -5
@@ -373,9 +373,15 @@ void mark_page_accessed(struct page *page) page =compound_head (page);inc_node_page_state (page,NR_ACCESSED ); -if (!PageActive (page) && !PageUnevictable (page) && -PageReferenced (page)) { - +if (!PageReferenced (page)) { +SetPageReferenced (page); + }else if (PageUnevictable (page)) { +/* +* Unevictable pages are on the "LRU_UNEVICTABLE" list. But, +* this list is never rotated or maintained, so marking an +* evictable page accessed has no effect. +*/ + }else if (!PageActive (page)) {/* * If the page is on the LRU, queue it for activation via * activate_page_pvecs. Otherwise, assume the page is on a
@@ -389,8 +395,6 @@ void mark_page_accessed(struct page *page)ClearPageReferenced (page);if (page_is_file_cache (page))workingset_activation (page); - }else if (!PageReferenced (page)) { -SetPageReferenced (page); }if (page_is_idle (page))clear_page_idle (page);
Signature · 1 line
2.7.4
Quoted 4 lines · Fengguang Wu
This avoids duplicated
PageReferenced()calls.
No behavior change.Signed-off-by Fengguang Wu <[email protected]>
Acked-by Vlastimil Babka <[email protected]>
Quoted 37 lines
--- mm/swap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)mm/swap.c +9
-5@@ -373,9 +373,15 @@ void mark_page_accessed(struct page *page) page =compound_head (page);inc_node_page_state (page,NR_ACCESSED ); -if (!PageActive (page) && !PageUnevictable (page) && -PageReferenced (page)) { - +if (!PageReferenced (page)) { +SetPageReferenced (page); + }else if (PageUnevictable (page)) { +/* +* Unevictable pages are on the "LRU_UNEVICTABLE" list. But, +* this list is never rotated or maintained, so marking an +* evictable page accessed has no effect. +*/ + }else if (!PageActive (page)) {/* * If the page is on the LRU, queue it for activation via * activate_page_pvecs. Otherwise, assume the page is on a @@ -389,8 +395,6 @@ void mark_page_accessed(struct page *page)ClearPageReferenced (page);if (page_is_file_cache (page))workingset_activation (page); - }else if (!PageReferenced (page)) { -SetPageReferenced (page); }if (page_is_idle (page))clear_page_idle (page);