From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4297677111 for ; Thu, 26 Dec 2024 21:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735249852; cv=none; b=RDwhvLbdx8YZjOEncqunVu8h7y+vQNfl2K8sRnkfzzYs1lnBKJMWFGP6KJyej2xCgB5ters26DltFrFMzNRJMqGe5hniz4JTZPhukl3nUYzLV6f0xduP3nXK5gyGGWWnRxb90WuZe2z2Re7uIcAsvH6FZX/6j7/XkIJU0c7CSdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735249852; c=relaxed/simple; bh=dvN2lzuJjqh+PfwhVxvByHFBUi79VKH87uBl15ewL/Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y6eMZ8L/0QlPad2ZqYPru1C9/JlaWEzjM6m0We7FoJUwQNMUyxAzov8vm0Nl/yDuPhJs9+KJSqaCMMXXefGujTb0YKlVVKfK/xB0Gv1QBXm2a4FQC12wvswZdiPUuZQgJ7sE/copmp4x4E7aiS5dTAWHB12AglCRM3XW3kYq7e0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=xo4KiUrA; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="xo4KiUrA" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-219f8263ae0so43105695ad.0 for ; Thu, 26 Dec 2024 13:50:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1735249850; x=1735854650; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Wr9rqTNKfrszMFbe6gBAWrnjJVlbfYKXR7FEPGhqS+w=; b=xo4KiUrAEfOwxADhZhzDYyLLABAR8H4FBE4L4eeUEMGygkwtq0/bxBCrovCNZ7s+fT 651O/DTaqqBfAZV89+khyhX5gpejEm0/tFBlCHz0lOjweXXu/SkEPYQ3j6atma60CZjm gQ7ieD4JQNQhr8tTh4CBHxKTf+Zp03UkPB80taRsVWgRIKb/kIzNAw7RETA1jP2KNel3 wuVv4ZiiyapNOns9asM574SNTYVE10mK5S2tJcQheOrVPbOWaE8qetlhbBKGBLkIJpXD Yl6H+lRvCZ1LwN0E/LAr9u44rTDzPG527No+eSlU0JQ7dlzyxXexpAKx1B8UNjfDunZ2 VTXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735249850; x=1735854650; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wr9rqTNKfrszMFbe6gBAWrnjJVlbfYKXR7FEPGhqS+w=; b=rMloU4j+tu6HlL8wHBzNRHQySw74Tw1PfUTL9KmuZSusU1qY0goT7CmhJCClIGlmcl 1vBImAxkhsdvIv2TZqSBBPiV4bmYWHM5hmiRzC02VOAJmNcjfzz3Fvzx+HSWwx7vxoSl UuVGdp+ToB7//TeOwtVRZmKuJTGFoq7d4QNid2Pr16k5fi2GxdJ9ycMXkjYDg0cFFBgC 32VYNF4pRAVe85ezgtWkVYEmHNtID6Nj5SnE+TEIdArUuDlfo+rPnGvbsQO7gGzZV5T5 79NVptmWb8rDLOtVqU6xcbhIncEAeHhsBfLNniUTWBKpxmnRSsPrGA+dAvtDl2/PPZm/ ynbg== X-Forwarded-Encrypted: i=1; AJvYcCUrmn19lpyP0ovfxqwQLZC0Qq+baKHG9bvjYYj23TtRK2J8Kw9nY78fXltI+9TP3BcLHQfc+o1DIkLMqxg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2pw0T/0CJdUHW0474a7vEC1Aqrr50hyto9cNG3u/wc1wxwO3T 65ayfxjx82Spo7CSq3U3sT9i97K/ZqKhDhYtuq3CRujszmWKWzcZ6Hz+9SRyKQsnj5sbfPqSiVP 9 X-Gm-Gg: ASbGncsvJEizLgJjXSEFgnEgkBgGmjdFPf7wxAuBRE1/caog8eEljbh6295Df5R6jWA 2kzwJs5XOP5KxYvPkLWUi3pWRaXYrJ2HF2yJi2Qp8Kki78iV7oE6G6kZTyTSmUuuoQPWTHwlvtk k0lJSSfFlLJA8gLbBUa2Hpqnu2LH/QOILn5Qf+T1a07e3UP5qh6ixXTHZJG84OnJulj8Oywv0Rw OGbqM9wr3yiuV2zdJPWcY4Xjxf7oWnaDEsDoiFKnshXtkZ/3Qr4LsW/P6jyEuSs7DUIaG9rWbOe 0jR1+VE/8G3og9Uq+w7MKTWQithRJjYT X-Google-Smtp-Source: AGHT+IGk9ns5G4ClaQIYPLU52mtpz4s/jiWLmd1nFPHeo5VshhGXPfY/Dpcc9wUfE+lHiV9OxDrdTw== X-Received: by 2002:a05:6a21:9017:b0:1e5:ddac:1eff with SMTP id adf61e73a8af0-1e5e04a0c7cmr37891986637.20.1735249850526; Thu, 26 Dec 2024 13:50:50 -0800 (PST) Received: from dread.disaster.area (pa49-186-89-135.pa.vic.optusnet.com.au. [49.186.89.135]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad84eb45sm13322197b3a.88.2024.12.26.13.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2024 13:50:49 -0800 (PST) Received: from dave by dread.disaster.area with local (Exim 4.98) (envelope-from ) id 1tQvkk-0000000Fgtb-3h8r; Fri, 27 Dec 2024 08:50:46 +1100 Date: Fri, 27 Dec 2024 08:50:46 +1100 From: Dave Chinner To: Chi Zhiling Cc: djwong@kernel.org, cem@kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Chi Zhiling Subject: Re: [PATCH] xfs: Remove i_rwsem lock in buffered read Message-ID: References: <20241226061602.2222985-1-chizhiling@163.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: <20241226061602.2222985-1-chizhiling@163.com> On Thu, Dec 26, 2024 at 02:16:02PM +0800, Chi Zhiling wrote: > From: Chi Zhiling > > Using an rwsem to protect file data ensures that we can always obtain a > completed modification. But due to the lock, we need to wait for the > write process to release the rwsem before we can read it, even if we are > reading a different region of the file. This could take a lot of time > when many processes need to write and read this file. > > On the other hand, The ext4 filesystem and others do not hold the lock > during buffered reading, which make the ext4 have better performance in > that case. Therefore, I think it will be fine if we remove the lock in > xfs, as most applications can handle this situation. Nope. This means that XFS loses high level serialisation of incoming IO against operations like truncate, fallocate, pnfs operations, etc. We've been through this multiple times before; the solution lies in doing the work to make buffered writes use shared locking, not removing shared locking from buffered reads. A couple of old discussions from the list: https://lore.kernel.org/linux-xfs/CAOQ4uxi0pGczXBX7GRAFs88Uw0n1ERJZno3JSeZR71S1dXg+2w@mail.gmail.com/ https://lore.kernel.org/linux-xfs/20190404165737.30889-1-amir73il@gmail.com/ There are likely others - you can search for them yourself to get more background information. Fundamentally, though, removing locking from the read side is not the answer to this buffered write IO exclusion problem.... -Dave. -- Dave Chinner david@fromorbit.com