Directly use folio_zero_range() to cleanup code. Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> --- mm/shmem.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index bd5ba016567d..247c0403af83 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2392,11 +2392,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, * it now, lest undo on failure cancel our earlier guarantee. */ if (sgp != SGP_WRITE && !folio_test_uptodate(folio)) { - long i, n = folio_nr_pages(folio); - - for (i = 0; i < n; i++) - clear_highpage(folio_page(folio, i)); - flush_dcache_folio(folio); + folio_zero_range(folio, 0, folio_size(folio)); folio_mark_uptodate(folio); } -- 2.27.0