The patch titled Subject: zsmalloc: switch from alloc_vm_area to get_vm_area has been added to the -mm tree. Its filename is zsmalloc-switch-from-alloc_vm_area-to-get_vm_area.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/zsmalloc-switch-from-alloc_vm_area-to-get_vm_area.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/zsmalloc-switch-from-alloc_vm_area-to-get_vm_area.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: zsmalloc: switch from alloc_vm_area to get_vm_area Just manually pre-fault the PTEs using apply_to_page_range. Link: https://lkml.kernel.org/r/20200930175133.1252382-6-hch@xxxxxx Signed-off-by: Christoph Hellwig <hch@xxxxxx> Co-developed-by: Minchan Kim <minchan@xxxxxxxxxx> 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/zsmalloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/mm/zsmalloc.c~zsmalloc-switch-from-alloc_vm_area-to-get_vm_area +++ a/mm/zsmalloc.c @@ -1122,10 +1122,16 @@ static inline int __zs_cpu_up(struct map */ if (area->vm) return 0; - area->vm = alloc_vm_area(PAGE_SIZE * 2, NULL); + area->vm = get_vm_area(PAGE_SIZE * 2, 0); if (!area->vm) return -ENOMEM; - return 0; + + /* + * Populate ptes in advance to avoid pte allocation with GFP_KERNEL + * in non-preemtible context of zs_map_object. + */ + return apply_to_page_range(&init_mm, (unsigned long)area->vm->addr, + PAGE_SIZE * 2, NULL, NULL); } static inline void __zs_cpu_down(struct mapping_area *area) _ 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