On Mon, 31 Mar 2025 17:11:46 -0700 Linus Torvalds <[email protected]> wrote:
> I thought you did that already for the user mappings - don't use you > remap_pfn_range()? No, that's not what is done. The normal buffer is split among several sub-buffers (usually one page in size each, but can also be a power of two pages), and those pages are allocated via alloc_page() and are not contiguous. Which is why the mapping to user space creates an array of struct page pointers and then calls vm_insert_pages(). For the contigous physical memory, then yeah, we can simply use vm_iomap_memory(). > So if you don't treat this as some kind of 'page' or 'folio' thing, > then the proper function is actually flush_cache_range(). > > I actually suspect that if you treat things just as an arbitrary range > of memory, it might simplify things in general. Ah, yeah. That's the function I was looking for. > Of course, I would expect the same to be true of the page/folio cases, > so I don't think using flush_cache_range() should be any worse, but I > *could* imagine that it's bad in a different way ;) At least we can say we covered those other archs, and if a bug is reported, then all that would need to be fixed is the flush_cache_range() implementation ;-) -- Steve
