linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH 5/5] mm/vmscan: Convert reclaim_pages() to use a folio
Date: Fri, 17 Jun 2022 16:42:48 +0100	[thread overview]
Message-ID: <20220617154248.700416-6-willy@infradead.org> (raw)
In-Reply-To: <20220617154248.700416-1-willy@infradead.org>

Remove a few hidden calls to compound_head, saving 76 bytes of text.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/vmscan.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0a0e013a3457..50b3edfe815b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2565,34 +2565,33 @@ static unsigned int reclaim_page_list(struct list_head *page_list,
 	return nr_reclaimed;
 }
 
-unsigned long reclaim_pages(struct list_head *page_list)
+unsigned long reclaim_pages(struct list_head *folio_list)
 {
 	int nid;
 	unsigned int nr_reclaimed = 0;
-	LIST_HEAD(node_page_list);
-	struct page *page;
+	LIST_HEAD(node_folio_list);
 	unsigned int noreclaim_flag;
 
-	if (list_empty(page_list))
+	if (list_empty(folio_list))
 		return nr_reclaimed;
 
 	noreclaim_flag = memalloc_noreclaim_save();
 
-	nid = page_to_nid(lru_to_page(page_list));
+	nid = folio_nid(lru_to_folio(folio_list));
 	do {
-		page = lru_to_page(page_list);
+		struct folio *folio = lru_to_folio(folio_list);
 
-		if (nid == page_to_nid(page)) {
-			ClearPageActive(page);
-			list_move(&page->lru, &node_page_list);
+		if (nid == folio_nid(folio)) {
+			folio_clear_active(folio);
+			list_move(&folio->lru, &node_folio_list);
 			continue;
 		}
 
-		nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));
-		nid = page_to_nid(lru_to_page(page_list));
-	} while (!list_empty(page_list));
+		nr_reclaimed += reclaim_page_list(&node_folio_list, NODE_DATA(nid));
+		nid = folio_nid(lru_to_folio(folio_list));
+	} while (!list_empty(folio_list));
 
-	nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));
+	nr_reclaimed += reclaim_page_list(&node_folio_list, NODE_DATA(nid));
 
 	memalloc_noreclaim_restore(noreclaim_flag);
 
-- 
2.35.1



  parent reply	other threads:[~2022-06-17 15:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 15:42 [PATCH 0/5] Convert much of vmscan to folios Matthew Wilcox (Oracle)
2022-06-17 15:42 ` [PATCH 1/5] mm/vmscan: Convert reclaim_clean_pages_from_list() " Matthew Wilcox (Oracle)
2022-06-19  6:38   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 2/5] mm/vmscan: Convert isolate_lru_pages() to use a folio Matthew Wilcox (Oracle)
2022-06-19  6:39   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 3/5] mm/vmscan: Convert move_pages_to_lru() " Matthew Wilcox (Oracle)
2022-06-19  6:39   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 4/5] mm/vmscan: Convert shrink_active_list() " Matthew Wilcox (Oracle)
2022-06-19  6:40   ` Christoph Hellwig
2022-07-11 20:53   ` Matthew Wilcox
2022-07-13 18:13     ` Andrew Morton
2022-06-17 15:42 ` Matthew Wilcox (Oracle) [this message]
2022-06-19  6:40   ` [PATCH 5/5] mm/vmscan: Convert reclaim_pages() " Christoph Hellwig

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=20220617154248.700416-6-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /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