Skip to content

Commit 6a248b1

Browse files
Matthew Wilcox (Oracle)opsiff
authored andcommitted
memory-failure: convert truncate_error_page to truncate_error_folio
mainline inclusion from mainline-v6.8-rc1 category: performance Both callers now have a folio, so pass it in. Nothing downstream was expecting a tail page; that's asserted in generic_error_remove_page(), for example. Link: https://lkml.kernel.org/r/20231117161447.2461643-6-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> (cherry picked from commit e130b65) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 04ac684 commit 6a248b1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

mm/memory-failure.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -950,14 +950,13 @@ static int delete_from_lru_cache(struct folio *folio)
950950
return -EIO;
951951
}
952952

953-
static int truncate_error_page(struct page *p, unsigned long pfn,
953+
static int truncate_error_page(struct folio *folio, unsigned long pfn,
954954
struct address_space *mapping)
955955
{
956-
struct folio *folio = page_folio(p);
957956
int ret = MF_FAILED;
958957

959958
if (mapping->a_ops->error_remove_page) {
960-
int err = mapping->a_ops->error_remove_page(mapping, p);
959+
int err = mapping->a_ops->error_remove_page(mapping, &folio->page);
961960

962961
if (err != 0)
963962
pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
@@ -1078,7 +1077,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
10781077
*
10791078
* Open: to take i_rwsem or not for this? Right now we don't.
10801079
*/
1081-
ret = truncate_error_page(p, page_to_pfn(p), mapping);
1080+
ret = truncate_error_page(folio, page_to_pfn(p), mapping);
10821081
if (has_extra_refcount(ps, p, extra_pins))
10831082
ret = MF_FAILED;
10841083

@@ -1212,7 +1211,7 @@ static int me_huge_page(struct page_state *ps, struct page *p)
12121211

12131212
mapping = folio_mapping(folio);
12141213
if (mapping) {
1215-
res = truncate_error_page(&folio->page, page_to_pfn(p), mapping);
1214+
res = truncate_error_page(folio, page_to_pfn(p), mapping);
12161215
/* The page is kept in page cache. */
12171216
extra_pins = true;
12181217
folio_unlock(folio);

0 commit comments

Comments
 (0)