On Thu, Oct 17, 2024 at 10:25:04PM +0800, Kefeng Wang wrote: > Directly use folio_zero_range() to cleanup code. Are you sure there's no performance regression introduced by this? clear_highpage() is often optimised in ways that we can't optimise for a plain memset(). On the other hand, if the folio is large, maybe a modern CPU will be able to do better than clear-one-page-at-a-time. IOW, what performance testing have you done with this patch? > 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); > }