Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp885760rdb; Fri, 2 Feb 2024 07:04:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGd3DzvfqiKu3+03mNZk19R1EQtDXR7QwR1+SmOK7GlXpngWaU4OX7gTH5DRAclsUjSRX2P X-Received: by 2002:a17:906:1d2:b0:a37:1fad:d244 with SMTP id 18-20020a17090601d200b00a371fadd244mr865703ejj.50.1706886251817; Fri, 02 Feb 2024 07:04:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706886251; cv=pass; d=google.com; s=arc-20160816; b=JqcP1ydOcjqE3KiwjSbj/GE4feqmIUzLnWIff71vCivQTFSxO72bXRjqWdC3CoxcCo wFMoVZ2s3JpuBzwAd5l4e63Qrod0Ava1BN5lwMx7l33unlAoQpyyg9j1laV7aP8YBA2T SZd+m5RE6Bn+eHsQ73VrbVJOEAfXJUOzXQhjbsKZFCeVgAvJNplD1dqBRrtRQ6wuk+qU cJXq5q1QUxfnnnkMXymLmiomdsMhi/bOBA3s6Pci6b8Q6CNHbyaZEfVGwAE7bC9cZcm6 O+JGSsM518xPJ79IQbbB2/Iooo7w0uZDgV1zqfT0QrNnWOYjM9AcE6LvyPzu45O9ptdG 9d5A== 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=XgWkmylmtJCHV/bvOe62Jxei6vo4+vXlT1wOK/22qQo=; fh=hJC+CtNVl3UmEVOiBYi5PbBKrEWcjtOeTMiEyHcDBBk=; b=0jdLxTGw4U8v1U5w+4JLVpWRIvrwsvzcVzSkNoL57KORWElbFw2UXbwzBsv6U56Oz3 xRaEgLI+l1OxUTKD2ChH1uH23t1KrN665nKU0OFBq7E68/mA6t/qcW3xKTqyJGJBa4oh rxrznLxoLmfB5oKAi6iuqbIYvBc5DbmBtj03rOWcBD+XIXfj+XscAX7vn5ASgtd0remu Y1VGWaQMdMU/dzB/XjwyckKuEAacdQM3Ktg/Hr+S/S+bzHXALeASNsRkY838J6cGUf/z 182Yw4sLJRx7aFSwo0cfIiYves6Q8/lFeZqhmaPYTn7U4XkDPILrYmsE1tU0TO6+riVX jOYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ca5l3V6j; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-49984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49984-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX2Gh+mPPJk5mY2Ia5mXeU0B3XPyGfZUtbr5tKJaJAbJK739MyRS7gUukpLvTeRiTq8j3EYeoYn3hx57g1feCFSW53q0KDeDp62PIHk8w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id uz17-20020a170907119100b00a371db6ea69si371838ejb.598.2024.02.02.07.04.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:04:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ca5l3V6j; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-49984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49984-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8E8431F2AF4C for ; Fri, 2 Feb 2024 15:04:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82DDC14534D; Fri, 2 Feb 2024 15:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ca5l3V6j" 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 8743E41766; Fri, 2 Feb 2024 15:03:57 +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=1706886240; cv=none; b=AEBZlJLAZGxOON4rQGutDmqNj3RxkEXYGR+3vHKa4P+Tsd/dpfqbcq1q1v+I3FpGUYgzOvK69lUS06wideKgu7uvf1Bxk4he+cqeQ/6BCpRHwF2nCatraH7zVat1If5KRW1dxuw4qtUUgafn8dQTWRZ1sf9XZVC/hhA6qGgt4zo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706886240; c=relaxed/simple; bh=bG7tZJTitu5mna2D0nUxzyUXoNgmPMgUuBt+T8V3s9o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WeE8J+W4pX7Wd2843/0FIn0PRqJivfbUwRyGDWSQJK0jSBeVr+THst3dzIChIHeEgEqMoKedYKo9a1fd6FXd4CxX0AlFxyeZrAE+8+HMPyrkz5A2nMTH+o/9hoEGbN0lGSngCOEAKiQrjNgNhLGgva67XhvZm8ZW2lPMAJ2Iems= 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=Ca5l3V6j; 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=XgWkmylmtJCHV/bvOe62Jxei6vo4+vXlT1wOK/22qQo=; b=Ca5l3V6jXt+Uz1VJMrcZkyvkSF yaSvU2QmTDjWw2UTNcHAoMhk1B2umw083a9CfMpavWzrOKi4nQfYhjLqcsmOzsp2kPGW8vI9RmU/t FC42bGKaJFyisfYlq88kxb4w1os7P7gzaVyuD+SuX1yoozxUJ9x00SJgged8Mf9JFFCc+ylDbTC6a 3hzNcTR7NgimSJ8r52KZvUhiTgResKfKyBgvyEGZe7TdXm3+RWc6GecsLs+A0DlqB1vpoum3u9yiH 0EGbct7sJKSpWfIvFxneofAAzYEJTk6a+0RUKdLtnx0w9DX3iSOO8JaNNxDQFhc9gRdNMVhKl3CVj 2VBU3PjA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVv55-00000001L8U-27ip; Fri, 02 Feb 2024 15:03:51 +0000 Date: Fri, 2 Feb 2024 15:03:51 +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: <20240202093407.12536-1-JonasZhou-oc@zhaoxin.com> 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?