On Mon, Jul 22, 2024 at 11:17:57AM +0200, David Hildenbrand wrote: > What we do have is a single VMA, whereby within that VMA we place various > different PFN ranges. (randomly looking at drivers/video/fbdev/smscufx.c) > > These wouldn't have triggered VM_PAT code. Right, it looks like VM_PAT is only applying to a whole-vma mapping, even though I don't know how that was designed.. I wished vma->vm_pgoff was for storing the base PFN for VM_SHARED too: now it only works like that for CoW mappings in remap_pfn_range_notrack(), then it looks like VM_SHARED users of remap_pfn_range() can reuse vm_pgoff, and I think VFIO does reuse it at least.. I am a bit confused on why Linux made that different for VM_SHARED, probably since b3b9c2932c32 ("mm, x86, pat: rework linear pfn-mmap tracking"). I wished vm_pgoff was always used for internal maintenance (even for VM_SHARED) so this issue should be easier to solve. Maybe we can still re-define vm_pgoff for VM_SHARED pfnmaps? The caller should always be able to encode information in vm_private_data anyway. But I think that might break OOT users.. -- Peter Xu