Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp881814lqs; Tue, 5 Mar 2024 22:19:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVbOrnhXmz+9++b/EBGqb4DVk40yhhGgnrAEtZt/DkoQsXt1YNHzWyfKXyCPer/8a4p3uK3HO44tBrbYJUytVJGEmwRuydKoygnrGdzqg== X-Google-Smtp-Source: AGHT+IGy3Cj3t5toNSPACMqyi6JC+fDrJLkzVYYTmIMJkLd+XzVj4dhNKw54Ry2A4yyQqNCqW6O6 X-Received: by 2002:a05:6a00:8d4:b0:6e6:4517:8048 with SMTP id s20-20020a056a0008d400b006e645178048mr3752474pfu.12.1709705939798; Tue, 05 Mar 2024 22:18:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709705939; cv=pass; d=google.com; s=arc-20160816; b=Ms2vbzKFy0wIQkqfEc7gqBthXBFuwNNHiS2es7A3qhPK3/DrcgNoP+ZvIQCLGt90gF nqBerL/3PC8Ypc1aTEd9hjtv3y/wbqZSYGugeHZ3yoeluryVK5oTyPGnZLL2REBvjJMX mLnMxoXpHqQf62EkGXgdIsMQAd7lj5952KuC19vqPQRJnXmtbg/Sw7ZuMhStXA+sn8sT Pit/Q3lfr26cUZFVT6936yoj35kgKbjS7KiD2npSoz4jtiIarTvGGILTgCqyt8uvIKkc KaHQMPpU4DQOMHh/4IUJOFLTxYhrbXiow6QLijnWfcB6Xwp+XBLaqqctsk5KCtSR8A05 iWtw== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=o1IdKXHOLm+FhCHqPY1KVFuc79+6/niVWruHJSDCx3g=; fh=/Ex+0L2gl9hTdbSrNbnGh03pLTsKVcd9P8X9ngpl89Q=; b=heFiKIdujVdRiZEPPqQGDIg+ecKDdtJs5C4ZqT3xl4VYcPBlKICus8KI2VbQ18vSPX OiDQqURgC5F383bc92lCkHm0RdhMUzIjy1ASmM5BqoNJOKxG+vChD1wW3KdeI4kPx156 GtdYyLRPXwuANb+spaDXC43QVwWYPOBgmR1XeKZwSw3KbVWa/O66MB+oTql0Tf+UlTNI /Nm9FkVpuhO566Cz5jSbk4dAGd32jrL8SNGn9l/QSCdBSZRPjwzYp5G0nBaja6H2RRjc 2M74ymN40pecmN6DXDssAwfc9yBXMeIfFn0VMxgx9CCeHcGcNfm6/J70kwDp2se7CAHv AeVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zhaoxin.com); spf=pass (google.com: domain of linux-kernel+bounces-93375-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93375-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 17-20020a631751000000b005e46e6ba6cdsi11336796pgx.391.2024.03.05.22.18.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 22:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93375-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=zhaoxin.com); spf=pass (google.com: domain of linux-kernel+bounces-93375-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93375-linux.lists.archive=gmail.com@vger.kernel.org" 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 179ACB260C2 for ; Wed, 6 Mar 2024 06:16:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E4651BF20; Wed, 6 Mar 2024 06:16:38 +0000 (UTC) Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) (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 2486A1BDD0 for ; Wed, 6 Mar 2024 06:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.110.167.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709705798; cv=none; b=FjsMRfM2vLDwNAbHvD1HV/wOClyavsnFjuomLkD+C4txbmdMC3ssXESr9RwqG2LAldyu5fCOQI36L+dkkJFESB3Fcl7WWEkLZQnock50GB10pdpRuZrEmq331BW18aUJt2PBTH8WObDwK6rfgxoIiHnxLg8VfS5cRD0ID6NrLC4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709705798; c=relaxed/simple; bh=l47ouKNP0igEWsbz7oOYX4il4wC7fxvpczOytLXwBJ0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UHgHfehwr+IkYTEK2jJIvUfTsiXOnTotCEzdpmsLXaZYvEB13/OGBg4Oiy/CpIfJ9mRio+roz3Rz659idX0UsisrBaT0kPQkebq0UfffduYD7DYIpiC6XZ0Wk7tjLW/0NOjQkk42FBHmBxwVPPPd1pTIVmppORGgwsdgIKe/8Do= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com; spf=pass smtp.mailfrom=zhaoxin.com; arc=none smtp.client-ip=203.110.167.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zhaoxin.com X-ASG-Debug-ID: 1709705784-1eb14e2b8301870001-xx1T2L Received: from ZXSHMBX1.zhaoxin.com (ZXSHMBX1.zhaoxin.com [10.28.252.163]) by mx2.zhaoxin.com with ESMTP id u4PGJLB8FEma0314 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 06 Mar 2024 14:16:24 +0800 (CST) X-Barracuda-Envelope-From: JonasZhou-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 Received: from ZXBJMBX02.zhaoxin.com (10.29.252.6) by ZXSHMBX1.zhaoxin.com (10.28.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 6 Mar 2024 14:16:24 +0800 Received: from zjh-VirtualBox.zhaoxin.com (10.28.66.66) by ZXBJMBX02.zhaoxin.com (10.29.252.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 6 Mar 2024 14:16:23 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 From: JonasZhou X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.6 To: CC: , , , , , , , , , Subject: Re: [PATCH] fs/address_space: move i_mmap_rwsem to mitigate a false sharing with i_mmap. Date: Wed, 6 Mar 2024 14:16:22 +0800 X-ASG-Orig-Subj: Re: [PATCH] fs/address_space: move i_mmap_rwsem to mitigate a false sharing with i_mmap. Message-ID: <20240306061622.113920-1-JonasZhou-oc@zhaoxin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX02.zhaoxin.com (10.29.252.6) X-Barracuda-Connect: ZXSHMBX1.zhaoxin.com[10.28.252.163] X-Barracuda-Start-Time: 1709705784 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 1316 X-Barracuda-BRTS-Status: 0 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.121729 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- > On Mon, Feb 05, 2024 at 02:22:29PM +0800, JonasZhou wrote: > > As I expected, your test is exercising the contention case rather > than the single, uncontended case. As such, your patch is simply > optimising the structure layout for the contended case at the > expense of an extra cacheline miss in the uncontended case. > > I'm not an mm expert, so I don't know which case we should optimise > for. > > However, the existing code is not obviously wrong, it's just that > your micro-benchmark exercises the pathological worst case for the > optimisation choices made for this structure. Whether the contention > case is worth optimising is the first decision that needs to be > made, then people can decide if hacking minor optimisations into the > code is better than reworking the locking and/or algorithm to avoid > the contention altogether is a better direction... According to https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=unixbench, many people use Unixbench and submit optimization patches to Linux based on its scores. So this is not my micro-benchmark exercises. When multiple processes open the same file, such as multiple processes opening libc.so, there will be contention. > -Dave. > -- > Dave Chinner > david@fromorbit.com