The patch titled Subject: mm: allow a NULL fn callback in apply_to_page_range has been added to the -mm tree. Its filename is mm-allow-a-null-fn-callback-in-apply_to_page_range.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-allow-a-null-fn-callback-in-apply_to_page_range.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-allow-a-null-fn-callback-in-apply_to_page_range.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Christoph Hellwig <hch@xxxxxx> Subject: mm: allow a NULL fn callback in apply_to_page_range Besides calling the callback on each page, apply_to_page_range also has the effect of pre-faulting all PTEs for the range. To support callers that only need the pre-faulting, make the callback optional. Based on a patch from Minchan Kim <minchan@xxxxxxxxxx>. Link: https://lkml.kernel.org/r/20200930175133.1252382-5-hch@xxxxxx Signed-off-by: Christoph Hellwig <hch@xxxxxx> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> Cc: Juergen Gross <jgross@xxxxxxxx> Cc: Matthew Auld <matthew.auld@xxxxxxxxx> Cc: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) --- a/mm/memory.c~mm-allow-a-null-fn-callback-in-apply_to_page_range +++ a/mm/memory.c @@ -2421,13 +2421,15 @@ static int apply_to_pte_range(struct mm_ arch_enter_lazy_mmu_mode(); - do { - if (create || !pte_none(*pte)) { - err = fn(pte++, addr, data); - if (err) - break; - } - } while (addr += PAGE_SIZE, addr != end); + if (fn) { + do { + if (create || !pte_none(*pte)) { + err = fn(pte++, addr, data); + if (err) + break; + } + } while (addr += PAGE_SIZE, addr != end); + } *mask |= PGTBL_PTE_MODIFIED; arch_leave_lazy_mmu_mode(); _ Patches currently in -mm which might be from hch@xxxxxx are mm-add-a-vm_map_put_pages-flag-for-vmap.patch mm-add-a-vmap_pfn-function.patch mm-allow-a-null-fn-callback-in-apply_to_page_range.patch zsmalloc-switch-from-alloc_vm_area-to-get_vm_area.patch drm-i915-use-vmap-in-shmem_pin_map.patch drm-i915-use-vmap-in-i915_gem_object_map.patch xen-xenbus-use-apply_to_page_range-directly-in-xenbus_map_ring_pv.patch x86-xen-open-code-alloc_vm_area-in-arch_gnttab_valloc.patch mm-remove-alloc_vm_area.patch