All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 4/6] memory-failure: Use a folio in me_huge_page()
Date: Fri, 17 Nov 2023 16:14:45 +0000	[thread overview]
Message-ID: <20231117161447.2461643-5-willy@infradead.org> (raw)
In-Reply-To: <20231117161447.2461643-1-willy@infradead.org>

This function was already explicitly calling compound_head();
unfortunately the compiler can't know that and elide the redundant
calls to compound_head() buried in page_mapping(), unlock_page(), etc.
Switch to using a folio, which does let us elide these calls.

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

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e73f2047ffcb..d97d247c0224 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1182,25 +1182,25 @@ static int me_swapcache_clean(struct page_state *ps, struct page *p)
  */
 static int me_huge_page(struct page_state *ps, struct page *p)
 {
+	struct folio *folio = page_folio(p);
 	int res;
-	struct page *hpage = compound_head(p);
 	struct address_space *mapping;
 	bool extra_pins = false;
 
-	mapping = page_mapping(hpage);
+	mapping = folio_mapping(folio);
 	if (mapping) {
-		res = truncate_error_page(hpage, page_to_pfn(p), mapping);
+		res = truncate_error_page(&folio->page, page_to_pfn(p), mapping);
 		/* The page is kept in page cache. */
 		extra_pins = true;
-		unlock_page(hpage);
+		folio_unlock(folio);
 	} else {
-		unlock_page(hpage);
+		folio_unlock(folio);
 		/*
 		 * migration entry prevents later access on error hugepage,
 		 * so we can free and dissolve it into buddy to save healthy
 		 * subpages.
 		 */
-		put_page(hpage);
+		folio_put(folio);
 		if (__page_handle_poison(p) >= 0) {
 			page_ref_inc(p);
 			res = MF_RECOVERED;
-- 
2.42.0


  parent reply	other threads:[~2023-11-17 16:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 16:14 [PATCH 0/6] Convert aops->error_remove_page to ->error_remove_folio Matthew Wilcox (Oracle)
2023-11-17 16:14 ` [PATCH 1/6] memory-failure: Use a folio in me_pagecache_clean() Matthew Wilcox (Oracle)
2023-11-17 16:14 ` [PATCH 2/6] memory-failure: Use a folio in me_pagecache_dirty() Matthew Wilcox (Oracle)
2023-11-17 16:14 ` [PATCH 3/6] memory-failure: Convert delete_from_lru_cache() to take a folio Matthew Wilcox (Oracle)
2023-11-17 16:14 ` Matthew Wilcox (Oracle) [this message]
2023-11-17 16:14 ` [PATCH 5/6] memory-failure: Convert truncate_error_page to truncate_error_folio Matthew Wilcox (Oracle)
2023-11-17 16:14 ` [PATCH 6/6] fs: Convert error_remove_page to error_remove_folio Matthew Wilcox (Oracle)
2023-11-17 17:28   ` Andrew Morton
2023-11-17 18:14     ` Matthew Wilcox
2023-11-20  0:33     ` Stephen Rothwell

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=20231117161447.2461643-5-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.