On Fri, Jan 27, 2023 at 10:39:41PM +0100, Helge Deller wrote: > Matthew Wilcox noticed, that if ARCH_HAS_FLUSH_ON_KUNMAP is defined > (which is the case for PA-RISC), __kunmap_local() calls > kunmap_flush_on_unmap(), which may call the parisc flush functions with > a non-page-aligned address and thus the page might not be fully flushed. > > To prevent similiar cases, page-align any given address in the > following parisc low-level calls: > - clear_page_asm(), > - copy_page_asm(), > - copy_user_page_asm(), > - clear_user_page_asm(), > - flush_kernel_dcache_page_asm(), > - purge_kernel_dcache_page_asm() and > - flush_kernel_icache_page() I don't think this is the right way to go. Imagine that we enable large folios on architectures that don't support TRANSPARENT_HUGEPAGE (ie PA-RISC). Then folio_zero_range() is going to call kmap_local() and kunmap_local() once per folio instead of once per page, and so we'll need to flush the entire folio, not just the page.