linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: trivial mark_page_accessed() cleanup
@ 2019-10-16 22:53 Fengguang Wu
  2019-10-22 11:53 ` Vlastimil Babka
  0 siblings, 1 reply; 2+ messages in thread
From: Fengguang Wu @ 2019-10-16 22:53 UTC (permalink / raw)
  To: Linux Memory Management List, Andrew Morton
  Cc: Dave Hansen, Wu Fengguang, Liu Jingqi, LKML

This avoids duplicated PageReferenced() calls.
No behavior change.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
  mm/swap.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index 38a52b9..c55720c 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -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);
-- 
2.7.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-22 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 22:53 [PATCH] mm: trivial mark_page_accessed() cleanup Fengguang Wu
2019-10-22 11:53 ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox