The patch titled Subject: mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6 has been added to the -mm mm-unstable branch. Its filename is mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Usama Arif <usamaarif642@xxxxxxxxx> Subject: mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6 Date: Mon, 24 Jun 2024 15:01:28 +0100 Change bitmap_zalloc/free to kvzalloc/free as a very large swap file will result in the allocation order to exceed MAX_PAGE_ORDER resulting in bitmap_zalloc to fail. Link: https://lkml.kernel.org/r/20240624140427.1334871-2-usamaarif642@xxxxxxxxx Signed-off-by: Usama Arif <usamaarif642@xxxxxxxxx> Reviewed-by: Chengming Zhou <chengming.zhou@xxxxxxxxx> Reviewed-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Shakeel Butt <shakeel.butt@xxxxxxxxx> Cc: Usama Arif <usamaarif642@xxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/swapfile.c~mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6 +++ a/mm/swapfile.c @@ -2643,7 +2643,7 @@ SYSCALL_DEFINE1(swapoff, const char __us free_percpu(p->cluster_next_cpu); p->cluster_next_cpu = NULL; vfree(swap_map); - bitmap_free(p->zeromap); + kvfree(p->zeromap); kvfree(cluster_info); /* Destroy swap account information */ swap_cgroup_swapoff(p->type); @@ -3170,7 +3170,7 @@ SYSCALL_DEFINE2(swapon, const char __use goto bad_swap_unlock_inode; } - p->zeromap = bitmap_zalloc(maxpages, GFP_KERNEL); + p->zeromap = kvzalloc(DIV_ROUND_UP(maxpages, 8), GFP_KERNEL); if (!p->zeromap) { error = -ENOMEM; goto bad_swap_unlock_inode; _ Patches currently in -mm which might be from usamaarif642@xxxxxxxxx are mm-do-not-start-end-writeback-for-pages-stored-in-zswap.patch mm-store-zero-pages-to-be-swapped-out-in-a-bitmap.patch mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v6.patch mm-remove-code-to-handle-same-filled-pages.patch