Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1184668rdb; Fri, 2 Feb 2024 17:32:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoffda9WtbizCq+K3nZoIdduM15kTwnmOX6X5Vx7tZ0gvXLzdMvamYtUBlejh8HvHTSyZd X-Received: by 2002:a05:6358:6a56:b0:176:cf6d:20a6 with SMTP id c22-20020a0563586a5600b00176cf6d20a6mr10492107rwh.19.1706923940898; Fri, 02 Feb 2024 17:32:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706923940; cv=pass; d=google.com; s=arc-20160816; b=hNGCBnx5QEeil5L850ZDbavnfS6tTgcKQo9/05oAp2n7iCRVUKfCe+2swrM4H10x12 iOAWQFDZIWRMDO3oOS0YR7ZvirmTIeH8iQGsb+wDLXryIZI8wEkUdKnGUITBfJYVttY6 7D8ZXumyUbPOFk+AfSqgbk25slwokEttye9/6msByRhMN20CBGdK9+41irFyq2NAQNr2 tuvPxndd1RUgQBY85ivgW5OcPBbNRSJtT+gg6whORZBbYPu9bccvdkgNSnisCJz8zDcn +MIIeKnmCzpShzknmWtdhZOhDV9gHwq49niBPRP9hkkdcea9cddYWTfCg+Aliy/D3HEA 2v6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SpRGWjsjOgKS2iXgevZZ/0uJ3SDShG6QHurdZ8ks1JM=; fh=0Q1gwykL78X/yoMtH8fyEjbk69CGsgmSqsIZzfhTlso=; b=wFrQMz7dGy5tyGCvjkDcvshqhRLROWi5RQ80UosT9IoyV+a0XIpqubAaZBBn06kTJx Qg+NPY6eUvIcOTq3Rph5c5V4FeseIixqLbxiux/pths0FHdWKzLVICYD6A519m+MnDHC XuJkqLakXlxAdONmaSkxEe/J6GREMuPgEO7LJUQyDl5izHIlDQnYmCYYL3z6Ur9oQuGs H/uMg8KiFagoSs0mdVI7P5cgZiTMNkdJ52yP4acG60J+2r32KR2zXbpdHjzJJ11p/AzQ iYpQpMM3Nguh5hACCJRQHlGK76LnFRAMPLbMDY9r0rn9s9DXcMCmWrAm9kH+/fYC3goZ ujhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tU6DypZY; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-50482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50482-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXCHNZic7U4mGwVlz7s/03MP0XUSkzoW0akHTp4SW+rUqNMLNWvkaK2r8gA6WUwGjrMVAFx91c83mbdgQDTocYs+GHgMzdlVSyMkNNTcg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ca37-20020a056a0206a500b005dbd5035dc6si2529075pgb.339.2024.02.02.17.32.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 17:32:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tU6DypZY; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-50482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50482-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 32FEA28B6BC for ; Fri, 2 Feb 2024 19:32:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 881B45A4C2; Fri, 2 Feb 2024 19:32:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="tU6DypZY" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2BAC415E5C6; Fri, 2 Feb 2024 19:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706902365; cv=none; b=aeysKa605/Cm9BENq5W5Os2vYAqHb2AxiUSoEphDLjJN8MgUyGB6/xZyqweXksOw3VTfqWR6qXmuivQr57FNLvcoiigvUg2JdTltY9ounRgBMYIulr5LC9kqxHx1/8L7IeETzluDu4wdox9EzRH4VwpkBhexMI0sumEwZmWKW8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706902365; c=relaxed/simple; bh=HYz6/hJ3oOA9kZreAOM5bZVw9xL3BPQoAckmdbalIFg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Eyw8N8PKBpvXUM2EuUGP6NNrA5Q/Q6wYKnlM9CI6/ESe1yewGL0iyCD1iLx4lYBmUM/zJImoZeSEMdCk97lYzFrCBMIYnRiwWJ5PtubtlRcZ3YLLmSIFVibdQUN3tSP2QHYW1B0zhLcKmABFW9gY2wDCqBk0uiTMn/oFqI0bmMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=tU6DypZY; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SpRGWjsjOgKS2iXgevZZ/0uJ3SDShG6QHurdZ8ks1JM=; b=tU6DypZYqDQ4nNWUx28WBq+zCK veUNIQtjIgWRYe3kxZXlqPpdWqTeVdLSLyc8JRtkx8K05tKREYS/6TlvuVw+xeitWHLEfh93ihpjc l9ihXf7j5rafYtGokZvpiwuMXRadvGP7kL5VCWRgMmsmV+IBhCxx+bpBAl081oEzkP+o8itHamZx9 f5LUJOtZLevrDtQrOqN6z+X4q86GwiOJeC2yjXje48Kk1OdWKXZZ8X+W6RxWkq6BDVLtp9OQbYyRH OL9Tn6FOWpBJub8ibAew3KYVIBxEOjnhx3gOcmJfeecgrKJ9Ij4W5iqaQjTC4NODbN+DesWPfqLwI uRWcVsqQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVzHA-00000001tem-2lt6; Fri, 02 Feb 2024 19:32:36 +0000 Date: Fri, 2 Feb 2024 19:32:36 +0000 From: Matthew Wilcox To: JonasZhou-oc Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, CobeChen@zhaoxin.com, LouisQi@zhaoxin.com, JonasZhou@zhaoxin.com Subject: Re: [PATCH] fs/address_space: move i_mmap_rwsem to mitigate a false sharing with i_mmap. Message-ID: References: <20240202093407.12536-1-JonasZhou-oc@zhaoxin.com> 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=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Feb 02, 2024 at 03:03:51PM +0000, Matthew Wilcox wrote: > On Fri, Feb 02, 2024 at 05:34:07PM +0800, JonasZhou-oc wrote: > > In the struct address_space, there is a 32-byte gap between i_mmap > > and i_mmap_rwsem. Due to the alignment of struct address_space > > variables to 8 bytes, in certain situations, i_mmap and > > i_mmap_rwsem may end up in the same CACHE line. > > > > While running Unixbench/execl, we observe high false sharing issues > > when accessing i_mmap against i_mmap_rwsem. We move i_mmap_rwsem > > after i_private_list, ensuring a 64-byte gap between i_mmap and > > i_mmap_rwsem. > > I'm confused. i_mmap_rwsem protects i_mmap. Usually you want the lock > and the thing it's protecting in the same cacheline. Why is that not > the case here? We actually had this seven months ago: https://lore.kernel.org/all/20230628105624.150352-1-lipeng.zhu@intel.com/ Unfortunately, no argumentation was forthcoming about *why* this was the right approach. All we got was a different patch and an assertion that it still improved performance. We need to understand what's going on! Please don't do the same thing as the other submitter and just assert that it does.