Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1197239rwb; Wed, 26 Jul 2023 08:56:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHP2Dl/xknql+HRDrDLxPsECa8DAitCkzTplGeokPCZE5RVgs7gYHSKGs1FrXqgGrz2cX46 X-Received: by 2002:a05:6a00:1803:b0:668:6723:547b with SMTP id y3-20020a056a00180300b006686723547bmr2999962pfa.2.1690386970332; Wed, 26 Jul 2023 08:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690386970; cv=none; d=google.com; s=arc-20160816; b=fUpoHEIMnt4iG9yhZz8lGnFr/99u35MbbRM0l8dSn1XZUyXVwwWFQJyU5JjfQF4i4c QvPT2dY1Ehk4exeMLIsghICcxwiNmtp8Pz2rc68DnuUVf50dHHF+qXwxky0n981adL8V VYdiyKLwWSyYcTKVnv9osN+XVeFivCuJicKnhQHRvf7J1Y+GoSIRsSqL+14I6e7EPyX/ JFi42cDmLXiwyj9GshENngv/bdlkSc7Mit1KPN5bkwHQ222sXalojUMyjSK2bq1GfkyU Xp73V/h8m8gHrfugqLbpPr4lSAr88Sh9plxaI6WVimsARN8P7fgKIcy4/mDoidZWgzvv WUgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:to:content-language:subject:user-agent :mime-version:date:message-id; bh=uv2fxP0hSuo4HNaG7WlAMHmhC+f2YUUDDOFGk3c7lXI=; fh=l3jisK2S4QF0wzPVzgWB+QJNFIMGLWtM+4D5sLDTQMA=; b=HS5aNEN1SxSOa95Vh6QYrdCs0l45NeFBLD14XDyCRtcxWcyKT41Xzbh+gk2cSRdEcU hX+faAYj8pkh++F+s/s4g4pfKmAT7iWLx8ajAvCOHQWNRbGNwUDARoMD0tKyoOYMS6JD 9MfG1kILPyA4kk3QbctWbZLCzGNvZH3wn+lrIKz0GxkUU6raRJcn9W8KeJtKtIM2Qbvt 2l59eJkLqJol0UpGPfqDP0qDq69+l8OSBYHNq51n428Y434epNt7E3PTxKjf9XuNk1PS 3NbCZfldU4feUfWAs0F484gIAXLx13HotXE+tMQ9gI4jguabOYtgrN8VO4LdSvZNTn9M ESQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uls.co.za Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a056a00190100b006728f1913cfsi12753095pfi.336.2023.07.26.08.55.57; Wed, 26 Jul 2023 08:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uls.co.za Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234875AbjGZP00 (ORCPT + 99 others); Wed, 26 Jul 2023 11:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233909AbjGZP0Y (ORCPT ); Wed, 26 Jul 2023 11:26:24 -0400 Received: from bagheera.iewc.co.za (bagheera.iewc.co.za [IPv6:2c0f:f720:0:3::9a49:2249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8C094; Wed, 26 Jul 2023 08:26:22 -0700 (PDT) Received: from [154.73.32.4] (helo=tauri.local.uls.co.za) by bagheera.iewc.co.za with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOgP0-0000q2-1c; Wed, 26 Jul 2023 17:26:14 +0200 Received: from [192.168.1.145] by tauri.local.uls.co.za with esmtp (Exim 4.94.2) (envelope-from ) id 1qOgOz-0005NM-ER; Wed, 26 Jul 2023 17:26:13 +0200 Message-ID: <7d762c95-e4ca-d612-f70f-64789d4624cf@uls.co.za> Date: Wed, 26 Jul 2023 17:26:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] fuse: enable larger read buffers for readdir. Content-Language: en-GB To: Bernd Schubert , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230726105953.843-1-jaco@uls.co.za> From: Jaco Kroon Organization: Ultimate Linux Solutions (Pty) Ltd In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2023/07/26 15:53, Bernd Schubert wrote: > > > On 7/26/23 12:59, Jaco Kroon wrote: >> Signed-off-by: Jaco Kroon >> --- >>   fs/fuse/Kconfig   | 16 ++++++++++++++++ >>   fs/fuse/readdir.c | 42 ++++++++++++++++++++++++------------------ >>   2 files changed, 40 insertions(+), 18 deletions(-) >> >> diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig >> index 038ed0b9aaa5..0783f9ee5cd3 100644 >> --- a/fs/fuse/Kconfig >> +++ b/fs/fuse/Kconfig >> @@ -18,6 +18,22 @@ config FUSE_FS >>         If you want to develop a userspace FS, or if you want to use >>         a filesystem based on FUSE, answer Y or M. >>   +config FUSE_READDIR_ORDER >> +    int >> +    range 0 5 >> +    default 5 >> +    help >> +        readdir performance varies greatly depending on the size of >> the read. >> +        Larger buffers results in larger reads, thus fewer reads and >> higher >> +        performance in return. >> + >> +        You may want to reduce this value on seriously constrained >> memory >> +        systems where 128KiB (assuming 4KiB pages) cache pages is >> not ideal. >> + >> +        This value reprents the order of the number of pages to >> allocate (ie, >> +        the shift value).  A value of 0 is thus 1 page (4KiB) where >> 5 is 32 >> +        pages (128KiB). >> + > > I like the idea of a larger readdir size, but shouldn't that be a > server/daemon/library decision which size to use, instead of kernel > compile time? So should be part of FUSE_INIT negotiation? Yes sure, but there still needs to be a default.  And one page at a time doesn't cut it. -- snip -- >>   -    page = alloc_page(GFP_KERNEL); >> +    page = alloc_pages(GFP_KERNEL, READDIR_PAGES_ORDER); > > I guess that should become folio alloc(), one way or the other. Now I > think order 0 was chosen before to avoid risk of allocation failure. I > guess it might work to try a large size and to fall back to 0 when > that failed. Or fail back to the slower vmalloc. If this varies then a bunch of other code will become somewhat more complex, especially if one alloc succeeds, and then a follow-up succeeds. I'm not familiar with the differences between the different mechanisms available for allocation. -- snip -- > Thanks, My pleasure, Jaco