Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp225042rdb; Mon, 22 Jan 2024 01:59:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyMCuvXtlwnO0YBgqU9yZmyEfmXZj3rHTE6LdYJlWYyV0xeEOayGwtMJvm3ULX3eTELWnW X-Received: by 2002:a17:902:b487:b0:1d4:a24e:9730 with SMTP id y7-20020a170902b48700b001d4a24e9730mr1511629plr.137.1705917582580; Mon, 22 Jan 2024 01:59:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705917582; cv=pass; d=google.com; s=arc-20160816; b=0akU9YbxqLMd2Hcn8+tZc1wVcsiYKq+V3tVJNTJAxS6S9n+JV+Zndb055mz8gDEs6/ j1ap3NWvzW9enFCQMh3GEobQWbFoP0T1aMa7b3e0i4goXPaJ6TGyPmXKtES+Qy5lU6HR D3KzqesvcxRpRwf7Echo38pHIPmItz1BG2cTF8y7SqJkFuajquGH7mYMrd5rlcSLp4aZ x3JvmJc8LbB7xXPaBQpuu0BVRrXQVh3y0Z2hEDQpaQIeqcX9GOOZ2RdhBW667UAyQI1s YehCnsRFW/ntKHBPeIP01C4ixTp8DAFOOGurSTyIqSMInabElL2A5WR3d2c8Xdd3Hhqq M4xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=6o+Xk4Nptk51ACL1wIzsePpvylPK/qaXfiVzI9Ep67I=; fh=rQZfYNIbRH5O97R3akrrUpBKDCixhZjS09QB4BHuQ4g=; b=XL/GuvyhozBxF50eMbF2mwgqjclgrTdLjqeuIdbMc+jBcW2D8grHQmXW3XTbYHxP7Z p8Hmafh0gD4f502Ifw0bnCsPCK6TkJJLgf+rgXNMyBaj4uEES5/zeX32lNmVcZSNJQuu CI95/DCx/F4NnFLG16er3tPkNy23oO24C3VvglMWmUk6X78J175vjy/FvDETEbkD7uZD uWA7uqhdVKLXow3wHpTFjlPBp2QV/SLSKQQE4JyBQSmrA0RnsIPZ7s48QyQDVYMWf1hY RjiZ3i01HwfC4SOoc1hVQVSL13GxYCEgLr0LFw8JItNFHjpBYDhaQXlGFSAxm0rD7DtH J8VQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32643-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d13-20020a170903230d00b001d7166e8ef9si6684987plh.226.2024.01.22.01.59.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 01:59:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32643-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C9706B238CA for ; Mon, 22 Jan 2024 09:43:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAB5E39AEA; Mon, 22 Jan 2024 09:43:32 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F70CF500; Mon, 22 Jan 2024 09:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705916612; cv=none; b=oCj27GRGp9z7OR69lSUiFlN2GeOir03OAAuBtqtQTJvTwzDG3oSIo1XlzR0foe5jGmBMlO9eGWqGoOhpPs/7qhGHbmM0O6tah6IoruMDHrsrrPt9rmqZGyrdjoZJaZVJ2EPMLRdejAG6xPP0O2UtBiZ60cKm4cM6DcSkiyVZixw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705916612; c=relaxed/simple; bh=Tb9Wt1hmy4GfQJBjbVvHV0UhlFWCkpUYxqBD5bV+Ce8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Au6oxd+2n5mX5YGjgqWzctL6fr9iQDQXyByRs4O68lbjoxNmulJelfkpHlsAEVVdHUi155Bok+bLfXBTygUXxjdm1Oc7gZZ6LkPLwb2qBa/cNADqrpQGlNYrDt1i2IRMS8Rezo/5RDz7g6mqGOHwh0Vd9lXAGSZCmiFMTy+Bxe4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TJQJ31vvfz1wnBS; Mon, 22 Jan 2024 17:42:59 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id 76E3D1404FC; Mon, 22 Jan 2024 17:43:05 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Jan 2024 17:42:59 +0800 From: Baokun Li To: CC: , , , , , , , , , , Subject: [PATCH 0/2] fs: make the i_size_read/write helpers be smp_load_acquire/store_release() Date: Mon, 22 Jan 2024 17:45:34 +0800 Message-ID: <20240122094536.198454-1-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500021.china.huawei.com (7.185.36.21) This patchset follows the linus suggestion to make the i_size_read/write helpers be smp_load_acquire/store_release(), after which the extra smp_rmb in filemap_read() is no longer needed, so it is removed. Functional tests were performed and no new problems were found. Here are the results of unixbench tests based on 6.7.0-next-20240118 on arm64, with some degradation in single-threading and some optimization in multi-threading, but overall the impact is not significant. ### 72 CPUs in system; running 1 parallel copy of tests System Benchmarks Index Values | base | patched | cmp | --------------------------------------|---------|---------|--------| Dhrystone 2 using register variables | 3635.06 | 3596.3 | -1.07% | Double-Precision Whetstone | 808.58 | 808.58 | 0.00% | Execl Throughput | 623.52 | 618.1 | -0.87% | File Copy 1024 bufsize 2000 maxblocks | 1715.82 | 1668.58 | -2.75% | File Copy 256 bufsize 500 maxblocks | 1320.98 | 1250.16 | -5.36% | File Copy 4096 bufsize 8000 maxblocks | 2639.36 | 2488.48 | -5.72% | Pipe Throughput | 869.06 | 872.3 | 0.37% | Pipe-based Context Switching | 106.26 | 117.22 | 10.31% | Process Creation | 247.72 | 246.74 | -0.40% | Shell Scripts (1 concurrent) | 1234.98 | 1226 | -0.73% | Shell Scripts (8 concurrent) | 6893.96 | 6210.46 | -9.91% | System Call Overhead | 493.72 | 494.28 | 0.11% | --------------------------------------|---------|---------|--------| Total | 1003.92 | 989.58 | -1.43% | ### 72 CPUs in system; running 72 parallel copy of tests System Benchmarks Index Values | base | patched | cmp | --------------------------------------|-----------|-----------|--------| Dhrystone 2 using register variables | 260471.88 | 258065.04 | -0.92% | Double-Precision Whetstone | 58212.32 | 58219.3 | 0.01% | Execl Throughput | 6954.7 | 7444.08 | 7.04% | File Copy 1024 bufsize 2000 maxblocks | 64244.74 | 64618.24 | 0.58% | File Copy 256 bufsize 500 maxblocks | 89933.8 | 87026.38 | -3.23% | File Copy 4096 bufsize 8000 maxblocks | 79808.14 | 81916.42 | 2.64% | Pipe Throughput | 62174.38 | 62389.74 | 0.35% | Pipe-based Context Switching | 27239.28 | 27887.24 | 2.38% | Process Creation | 3551.28 | 3800.54 | 7.02% | Shell Scripts (1 concurrent) | 19212.26 | 20749.34 | 8.00% | Shell Scripts (8 concurrent) | 20842.02 | 21958.12 | 5.36% | System Call Overhead | 35328.24 | 35451.68 | 0.35% | --------------------------------------|-----------|-----------|--------| Total | 35592.42 | 36450.36 | 2.41% | Baokun Li (2): fs: make the i_size_read/write helpers be smp_load_acquire/store_release() Revert "mm/filemap: avoid buffered read/write race to read inconsistent data" include/linux/fs.h | 10 ++++++++-- mm/filemap.c | 9 --------- 2 files changed, 8 insertions(+), 11 deletions(-) -- 2.31.1