The patch titled Subject: mm/swap.c: trivial mark_page_accessed() cleanup has been added to the -mm tree. Its filename is mm-trivial-mark_page_accessed-cleanup.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-trivial-mark_page_accessed-cleanup.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-trivial-mark_page_accessed-cleanup.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Fengguang Wu <fengguang.wu@xxxxxxxxx> Subject: mm/swap.c: trivial mark_page_accessed() cleanup This avoids duplicated PageReferenced() calls. No behavior change. Link: http://lkml.kernel.org/r/20191016225326.GB12497@xxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Liu Jingqi <jingqi.liu@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swap.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/mm/swap.c~mm-trivial-mark_page_accessed-cleanup +++ a/mm/swap.c @@ -373,9 +373,16 @@ static void __lru_cache_activate_page(st 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 @@ -389,8 +396,6 @@ void mark_page_accessed(struct page *pag 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); _ Patches currently in -mm which might be from fengguang.wu@xxxxxxxxx are mm-trivial-mark_page_accessed-cleanup.patch