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 <kui....@virtuozzo.com>
---
 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
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to