[Devel] [PATCH RHEL7 COMMIT] fuse/kio_pcs: use kvmalloc for pcs_fuse_cluster allocation

Konstantin Khorenko khorenko at virtuozzo.com
Wed May 16 11:09:25 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.47.6
------>
commit 6f4b765d11fbfb706a1a83f06a82a1a43da93c73
Author: Oleg Babin <obabin at virtuozzo.com>
Date:   Wed May 16 11:09:25 2018 +0300

    fuse/kio_pcs: use kvmalloc for pcs_fuse_cluster allocation
    
    Size of pcs_fuse_cluster structure is about 17k when NR_CPUS is
    set to 5120 (default value in the OpenVZ config) which means the
    3rd memory order.
    
    Use kvmalloc() for pcs_fuse_cluster structure allocation to fallback
    to vmalloc() in case of high order page is not available at the
    moment. Replace GFP_NOIO with GFP_KERNEL flag as kvmalloc requires.
    It is safe to do as allocation is done at mount time and no IO/FS
    locks are held (checked with debug_show_all_locks()).
    
    https://jira.sw.ru/browse/HCI-53
    Signed-off-by: Oleg Babin <obabin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cluster.c      | 2 +-
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index fe1ac6df58bd..79071655f6e5 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -547,5 +547,5 @@ int pcs_cluster_init(struct pcs_fuse_cluster *pfc, struct workqueue_struct *wq,
 void pcs_cluster_fini(struct pcs_fuse_cluster *pfc)
 {
 	pcs_cc_fini(&pfc->cc);
-	kfree(pfc);
+	kvfree(pfc);
 }
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index c371fe0ef51f..09d79769d1fc 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -48,7 +48,7 @@ static void process_pcs_init_reply(struct fuse_conn *fc, struct fuse_req *req)
 		fc->conn_error = 1;
 		goto out;
 	}
-	pfc = kmalloc(sizeof(*pfc), GFP_NOIO);
+	pfc = kvmalloc(sizeof(*pfc), GFP_KERNEL);
 	if (!pfc) {
 		fc->conn_error = 1;
 		goto out;


More information about the Devel mailing list