From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=90.155.50.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796317145; b=DgyQbqxlZi+XjwID2fG568SEOSRP/qpQ39K7YVqVr1nSEkqQB6C+rsPHq/ztsdPWDD46 JNuFhuFIMUyCmlJO5BbTijJ4iCU31ymvL1cTI+fuHF4lpC+ujyS/7WBMHdf0j0B2O9yJC u8XWSmW619MAtej++bx7uv+3TEowq6+oMNy2ygRi9+O2+OQf105zh3SYHGVq6RIKAZzeI enYVi/bdFLynsPI53N88W68fZjSk3Dl6mRl66FpcKkpqVJx/tCtBLjRLsAODbCnomCxtX d1IGy1QLaBsp/DqTIQzO37na12GiKatUCe2N6kIyysqnQkcH268+fDXgaxQZc0tSWFw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796317145; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=xfE4jWkrFosHlNxDLWwSiv/qz9aJnPoDp2su6s/Fauc=; b=tkmMeo8ZSfxOKRRvKOBghp9qPWlpUsdtP4jTHrq11bna9eyzGXg3v+faWulbIPJqlK+n v6knOG2h1XQzFxPD7qmDmd9vzQsBISSU2BdUB3I+gbNEKYiu5LbswS/2r5BcdoauKNQqm CsiZbLRzMSuLVaPJjVX3l5v7+HOzzg3wy3tYDIO/voZCHswIzV3uK3TE/dw6jCvqfrRhg LnNqyqZoLEft9+4Q4LZNqvlq48YBSzL+3GdV/tXkASPi4xaHpFy1SUeNHVyyA8y9GZu5i 5d1KiH8moBw4rqfO6L2Kc6p+q/ZbmvJmMj1sJkVvxyz9+WPXP4q5ayFQqB6r4UvopQQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=Q3ttv1J1; arc=none smtp.remote-ip=90.155.50.34 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C2C6606A336; Thu, 3 Dec 2026 16:59:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2C2C6606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=Q3ttv1J1 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=xfE4jWkrFosHlNxDLWwSiv/qz9aJnPoDp2su6s/Fauc=; b=Q3ttv1J15vfhYReee7SD+6Ck46 L5g3chOXSMcE0c1w2Se9kF5O9vaEvPnMeUR+7mLenxrEGWf2HIVi3VRU6vxTuU28/Q7MpUM2CNwZz lnof94b+vASY5vfFj2pMiH7t/Njq5rmS8oOIjZ67aPklkpIWyPOu/Z8F2wRRp4WdUOP91RpftGTW1 AD8+yz24yPoxFV4XxpjcGvPGwHtCNWk/vAQobVPXrpv3bQFqv1NuXJ2DI1Y7Bh3UzWPCKKsgDsBRy 0CJQ+VNSJ51jX6+3lk2csKxurgCEOpHS8yh/HnDLeqicX7BXi8O8hITsKo5MAMzXWlj/02zQoHslp qORmqrOw==; Received: from willy by casper.infradead.org with local (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZA97-00000007SnR-19ts; Thu, 03 Dec 2026 16:59:01 +0000 Date: Thu, 3 Dec 2026 16:59:01 +0000 From: Matthew Wilcox To: Carol L Soto Cc: jack@suse.cz, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, John Hubbard Subject: Re: [PATCH v2] mm/filemap: bring a folio uptodate if all blocks below EOF are uptodate Message-ID: References: <20261201212140.1168851-1-csoto@nvidia.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201212140.1168851-1-csoto@nvidia.com> On Tue, Dec 01, 2026 at 01:21:40PM -0800, Carol L Soto wrote: > When a filesystem block is smaller than a folio, a write that ends > before the last block of a new folio leaves the folio partially > uptodate. The write marks its own blocks uptodate and leaves PG_uptodate > clear. With 64 KiB pages and 4 KiB blocks, a 1280-byte write to a new > file is such a write. Thanks, Carol. This is a really interesting corner case, and it's a legitimate performance prblem that's worth fixing. I don't like the particular solution you've chosen, partly because I don't like spreading the 'may_read' information into the helper, but also because callers that set one of these flags are supposed to have a fallback. eg, io_uring will use a helper thread to do the read_folio() call. So if nginx switches to use io_uring, it's going to see the same contention on the folio lock because it'll always take the partially uptodate path. A solutioon that might be worth investigating is marking the folio uptodate in write_begin for the special case of an extending write. We'll need to make sure we always zero the post-EOF tail of a page before it's mmaped, but we already do some of that to handle shared mmap writes beyond EOF.