On Thu, Nov 04, 2021 at 08:30:55AM -0700, Linus Torvalds wrote: > On Thu, Nov 4, 2021 at 8:03 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > Linus offers the opinion that kunmap calls should imply a > > flush_dcache_page(). Christoph added calls to flush_dcache_page() > > in commit 8dad53a11f8d. Was this "voodoo programming", or was there > > a real problem being addressed? > > I don't think anybody actually uses/cares about flush_dcache_page() at > all, and pretty much all uses are random and voodoo. We do. flush_dcache_page() is not just about virtual caches. On arm32/64 (and powerpc), even with PIPT-like caches, we use it to flag a page's D-cache as no longer clean. Subsequently in set_pte_at(), if the mapping is executable, we do the cache maintenance to ensure the I and D caches are coherent with each other. I wouldn't add this call to kmap/kunmap_local(), it would be a slight unnecessary overhead (we had a customer complaining about kmap_atomic() breaking write-streaming, I think the new kmap_local() solved this problem, if in the right context). -- Catalin