[Devel] [PATCH vz7 v2 4/4] fuse/kio_pcs: use kvmalloc for pcs_fuse_cluster allocation

Oleg Babin obabin at virtuozzo.com
Tue May 8 22:05:18 MSK 2018


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 b995135..482d26e 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -536,5 +536,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 c371fe0..09d7976 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;
-- 
1.8.3.1



More information about the Devel mailing list