This applies to today's mm-hotfixes-unstable (only). In order to test this, my earlier patch is a prequisite: commit 255231c75dcd ("mm/gup: stop leaking pinned pages in low memory conditions"). Changes since v1 [1]: 1) Completely different implementation: instead of changing the allocator from kmalloc() to kvmalloc(), just avoid allocations entirely. Note that David's original suggestion [2] included something that I've left out for now, mostly because it's a pre-existing question and deserves its own patch. But also, I don't understand it yet, either. [1] https://lore.kernel.org/20241030030116.670307-1-jhubbard@xxxxxxxxxx [2] https://lore.kernel.org/8d9dc103-47c5-4719-971a-31efb091432a@xxxxxxxxxx thanks, John Hubbard Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx> Cc: Dave Airlie <airlied@xxxxxxxxxx> Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> Cc: Dongwon Kim <dongwon.kim@xxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Junxiao Chang <junxiao.chang@xxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: linux-stable@xxxxxxxxxxxxxxx John Hubbard (1): mm/gup: avoid an unnecessary allocation call for FOLL_LONGTERM cases mm/gup.c | 116 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 39 deletions(-) base-commit: 0012ab094cad019afcd07bdfc28e2946537e715c -- 2.47.0