Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22012159rwd; Fri, 30 Jun 2023 02:42:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aPpq+kdHTF+2Ul5PTvyb3jqXErTSsuiweRdbO/WP+Ci0L1aBRmXqnnsYbJaB/w+TYO6Zi X-Received: by 2002:a05:6a20:7487:b0:11f:33da:56ec with SMTP id p7-20020a056a20748700b0011f33da56ecmr1952662pzd.27.1688118146247; Fri, 30 Jun 2023 02:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688118146; cv=none; d=google.com; s=arc-20160816; b=XXnQhoxkDMgD9LjNE92n7UkXF2Q/vzfxKjgrvuDIulh8GpjEw55rOfJ5is5ozhSYhK chtJL0g657svX9cKmYDlu2SOTCglEjbh9NGbLzebZlKlO1YjqGsWCRXZqbrNJ95XEMFP /reCopWWuIqv0loKFkF/cxIwq1n4vQ4XaMCAzTieOAKxh5Rh3StNtju22kbK7+7Gv33Y nF03omItWg+RaeDWwtFUKFc0phULMbB4WWK9Wgn3OQASxz5jB9t55YzayR25jE+dGdHM f/IEY+dXOHhlBPCSUBqgLBLF5tpdOrIdwRXxqTl74WNt/y3gZC7F8KiJaHlZPJ+rbL6N YcZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=BJ38UgnyoxAEH8/B6Y9mwx/JGS41JBB37gZc+eiCgw0=; fh=F8UxqkUwyqOyi5ipH8p3Ao4qSdoekFxpDSTpgDPdUJg=; b=ruSOm3v+uMHo620f9VrFBgrTawRh4j2O/VSKY0q0hGGY1+CXq4aa2lZTbAw1nRJmx6 m4KeD/uDD4kw4JO9DJ0bUeSRHfVo+3Pz/BMF6/TInL8q+hElYEK0QWKJ1gyM1BMeRm0x 9Kfbb5d2x6XHZ9VDwdT4lsBCE0BFdP/hMqkaW73PLpaQK/NVuT8JtVr8CV6lvNf7AeRq GYCYPDtLYfRtGDmudvXi+MNQUQLLERc4103ghQf6VIgH1RjF+Xg5iQpYLHlKGWiSfvap jt0cfL4Wz9mkF1qLC7QUFKbXEuo1TPs8XKvZTd4BtUnUiW6+5C3dts5ds+j8bw+FmMsU r1uw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a170902c94300b001b66f00d40csi2897032pla.351.2023.06.30.02.42.14; Fri, 30 Jun 2023 02:42:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbjF3J2H (ORCPT + 99 others); Fri, 30 Jun 2023 05:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbjF3J2D (ORCPT ); Fri, 30 Jun 2023 05:28:03 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22D103585; Fri, 30 Jun 2023 02:27:59 -0700 (PDT) X-UUID: 49c20d01bb1742a2929c98f6673a3996-20230630 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:dbfa2abb-c31d-4064-9571-2b6cf7634457,IP:5,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:25 X-CID-INFO: VERSION:1.1.27,REQID:dbfa2abb-c31d-4064-9571-2b6cf7634457,IP:5,URL :0,TC:0,Content:0,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:25 X-CID-META: VersionHash:01c9525,CLOUDID:e86f6a0d-26a8-467f-b838-f99719a9c083,B ulkID:230630172253SNXIHJA1,BulkQuantity:1,Recheck:0,SF:19|44|38|24|17|102, TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0,O SI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 49c20d01bb1742a2929c98f6673a3996-20230630 X-User: zenghongling@kylinos.cn Received: from localhost.localdomain.localdomain [(112.64.161.44)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 551433021; Fri, 30 Jun 2023 17:27:45 +0800 From: zenghongling To: hch@infradead.org, darrick.wong@oracle.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zhongling0719@126.com, zenghongling Subject: [PATCH] fs: Optimize unixbench's file copy test Date: Fri, 30 Jun 2023 17:28:23 +0800 Message-Id: <1688117303-8294-1-git-send-email-zenghongling@kylinos.cn> X-Mailer: git-send-email 2.1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 The iomap_set_range_uptodate function checks if the file is a private mapping,and if it is, it needs to do something about it.UnixBench's file copy tests are mostly share mapping, such a check would reduce file copy scores, so we added the unlikely macro for optimization. and the score of file copy can be improved after branch optimization. As follows: ./Run -c 8 -i 3 fstime fsbuffer fsdisk Before the optimization System Benchmarks Partial Index BASELINE RESULT INDEX File Copy 1024 bufsize 2000 maxblocks 3960.0 689276.0 1740.6 File Copy 256 bufsize 500 maxblocks 1655.0 204133.0 1233.4 File Copy 4096 bufsize 8000 maxblocks 5800.0 1526945.0 2632.7 ======== System Benchmarks Index Score (Partial Only) 1781.3 After the optimization System Benchmarks Partial Index BASELINE RESULT INDEX File Copy 1024 bufsize 2000 maxblocks 3960.0 741524.0 1872.5 File Copy 256 bufsize 500 maxblocks 1655.0 208334.0 1258.8 File Copy 4096 bufsize 8000 maxblocks 5800.0 1641660.0 2830.4 ======== System Benchmarks Index Score (Partial Only) 1882.6 Signed-off-by: zenghongling --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 53cd7b2..35a50c2 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -148,7 +148,7 @@ iomap_set_range_uptodate(struct page *page, unsigned off, unsigned len) if (PageError(page)) return; - if (page_has_private(page)) + if (unlikely(page_has_private(page))) iomap_iop_set_range_uptodate(page, off, len); else SetPageUptodate(page); -- 2.1.0