Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3047266rdb; Tue, 12 Sep 2023 23:30:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlxKi+4ONZBri1Zw77OStTwVy84OaQmZ1sxvWxwS/SPV1OKTwYIruJetfuMqtWWIvcKVrY X-Received: by 2002:a05:6808:e84:b0:3a7:366f:3b01 with SMTP id k4-20020a0568080e8400b003a7366f3b01mr2085913oil.33.1694586648155; Tue, 12 Sep 2023 23:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694586648; cv=none; d=google.com; s=arc-20160816; b=UbBA1srxAIXEXVGKg38v+H5TySkevd7Y2IfHWd+m9468mC4MOAqcmdXNLYpB8Ec1BT w7wGhLL5p46Mrr+POZTRik9i0UaMXnwedHdBgRKZ7RJNfyGkjicOJo4WSeo3plsyFhEN 8k7N5kvWQ04MFtxhJtRyJFu0qqF72TdRbJ9+FcZi6vnKmWe94Yac+pFr6DDALAGw46wl Dxxg1HKxpkRTg+IvzCAQ97PaFzFIwDhmB2QUDSQBdqY+I7DUXmXT++Votr7wvbVJIAY7 FchlPcuHytg7H7hpyKjRB9ux5pVEAR3gmzBr5SZ7AsRxpfdaCSsRkF0aN1XspFr+B1PW bCKw== 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=ah5Op9UHzow67q6STiy57YfblgAJa0Z+MzvCC70G7KA=; fh=b+MOKbE1jh1GguYSKCS5u98PfafHh5CMBXAsldavwHw=; b=d9pTx081OqIGb+jb3HmUXYJNSfKq+sr+ofM7PdKkls0k73tCR3By5ZeXDPPoHzx0YX DpNRfbEy/OHCMkmbijmoEpDvcxnJT8tT0kBhQ78zMqllOy5NvjAXQ9d4a8ssjNtGYnpG 0A1IEMs8AE+U1/7WrVaE03t0JT2lbPCbGiKYUMEM4mlvO1RhqV+ESEQ7jFQVYmK/JA4m n1OHZNHwI2bqeD0WOVEOlzBxvRBoQs3VjlqBa887Pv+IKN0uncgu8W6NRCdVyUsqx5rL R+0hfpFrGP5nwlc8vHAqp5kOzKywByXo9wqMBil6axQgXucLkhnOyhK5IjwlQTU24UtB zEHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b="jNrYjBG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l129-20020a633e87000000b005741597ab7fsi9491566pga.96.2023.09.12.23.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 23:30:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b="jNrYjBG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EAF6E8244CB0; Tue, 12 Sep 2023 15:44:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbjILWoq (ORCPT + 99 others); Tue, 12 Sep 2023 18:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235041AbjILWop (ORCPT ); Tue, 12 Sep 2023 18:44:45 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EBBE10EB for ; Tue, 12 Sep 2023 15:44:42 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c3d8fb23d9so9079645ad.0 for ; Tue, 12 Sep 2023 15:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1694558681; x=1695163481; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ah5Op9UHzow67q6STiy57YfblgAJa0Z+MzvCC70G7KA=; b=jNrYjBG/wjffg70U1TBRnyQx74GjrLWbL9+B4S24Xlc190bNhNUX11uVMIoo2WoMGn RbXYIME3rJfjszbE4zOAPsPoIS0mhSqjDBepBhGyBRj7bzmJ0IV1dR2VNvLAHOlrqly+ TTTegmVLNml1EVQInH+mJ4reT33aG/vthATMp8eDuDCCarE2N3tz+/eSAfDXowu+gYi5 cnB6hdnuz+6Vk2nrbXv/9KsinxVxCZle2d2+ScpPe+8UtovNpmt+3znnhGFr36rizLWQ hXOUw6YVaPUYvHeSoyoBJuuJs1KSXjQBjWMxxAAtNBfNIvYIqewLwmna/y0l2jUi/JPu QtjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558681; x=1695163481; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ah5Op9UHzow67q6STiy57YfblgAJa0Z+MzvCC70G7KA=; b=TC408P3xdAdBUg45AkGaXVNlRmkphD/3+j3p1VrGVMIspIhrz7p6+pjiE6PtKasZBf F/Swiwm10cLUBNJkF6SMrKvsyq3oftHsEzo1ThAUqR2NPJ6EmJ1vj6LRWRlcjIJqT/5B sSIiRX/4NVDBjuOuYcOYs0EodPhi2UybKVsauCRo5Dy0s/fsqOcDbLeKDO0YLvY4VvKX P3xCZ/55htM3KxiEDtmC586jl5RzDqno6MLajdm9HCynJtctRltizXIQ3E3Hu8bZOjfy JA9HStdfj5QMEbNZLYlwjzCgCAOFyBRtAYtM7RpEl60+sIgjleCvfTZC5blGYRgDCxW2 A/Vw== X-Gm-Message-State: AOJu0YzEukSbUFDQECIkcaZEyxEFqfFFGd+LH7j8YIPTKHBUXwgzlxrz lTBDosS680xGYVsfT3Yp48bw+g== X-Received: by 2002:a17:903:120d:b0:1bb:994c:bc43 with SMTP id l13-20020a170903120d00b001bb994cbc43mr1283734plh.18.1694558681467; Tue, 12 Sep 2023 15:44:41 -0700 (PDT) Received: from dread.disaster.area (pa49-195-66-88.pa.nsw.optusnet.com.au. [49.195.66.88]) by smtp.gmail.com with ESMTPSA id d4-20020a170902c18400b001bba3a4888bsm8957634pld.102.2023.09.12.15.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:44:40 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qgC7Z-00EPVj-2t; Wed, 13 Sep 2023 08:44:37 +1000 Date: Wed, 13 Sep 2023 08:44:37 +1000 From: Dave Chinner To: Wang Jianchao Cc: djwong@kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] xfs: use roundup_pow_of_two instead of ffs during xlog_find_tail Message-ID: References: <63b3742c-0efe-c096-c737-a0e0419480bd@outlook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 15:44:51 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email On Tue, Sep 12, 2023 at 03:20:56PM +0800, 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. > > Changes in V1: > - Also replace the ffs in xlog_find_verify_cycle() Change logs go either below the --- line or in the cover letter, not the commit itself. Other than that, the change looks ok. The use of ffs() was added in 2002 simply to make buffers a power-of-2 size. I don't think it had anything to do with trying to maximise the actual buffer size at all, otherwise it would have made to use fls() like roundup_pow_of_two() does... Reviewed-by: Dave Chinner -- Dave Chinner david@fromorbit.com