On Tue, Sep 16, 2025 at 03:11:52PM +0100, Lorenzo Stoakes wrote: > We need the ability to split PFN remap between updating the VMA and > performing the actual remap, in order to do away with the legacy > f_op->mmap hook. > > To do so, update the PFN remap code to provide shared logic, and also make > remap_pfn_range_notrack() static, as its one user, io_mapping_map_user() > was removed in commit 9a4f90e24661 ("mm: remove mm/io-mapping.c"). > > Then, introduce remap_pfn_range_prepare(), which accepts VMA descriptor > and PFN parameters, and remap_pfn_range_complete() which accepts the same > parameters as remap_pfn_rangte(). remap_pfn_range
> > remap_pfn_range_prepare() will set the cow vma->vm_pgoff if necessary, so > it must be supplied with a correct PFN to do so. If the caller must hold > locks to be able to do this, those locks should be held across the > operation, and mmap_abort() should be provided to revoke the lock should > an error arise. > > While we're here, also clean up the duplicated #ifdef > __HAVE_PFNMAP_TRACKING check and put into a single #ifdef/#else block. > > We would prefer to define these functions in mm/internal.h, however we > will do the same for io_remap*() and these have arch defines that require > access to the remap functions. > I'm confused. What's stopping us from declaring these new functions in internal.h? It's supposed to be used by core mm only anyway? > Signed-off-by: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> The changes themselves look OK to me, but I'm not super familiar with these bits anyway. Acked-by: Pedro Falcato <pfalc...@suse.de> -- Pedro