Skip to content

Commit fe01748

Browse files
Matthew Wilcox (Oracle)gregkh
authored andcommitted
memory-failure: use a folio in me_huge_page()
[ Upstream commit b6fd410 ] 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: 8cf360b ("mm/memory-failure: fix handling of dissolved but not taken off from buddy pages") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 130b4b9 commit fe01748

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mm/memory-failure.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,25 +1193,25 @@ static int me_swapcache_clean(struct page_state *ps, struct page *p)
11931193
*/
11941194
static int me_huge_page(struct page_state *ps, struct page *p)
11951195
{
1196+
struct folio *folio = page_folio(p);
11961197
int res;
1197-
struct page *hpage = compound_head(p);
11981198
struct address_space *mapping;
11991199
bool extra_pins = false;
12001200

1201-
mapping = page_mapping(hpage);
1201+
mapping = folio_mapping(folio);
12021202
if (mapping) {
1203-
res = truncate_error_page(hpage, page_to_pfn(p), mapping);
1203+
res = truncate_error_page(&folio->page, page_to_pfn(p), mapping);
12041204
/* The page is kept in page cache. */
12051205
extra_pins = true;
1206-
unlock_page(hpage);
1206+
folio_unlock(folio);
12071207
} else {
1208-
unlock_page(hpage);
1208+
folio_unlock(folio);
12091209
/*
12101210
* migration entry prevents later access on error hugepage,
12111211
* so we can free and dissolve it into buddy to save healthy
12121212
* subpages.
12131213
*/
1214-
put_page(hpage);
1214+
folio_put(folio);
12151215
if (__page_handle_poison(p) >= 0) {
12161216
page_ref_inc(p);
12171217
res = MF_RECOVERED;

0 commit comments

Comments
 (0)