summaryrefslogtreecommitdiff
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2023-11-17 16:14:45 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-21 14:38:21 +0200
commitfe01748ca6d6ad25d31eaa61d155f5ecf80907cc (patch)
tree4037aaa1be8d18b01a0d7087bf74f3ab14ac497a /mm/memory-failure.c
parent130b4b9478c3c3771c4d7dc50a90fe3808d61d76 (diff)
downloadlinux-fe01748ca6d6ad25d31eaa61d155f5ecf80907cc.tar.gz
linux-fe01748ca6d6ad25d31eaa61d155f5ecf80907cc.tar.bz2
linux-fe01748ca6d6ad25d31eaa61d155f5ecf80907cc.zip
memory-failure: use a folio in me_huge_page()
[ Upstream commit b6fd410c32f1a66a52a42d6aae1ab7b011b74547 ] 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. Link: https://lkml.kernel.org/r/20231117161447.2461643-5-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Naoya Horiguchi <naoya.horiguchi@nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Stable-dep-of: 8cf360b9d6a8 ("mm/memory-failure: fix handling of dissolved but not taken off from buddy pages") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 5378edad9df8..9c27ec0a27a3 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1193,25 +1193,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;