lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220120131024.502877-6-alexs@kernel.org>
Date:   Thu, 20 Jan 2022 21:10:24 +0800
From:   alexs@...nel.org
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Alex Shi <alexs@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        Naoya Horiguchi <naoya.horiguchi@....com>,
        Yu Zhao <yuzhao@...gle.com>, Arnd Bergmann <arnd@...db.de>,
        Vlastimil Babka <vbabka@...e.cz>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Johannes Weiner <hannes@...xchg.org>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: [PATCH 5/5] mm: remove del_page_from_lru_list()

From: Alex Shi <alexs@...nel.org>

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

Signed-off-by: Alex Shi <alexs@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Yu Zhao <yuzhao@...gle.com>
Cc: Alex Shi <alexs@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org
---
 include/linux/mm_inline.h |  6 ------
 mm/compaction.c           |  2 +-
 mm/mlock.c                |  2 +-
 mm/swap.c                 | 10 +++++-----
 mm/vmscan.c               |  4 ++--
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 4df5b39cc97b..a66c08079675 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -110,12 +110,6 @@ void lruvec_del_folio(struct lruvec *lruvec, struct folio *folio)
 			-folio_nr_pages(folio));
 }
 
-static __always_inline void del_page_from_lru_list(struct page *page,
-				struct lruvec *lruvec)
-{
-	lruvec_del_folio(lruvec, page_folio(page));
-}
-
 #ifdef CONFIG_ANON_VMA_NAME
 /*
  * mmap_lock should be read-locked when calling vma_anon_name() and while using
diff --git a/mm/compaction.c b/mm/compaction.c
index 12f2af6ac484..385e0bb7aad5 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1064,7 +1064,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 			low_pfn += compound_nr(page) - 1;
 
 		/* Successfully isolated */
-		del_page_from_lru_list(page, lruvec);
+		lruvec_del_folio(lruvec, page_folio(page));
 		mod_node_page_state(page_pgdat(page),
 				NR_ISOLATED_ANON + folio_is_file_lru(page_folio(page)),
 				thp_nr_pages(page));
diff --git a/mm/mlock.c b/mm/mlock.c
index 8f584eddd305..6b64758b5d8c 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -280,7 +280,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
 			 */
 			if (TestClearPageLRU(page)) {
 				lruvec = folio_lruvec_relock_irq(folio, lruvec);
-				del_page_from_lru_list(page, lruvec);
+				lruvec_del_folio(lruvec, page_folio(page));
 				continue;
 			} else
 				__munlock_isolation_failed(page);
diff --git a/mm/swap.c b/mm/swap.c
index 23c0afb76be6..359821740e0f 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -85,7 +85,7 @@ static void __page_cache_release(struct page *page)
 		unsigned long flags;
 
 		lruvec = folio_lruvec_lock_irqsave(folio, &flags);
-		del_page_from_lru_list(page, lruvec);
+		lruvec_del_folio(lruvec, page_folio(page));
 		__folio_clear_lru_flags(page_folio(page));
 		unlock_page_lruvec_irqrestore(lruvec, flags);
 	}
@@ -533,7 +533,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec)
 	if (page_mapped(page))
 		return;
 
-	del_page_from_lru_list(page, lruvec);
+	lruvec_del_folio(lruvec, page_folio(page));
 	ClearPageActive(page);
 	ClearPageReferenced(page);
 
@@ -566,7 +566,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec)
 	if (PageActive(page) && !PageUnevictable(page)) {
 		int nr_pages = thp_nr_pages(page);
 
-		del_page_from_lru_list(page, lruvec);
+		lruvec_del_folio(lruvec, page_folio(page));
 		ClearPageActive(page);
 		ClearPageReferenced(page);
 		lruvec_add_folio(lruvec, page_folio(page));
@@ -583,7 +583,7 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec)
 	    !PageSwapCache(page) && !PageUnevictable(page)) {
 		int nr_pages = thp_nr_pages(page);
 
-		del_page_from_lru_list(page, lruvec);
+		lruvec_del_folio(lruvec, page_folio(page));
 		ClearPageActive(page);
 		ClearPageReferenced(page);
 		/*
@@ -965,7 +965,7 @@ void release_pages(struct page **pages, int nr)
 			if (prev_lruvec != lruvec)
 				lock_batch = 0;
 
-			del_page_from_lru_list(page, lruvec);
+			lruvec_del_folio(lruvec, page_folio(page));
 			__folio_clear_lru_flags(page_folio(page));
 		}
 
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f09473c9ff35..8ab97eac284a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2247,7 +2247,7 @@ int isolate_lru_page(struct page *page)
 
 		get_page(page);
 		lruvec = folio_lruvec_lock_irq(folio);
-		del_page_from_lru_list(page, lruvec);
+		lruvec_del_folio(lruvec, page_folio(page));
 		unlock_page_lruvec_irq(lruvec);
 		ret = 0;
 	}
@@ -4873,7 +4873,7 @@ void check_move_unevictable_pages(struct pagevec *pvec)
 
 		lruvec = folio_lruvec_relock_irq(folio, lruvec);
 		if (page_evictable(page) && PageUnevictable(page)) {
-			del_page_from_lru_list(page, lruvec);
+			lruvec_del_folio(lruvec, page_folio(page));
 			ClearPageUnevictable(page);
 			lruvec_add_folio(lruvec, page_folio(page));
 			pgrescued += nr_pages;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ