[PATCH 7/7] 9p: v9fs fix calculation of max number of merged pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eduard Shishkin <eduard.shishkin@xxxxxxxxxx>

Don't merge too many pages when composing a 9p message because:
. it doesn't lead to essential performance improvement;
. to not allow user space to allocate big amount of kernel memory.

We use a limit of 256K (for total size of all pages merged per message),
as larger values don't provide any visible speedup.

Signed-off-by: Eduard Shishkin <eduard.shishkin@xxxxxxxxxx>
---
 fs/9p/v9fs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 58bff9e..50a4034 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -319,6 +319,8 @@ void put_flush_set(struct v9fs_flush_set *fset)
 	kfree(fset);
 }
 
+#define MAX_FLUSH_DATA_SIZE (262144)
+
 /**
  * Allocate and initalize flush set
  * Pre-conditions: valid msize is set
@@ -333,6 +335,11 @@ int alloc_init_flush_set(struct v9fs_session_info *v9ses)
 	if (num_pages < 2)
 		/* speedup impossible */
 		return 0;
+	if (num_pages > (MAX_FLUSH_DATA_SIZE >> PAGE_SHIFT))
+		/*
+		 * no performance gain with larger values
+		 */
+		num_pages = MAX_FLUSH_DATA_SIZE >> PAGE_SHIFT;
 	fset = kzalloc(sizeof(*fset), GFP_KERNEL);
 	if (!fset)
 		goto error;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux