Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/io-mapping: precompute remap protection flags for clarity

Patch series "mm: small cleanups for io-mapping, debug_page_alloc and
numa".

This series includes three small cleanups to mm/:

- io-mapping: simplify remap protection flag calculation
- debug_page_alloc: improve error message by printing invalid input
- numa: remove unnecessary variable for clarity

No functional changes.


This patch (of 3):

In io_mapping_map_user(), precompute the page protection flags in a local
variable before calling remap_pfn_range_notrack().

No functional change.

Link: https://lkml.kernel.org/r/20250427100442.958352-1-ye.liu@linux.dev
Link: https://lkml.kernel.org/r/20250427100442.958352-2-ye.liu@linux.dev
Signed-off-by: Ye Liu <liuye@kylinos.cn>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Ye Liu and committed by
Andrew Morton
b94bff76 d48e8d27

+4 -3
+4 -3
mm/io-mapping.c
··· 21 21 if (WARN_ON_ONCE((vma->vm_flags & expected_flags) != expected_flags)) 22 22 return -EINVAL; 23 23 24 + pgprot_t remap_prot = __pgprot((pgprot_val(iomap->prot) & _PAGE_CACHE_MASK) | 25 + (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK)); 26 + 24 27 /* We rely on prevalidation of the io-mapping to skip track_pfn(). */ 25 - return remap_pfn_range_notrack(vma, addr, pfn, size, 26 - __pgprot((pgprot_val(iomap->prot) & _PAGE_CACHE_MASK) | 27 - (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK))); 28 + return remap_pfn_range_notrack(vma, addr, pfn, size, remap_prot); 28 29 } 29 30 EXPORT_SYMBOL_GPL(io_mapping_map_user);