Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2992189rdb; Tue, 12 Sep 2023 20:35:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtPcN2sKLhXIQJA7m5gnLJEChYT/vdGH4u0Y/dCtBpUKiA4s6giuFQyGwBSGJDgOS1mvas X-Received: by 2002:a17:902:76c9:b0:1bc:10cf:50d8 with SMTP id j9-20020a17090276c900b001bc10cf50d8mr1570339plt.23.1694576117307; Tue, 12 Sep 2023 20:35:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694576117; cv=pass; d=google.com; s=arc-20160816; b=MkCagQ7q5SzU7CrqZuSUxJLA18cQUlQjiv3yg93r01RrHFmHjm7dtS52shDwKvRQTl ND7zn1oe3q56uEdEaXb2s50RPyT90cyu8Vl/3jNpV5A3cwfsv9ibuwpmTWsxU0rI6uuD 0pPLV9oxJ7bGd7RaCy6c1s4q02bEPnebtXlYL9Jr3HogC1e/QZ+GyOXNR1ph0GxJRb3C YAvjtjMmhPkrIrlwWKkqNdRkxcsPXNpEg8KAOGJuTm+3ZRQAwcOa+1k4oyRAR2IrsAGA CfR/lQ2oFvG4Z64+4lRRFVQUHqm88nX7b76Z0+aUU+pbKXltvrjT9hFDUgm0A1i1Wc9J QN4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=iXVLcwbqLjqM2QNMeqz+Jj6XoD9n2u/dKbetrraAbh4=; fh=YJjb4YgrCH8w8c5l97Nn+rqF+h3UOzH949oQLX5NzZU=; b=vgbr5vphzwkx1AZ5yI261s3wDe9wZMV+xACVvxCQ61SW09B7m19YaxBgXchF4gBoJ1 GFwcdEmR/amV/+m9Pi35EiYbelMO+3+wjGrzCJHrT75+PqjH2EMZwv92ya/+4OrXv9yA 0uGHZs0YCEGjNmpFiTNNFLozIjj4CPWBlOEjBMjHw/C5D4bXiGCIlat+G8ydTQTEDEsi SbDqOEiIFcNh0pf/08URA7WkVBe6U/TUrPfQb5RJbrNRyvrzbrDhn4LnEEgeDN19NHyu b7urjTZhHD4WG0i2jsXyowQSjQfBoLpqQdv4FayazkW5BN2HaMNHOW/utelz2iVlXDJL jTUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b="m/8Dc5Bq"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l7-20020a170903244700b001c3c94d212fsi3583859pls.97.2023.09.12.20.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 20:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b="m/8Dc5Bq"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 4ED70825F17F; Tue, 12 Sep 2023 18:35:15 -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 S238062AbjIMBfG (ORCPT + 99 others); Tue, 12 Sep 2023 21:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231414AbjIMBfF (ORCPT ); Tue, 12 Sep 2023 21:35:05 -0400 Received: from BL0PR02CU006.outbound.protection.outlook.com (mail-eastusazolkn19013050.outbound.protection.outlook.com [52.103.11.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A4110F6; Tue, 12 Sep 2023 18:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlF2m4rLdwr4XT9CCwkeszfRvnn1P2V6rqjCX0Miob3IZPnKiW6nNsL5cCkILTaDfKZMPa6ffqhXFejrI0ytHbbQfZ9Gpt/kYilImLBcg+CieVl1rgkUWF1hlQioAKakj+A1NCTOAEAEuNfV0T1A07kk0fbTDs50YzKwBbQgxGg3I+BraFl3DsApZ5WMAlxERY+aHzvCGvUq56uH4fNVqsTYPo5KIt+5W7QNgwGgu11uh0YjAeOR4jkvZ8NodGRO6RHX4tZf++0ZF3DXh1ocgVeYFZ517sLpUvimJAucTErmDgwMLWSdvblsiRqEDoW4JwJodOLwksbwmUSm4AKu/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iXVLcwbqLjqM2QNMeqz+Jj6XoD9n2u/dKbetrraAbh4=; b=cRNK3qidcrWdxCVY1bnu9KP5iFKPOGMcLigBtuS9tYhcyWyMvvEPxIqIpKrI7y6c4Pu4yVlDhgYJoZSJng0gCRvsHEtK+WGZIkJRugbCIY1RaqxNdXb3eByFFFvr74Qx9Id9eitqJYEAGJF+laY1ydLn1Q8K7T32CgGB7QHySGXFa947deS9XeOYLpfQySHEcG4BdgweVmQc3SwTCE/yiikaDXHmCKqN1mqEVODFAsZZ/jtbnfEcTpNe97q+0EnL/HZCwkuSbys1n7WRWrAXJeNtap7dGdxxfi+T6VYbNXyIh6MOy4LNRLShkJPLz+RkaUS5I4M3n9UpFnqEWQAzrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iXVLcwbqLjqM2QNMeqz+Jj6XoD9n2u/dKbetrraAbh4=; b=m/8Dc5Bq4P71taW4zuduS4z5df9TNl1k98yLKvYzxGlC2Y8wycWTS18YTxM/rsBuf50SMYv10kTLLA5QQuPYEcRZzaH5xDdafRxJqIFS1E7aqFFhFHC6X4sYa3XirSAa1sTMLcNqIOxEl2xBJWneSv1WReBvkEoyHNe5ySUEnSsFXzjBhkLcJ5FXUcukoCZ/a1blPK+D2+VUVPwePQ6Oejyw/VqVXdO3rZZifEYkjoDRRkOWHjKuSbdKHKQO6Q/w6SQR3Ji8YMBYtXwg9Hgi2xW54EBsqYb2Z4qOO7lEl9kgY4XOcqhZSzSiN7WQ0L6L9J/XGhTfpSqjkDyWruayVg== Received: from CY8PR05MB9378.namprd05.prod.outlook.com (2603:10b6:930:91::8) by PH7PR05MB9858.namprd05.prod.outlook.com (2603:10b6:510:2b2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Wed, 13 Sep 2023 01:34:59 +0000 Received: from CY8PR05MB9378.namprd05.prod.outlook.com ([fe80::3ea2:7971:7c79:b09f]) by CY8PR05MB9378.namprd05.prod.outlook.com ([fe80::3ea2:7971:7c79:b09f%3]) with mapi id 15.20.6745.034; Wed, 13 Sep 2023 01:34:59 +0000 Message-ID: Date: Wed, 13 Sep 2023 09:33:32 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH V2] xfs: use roundup_pow_of_two instead of ffs during xlog_find_tail To: Dave Chinner Cc: djwong@kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <63b3742c-0efe-c096-c737-a0e0419480bd@outlook.com> Content-Language: en-US From: Wang Jianchao In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [nyvBSkCY+UKLxaFi6gHn4vmmLdTrOhUbHCzVRHraC64=] X-ClientProxiedBy: PS2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:300:58::22) To CY8PR05MB9378.namprd05.prod.outlook.com (2603:10b6:930:91::8) X-Microsoft-Original-Message-ID: <3f6fe965-67f5-c7f8-4468-decc8f0ad3bc@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR05MB9378:EE_|PH7PR05MB9858:EE_ X-MS-Office365-Filtering-Correlation-Id: 668c6587-e50a-468a-f1bc-08dbb3f9a3ed X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: diCbBEsFGOyw6IcpWfOoRZoFb9b9RAGB9SgrYRRn6zsA4t5sz166TG3BNXD7pnfpCcWAVA++mkr3OzGzuHbwhyq2OsA4L6TRvafqqaySbA6gMGOQFLcFciL4fTBRl0rpxr4El8kQ5qq+k34Ao3NRI1XQqroZWwWngRoOCzTLuHtUBLz6Uym4j5Z3/Bbd3rW2AKHwnHw3ccXN1rTdMY/EzbeA/aDo2jGlqO7Psol/imWz8YKn6hbW0sPhu9bKWW+GuHj1IPr8KYqRq4yRWD4INRpFyh2ewyiRsFIXIq3XKQR+GlEIkBXTZTmmxZGkHlTpq+zrfCue9wbzYBfeaHu+ZlbTPn9YLESW2de4FK2sEakkLCG6WQjpwar5SqxqvLqDQMA+Qq2VvidXHKdiLDjGmlOZ4BocHOOQxWWOX8qx3x6cf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p6WUVnT3NWZHBzUHFsV3c1Z1NaMTdk?= =?utf-8?Q?7ydiHmQL7ug5iske8tM6wHyD0G0LnBeOMJcDkrmnoiQ8=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 668c6587-e50a-468a-f1bc-08dbb3f9a3ed X-MS-Exchange-CrossTenant-AuthSource: CY8PR05MB9378.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 01:34:59.2305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR05MB9858 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 18:35:15 -0700 (PDT) X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FORGED_MUA_MOZILLA,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 2023/9/13 06:44, Dave Chinner wrote: > 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. OK > > 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 > Thanks Jianchao