Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076471ybp; Thu, 10 Oct 2019 01:45:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMG2z439A6jvje7G6E4BrhgD01bEyabrgAZ79MWTINjjZSIdzXH9O5IWQ56niO72IeBLZN X-Received: by 2002:a05:6402:7cc:: with SMTP id u12mr7005202edy.63.1570697149921; Thu, 10 Oct 2019 01:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697149; cv=none; d=google.com; s=arc-20160816; b=wBVJqjrEJJqFOJ38c0Jx2XBDZqfG+wYbyt/Q+Sh96BIkiRwBHOY3P2lxJF8AgNm+/U 3rCQuaypy7wmGPLsyQtSGQxXjftX+zNmTCOpUclzGFVX/JUiyrwC8aHAoitJiSXEnrg+ qthI0ROANwIs7+7IzXW3UFlKzEBZd4yWY5vJalpp7yv2t0ocmcg6USWv0DU1hRU9of5F eFD6EPSBp0eyX6rBoFN64AURt4QpGsPmsG3v97g8pSayTbgCaTq+f90oNw1Xm1BC/72F fhhxfTx228QnW6FoyBt0HsAyCrBJSYtSAR/pe+FivAD62gHQULMZynKRBIYyQjD4oYkb 1oGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pHChCBn5pduagwTbpJt+3KzqnG0nJpM/mMthOWRwQMc=; b=WFfoR3KwrOesGvSeaQx2OoOuDeqBr9bCxAZQsSyu8/ZcwASlEGgdL1NAIunsVLGWm9 oA+5RGNy3XknqGu7/upzHaqW86cxxXYCrCNOBTl+1BpYTRK3I9chnlJbkWaJTY3uhEMo FamFqGxS9lMR3x5BFZsG5yBBE7FpxTq1KzfaMEAfNBZ3Fg8jpoH1nBeLzJzvRwpLmQHS Ji2H4Nx91kKew1NSGAiO331WcKuypYOl+MGHcH2yq/KS+oX7CCBl2hw68qkkWRHUY9vK gl3q2/GvnzMyuZ33ATn6TzJcqfxvgX3RrkX6jobM5C1bMD8M1X+UVkU1fDSQMb26Jswj JriA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DkbegiTO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sa16si2678633ejb.356.2019.10.10.01.45.26; Thu, 10 Oct 2019 01:45:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DkbegiTO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388410AbfJJIls (ORCPT + 99 others); Thu, 10 Oct 2019 04:41:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:46302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388404AbfJJIlr (ORCPT ); Thu, 10 Oct 2019 04:41:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 152432190F; Thu, 10 Oct 2019 08:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696906; bh=AGKVJITybppG06fs8nTR/rKh/OuQGQsCKDpZoorvQhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DkbegiTOAXQfBYNqnWNnhU1b44fH/n51lr/IcLQB923sg7iqmMVXoetzvP9oUPJq1 SAth44jeE3Lg8KvFKQF1hyEI3OlibPLYCyl8cBPswhfPvudzSgwTl7dpzL2tl/Z8Ng KeK9cJrr0WACDsZXN/xY1ERjhQHnZHFeZYuA6c4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi , Sasha Levin Subject: [PATCH 5.3 097/148] fuse: fix request limit Date: Thu, 10 Oct 2019 10:35:58 +0200 Message-Id: <20191010083617.145392705@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi [ Upstream commit f22f812d5ce75a18b56073a7a63862e6ea764070 ] The size of struct fuse_req was reduced from 392B to 144B on a non-debug config, thus the sanitize_global_limit() helper was setting a larger default limit. This doesn't really reflect reduction in the memory used by requests, since the fields removed from fuse_req were added to fuse_args derived structs; e.g. sizeof(struct fuse_writepages_args) is 248B, thus resulting in slightly more memory being used for writepage requests overalll (due to using 256B slabs). Make the calculatation ignore the size of fuse_req and use the old 392B value. Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- fs/fuse/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 987877860c019..f3104db3de83a 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -823,9 +823,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; -- 2.20.1