Skip to content

Commit

Permalink
mm/swap.c: trivial mark_page_accessed() cleanup
Browse files Browse the repository at this point in the history
This avoids duplicated PageReferenced() calls.  No behavior change.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Fengguang Wu <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Liu Jingqi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Fengguang Wu authored and torvalds committed Dec 1, 2019
1 parent 12d2966 commit a1100a7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,16 @@ static void __lru_cache_activate_page(struct page *page)
void mark_page_accessed(struct page *page)
{
page = compound_head(page);
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
Expand All @@ -389,8 +396,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);
Expand Down

0 comments on commit a1100a7

Please sign in to comment.