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

Submitted by Oleg Babin on May 8, 2018, 7:05 p.m.

Details

Message ID 1525806318-605691-5-git-send-email-obabin@virtuozzo.com
State New
Series "avoid kmalloc for high order memory allocations"
Headers show

Commit Message

Oleg Babin May 8, 2018, 7:05 p.m.
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@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(-)

Patch hide | download patch | download mbox

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;