linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: alexs@kernel.org
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alex Shi <alexs@kernel.org>, Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Yu Zhao <yuzhao@google.com>, Arnd Bergmann <arnd@arndb.de>,
	Vlastimil Babka <vbabka@suse.cz>,
	Mel Gorman <mgorman@techsingularity.net>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 3/5] mm: remove add_page_to_lru_list() function
Date: Thu, 20 Jan 2022 21:10:22 +0800	[thread overview]
Message-ID: <20220120131024.502877-4-alexs@kernel.org> (raw)
In-Reply-To: <20220120131024.502877-1-alexs@kernel.org>

From: Alex Shi <alexs@kernel.org>

The function could be fully replaced by ruvec_add_folio(), no reason to
keep a duplicate one.

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
---
 include/linux/mm_inline.h | 6 ------
 mm/swap.c                 | 6 +++---
 mm/vmscan.c               | 4 ++--
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index c2384da888b4..7d7abd5ff73f 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -92,12 +92,6 @@ void lruvec_add_folio(struct lruvec *lruvec, struct folio *folio)
 	list_add(&folio->lru, &lruvec->lists[lru]);
 }
 
-static __always_inline void add_page_to_lru_list(struct page *page,
-				struct lruvec *lruvec)
-{
-	lruvec_add_folio(lruvec, page_folio(page));
-}
-
 static __always_inline
 void lruvec_add_folio_tail(struct lruvec *lruvec, struct folio *folio)
 {
diff --git a/mm/swap.c b/mm/swap.c
index 953cf8860542..fb101a06dce4 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -543,7 +543,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec)
 		 * It can make readahead confusing.  But race window
 		 * is _really_ small and  it's non-critical problem.
 		 */
-		add_page_to_lru_list(page, lruvec);
+		lruvec_add_folio(lruvec, page_folio(page));
 		SetPageReclaim(page);
 	} else {
 		/*
@@ -569,7 +569,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec)
 		del_page_from_lru_list(page, lruvec);
 		ClearPageActive(page);
 		ClearPageReferenced(page);
-		add_page_to_lru_list(page, lruvec);
+		lruvec_add_folio(lruvec, page_folio(page));
 
 		__count_vm_events(PGDEACTIVATE, nr_pages);
 		__count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE,
@@ -592,7 +592,7 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec)
 		 * anonymous pages
 		 */
 		ClearPageSwapBacked(page);
-		add_page_to_lru_list(page, lruvec);
+		lruvec_add_folio(lruvec, page_folio(page));
 
 		__count_vm_events(PGLAZYFREE, nr_pages);
 		__count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 59a52ba8b52a..f09473c9ff35 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2354,7 +2354,7 @@ static unsigned int move_pages_to_lru(struct lruvec *lruvec,
 		 * inhibits memcg migration).
 		 */
 		VM_BUG_ON_PAGE(!folio_matches_lruvec(page_folio(page), lruvec), page);
-		add_page_to_lru_list(page, lruvec);
+		lruvec_add_folio(lruvec, page_folio(page));
 		nr_pages = thp_nr_pages(page);
 		nr_moved += nr_pages;
 		if (PageActive(page))
@@ -4875,7 +4875,7 @@ void check_move_unevictable_pages(struct pagevec *pvec)
 		if (page_evictable(page) && PageUnevictable(page)) {
 			del_page_from_lru_list(page, lruvec);
 			ClearPageUnevictable(page);
-			add_page_to_lru_list(page, lruvec);
+			lruvec_add_folio(lruvec, page_folio(page));
 			pgrescued += nr_pages;
 		}
 		SetPageLRU(page);
-- 
2.25.1


  parent reply	other threads:[~2022-01-20 13:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 13:10 [PATCH 0/5] remove add/del page to lru functions alexs
2022-01-20 13:10 ` [PATCH 1/5] mm: remove page_is_file_lru function alexs
2022-01-20 13:27   ` Matthew Wilcox
2022-01-21  7:02     ` Alex Shi
2022-01-21 13:19       ` Matthew Wilcox
2022-01-20 13:10 ` [PATCH 2/5] mm: remove __clear_page_lru_flags() alexs
2022-01-20 13:10 ` alexs [this message]
2022-01-20 13:10 ` [PATCH 4/5] mm: remove add_page_to_lru_list_tail() alexs
2022-01-20 13:10 ` [PATCH 5/5] mm: remove del_page_from_lru_list() alexs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220120131024.502877-4-alexs@kernel.org \
    --to=alexs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@redhat.com \
    --cc=naoya.horiguchi@nec.com \
    --cc=rostedt@goodmis.org \
    --cc=vbabka@suse.cz \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).