On Mon, Jul 06, 2026 at 03:49:24PM +0200, Thierry Reding wrote: > On Fri, Jul 03, 2026 at 06:13:31PM +0100, Will Deacon wrote: > > > > > > How about if I extract a common helper and provide set_memory_p() and > > > set_memory_np() in terms of those. Those are available on x86 and > > > PowerPC as well, so fairly standard. I suppose at that point we're > > > closer to set_memory_valid(). > > > > Why not just call set_direct_map_invalid_noflush() + > > flush_tlb_kernel_range() for each page? We already have APIs for this. > > Having a "standard" helper with a fixed and documented purposed seemed > like a preferable approach for this particular case. We also may want to > make the driver that uses this buildable as a module, in which case we'd > need to export these rather low-level APIs. And then there's also the > fact that we typically call this on a rather large region of memory > (usually something like 512 MiB), so doing it page-by-page is rather > suboptimal.
There are discussions about adding numpages to set_direct_map, e.g. https://lore.kernel.org/linux-mm/[email protected]/ -- Sincerely yours, Mike.
