author: Miklos Szeredi <mszeredi@redhat.com> 2019-09-12 14:28:13 +0200
committer: Miklos Szeredi <mszeredi@redhat.com> 2019-09-12 14:59:40 +0200
commit: f22f812d5ce75a18b56073a7a63862e6ea764070
parent: 05ea48cc2b098c533193bb058b82aa016a8361bc
Commit Summary:
Diffstat:
1 file changed, 5 insertions, 2 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 2cec25ad54b7..4404d21649ff 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -826,9 +826,12 @@ static const struct super_operations fuse_super_operations = {
static void sanitize_global_limit(unsigned *limit)
{
+ /*
+ * The default maximum number of async requests is calculated to consume
+ * 1/2^13 of the total memory, assuming 392 bytes per request.
+ */
if (*limit == 0)
- *limit = ((totalram_pages() << PAGE_SHIFT) >> 13) /
- sizeof(struct fuse_req);
+ *limit = ((totalram_pages() << PAGE_SHIFT) >> 13) / 392;
if (*limit >= 1 << 16)
*limit = (1 << 16) - 1;