Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp392293rdb; Mon, 18 Sep 2023 20:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNTKWQuw6Jrox4It9IMjn4IXcuEvXVMDTDmMpx6wm3TOfTXbBZGQKi9g4mAclt/cTcUSag X-Received: by 2002:a05:6a00:b44:b0:68f:c078:b0c9 with SMTP id p4-20020a056a000b4400b0068fc078b0c9mr1727409pfo.11.1695093802442; Mon, 18 Sep 2023 20:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695093802; cv=none; d=google.com; s=arc-20160816; b=zfN+mjFFADKkzVZPyCFYSZnvdRyiGHo1KhFMY5H36qF4tfbXG5sakQoF+WedqjmqpQ Urw8hkmoYY05/LJHHj5bn7W5f4uSaOWh9Jsx2YKMA/isy69T3lo5bM5LsLAEGYTML6a/ ObwdkeQ2B/8ZLgNx/hpwQTd+4Q50TE7UNeobmd5OdZDzGDoy/yS/0i0JsuVBXNR945v6 w4GLKTPHK8k7W39tL/y10rGM6rRaWZuFe2EU8J+Cdn8J1k7rXfGhrPpBpwfQ1r25lhEh hY7IDJ9/rYcEX+Bysxc857y9Ww7bZHg7/THY0hD1yxNdbHx1OouIdgbnZ3MKZ6JtxVEE W7Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=V0+nuwsyM1kk/6mlc13KiEQ+BQBqM4xoevVWS+2RhsY=; fh=O9pJqD0ctHC2GLVQPK7aBpQb1I0FYTrHiCVuXI51eDs=; b=ePQBD65AA4BcK6/2JpPxsVvUtB9OCfrH0w6n5AFFFBPJ1JouUiOMyRsE9Yrn38h65d ypPAKVSuj3YHKGFsej09AeVr4YIW8XMaNYlrIVr8o1FENlOhK5SrfDbjdDR15YYmB17N 7MCOlIUwS6g3xP7h4TjpQU3LzySENF/ztNj1c4WjPQQlwFJtyS9UviiLjhE5nMqOMkxa 4WxrF3ytHZ6U3UZmEuoTlDaTxhINtxgl98CT/S9Aey6gIj36hqZtwn7nRJ7vlywiwc0C 2Duho933gZSpvRj6Idn+6lZ8jl7gU9LmSx1ZDJiH4sQG/7m1R63cH/u0I5V2NVERU2AU HlqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F5C+B6bJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u20-20020a056a00125400b006901504b6a3si9135605pfi.153.2023.09.18.20.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 20:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F5C+B6bJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 761A880C0554; Mon, 18 Sep 2023 20:21:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbjISDVr (ORCPT + 99 others); Mon, 18 Sep 2023 23:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231276AbjISDVp (ORCPT ); Mon, 18 Sep 2023 23:21:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF7710E; Mon, 18 Sep 2023 20:21:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1752AC433C8; Tue, 19 Sep 2023 03:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695093699; bh=ntnvdNgkPFJ/oCD4R+vKB36VPnMr86Fi3aB8nZw/9uQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F5C+B6bJQ7OP0XY2LDoG3a8uJqbs+502QTyDR1rOqTOWY4hDs076kNS4PU8HLxBat XS/Tmtlc5y8qjyUGCh4ibAk0p88Jgqac4S5X/AWZwV7Ja9YvfXMgMn5plncE1JSyjJ pct0CdY+rbnHYlAmytEINhobT1Cw5qXRToNoCSeVkhl/r8lwbyCuztuzoQyZS9NZVk c+sj5COXrRt0U/NDIhJA+zophJvRccqJ0/gzdiAJMS9gwjaKjeNAxXYkwsQ658ECSc P+irap/K7l1jN0+Ni/SE9K0Nd0KljsLjuBkCTljWFKZpDSagf76cpp5ygctP5Ad22i +ihjaYBCdNGEQ== Date: Mon, 18 Sep 2023 20:21:38 -0700 From: "Darrick J. Wong" To: Wang Jianchao , Chandan Babu R Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3] xfs: use roundup_pow_of_two instead of ffs during xlog_find_tail Message-ID: <20230919032138.GC348037@frogsfrogsfrogs> References: <63b3742c-0efe-c096-c737-a0e0419480bd@outlook.com> <59dd15dd-5b35-871d-6d3a-ec779975b089@outlook.com> <0a72f462-8b8e-4dec-6ce4-f52e33423957@outlook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 20:21:48 -0700 (PDT) On Tue, Sep 19, 2023 at 10:06:56AM +0800, Wang Jianchao wrote: > Ping ? Do I need other update on this patch ? Nope, I think this is ok... > Thanks > Jianchao > > On 2023/9/13 09:38, Wang Jianchao wrote: > > > > In our production environment, we find that mounting a 500M /boot > > which is umount cleanly needs ~6s. One cause is that ffs() is > > used by xlog_write_log_records() to decide the buffer size. It > > can cause a lot of small IO easily when xlog_clear_stale_blocks() > > needs to wrap around the end of log area and log head block is > > not power of two. Things are similar in xlog_find_verify_cycle(). > > > > The code is able to handed bigger buffer very well, we can use > > roundup_pow_of_two() to replace ffs() directly to avoid small > > and sychronous IOs. > > > > Reviewed-by: Dave Chinner > > Signed-off-by: Wang Jianchao ...so let's see if the release manager will take this patch. Chandan? Could you pull in the various one-off patches floating around on the list that have passed review? ;) Reviewed-by: Darrick J. Wong PS: If you'd like to send a pull request to push things along, please do --D > > --- > > > > Changes in V2: > > - Move change log below "---" > > - Add reviewed-by Dave Chinner tag > > > > Changes in V1: > > - Also replace the ffs in xlog_find_verify_cycle() > > > > fs/xfs/xfs_log_recover.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c > > index 82c81d20459d..13b94d2e605b 100644 > > --- a/fs/xfs/xfs_log_recover.c > > +++ b/fs/xfs/xfs_log_recover.c > > @@ -329,7 +329,7 @@ xlog_find_verify_cycle( > > * try a smaller size. We need to be able to read at least > > * a log sector, or we're out of luck. > > */ > > - bufblks = 1 << ffs(nbblks); > > + bufblks = roundup_pow_of_two(nbblks); > > while (bufblks > log->l_logBBsize) > > bufblks >>= 1; > > while (!(buffer = xlog_alloc_buffer(log, bufblks))) { > > @@ -1528,7 +1528,7 @@ xlog_write_log_records( > > * a smaller size. We need to be able to write at least a > > * log sector, or we're out of luck. > > */ > > - bufblks = 1 << ffs(blocks); > > + bufblks = roundup_pow_of_two(blocks); > > while (bufblks > log->l_logBBsize) > > bufblks >>= 1; > > while (!(buffer = xlog_alloc_buffer(log, bufblks))) {