This patch is for ready kernel only. For new release the following patch should 
be used.
[PATCH VZ9] fs/fuse kio: Refactor pcs_mr to avoid large contiguous memory 
allocation
________________________________
From: Liu Kui <[email protected]>
Sent: 01 August 2025 20:55
To: [email protected] <[email protected]>
Cc: Alexey Kuznetsov <[email protected]>; Andrey Zaitsev 
<[email protected]>; Konstantin Khorenko <[email protected]>; Kui Liu 
<[email protected]>
Subject: [PATCH VZ9] fs/fuse kio: Use kvcalloc to prevent failure in fragmented 
systems

Address large memory allocation failure by replacing kcalloc with
kvcalloc. This allows fallback to vmalloc for large allocations,
as virtually contiguous meomory is sufficient here, improving
reliability in highly fragmented systems

Related to: #VSTOR-112413
https://virtuozzo.atlassian.net/browse/VSTOR-112413

Signed-off-by: Liu Kui <[email protected]>
---
 fs/fuse/kio/pcs/pcs_mr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_mr.c b/fs/fuse/kio/pcs/pcs_mr.c
index cbd3b440dd1b..28e04d1b2639 100644
--- a/fs/fuse/kio/pcs/pcs_mr.c
+++ b/fs/fuse/kio/pcs/pcs_mr.c
@@ -17,7 +17,7 @@ void pcs_umem_release(struct pcs_umem *umem)
         unpin_user_pages(umem->pages, umem->npages);
         atomic64_sub(umem->npages, &mm_s->pinned_vm);
         mmdrop(mm_s);
-       kfree(umem->pages);
+       kvfree(umem->pages);
         kfree(umem);
 }

@@ -48,7 +48,7 @@ struct pcs_umem *pcs_umem_get(u64 start, u64 len)
         mmap_read_lock(mm_s);

         umem->fp_addr = fp_va;
-       umem->pages = kcalloc(npages, sizeof(struct page *), GFP_KERNEL);
+       umem->pages = kvcalloc(npages, sizeof(struct page *), GFP_KERNEL);
         if (!umem->pages) {
                 ret = -ENOMEM;
                 goto out_err;
--
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to