From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAA52C3064D for ; Tue, 25 Jun 2024 13:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y7vsrwE5MC7VTJEMEoHLKCx0O08ykSAVxjKBREfzTG8=; b=AuhPRYdvNRKiYlswaonExj9sxk A0sNTbcWimq+IusvXI5Al+hiyx0p3K8EnGYTKLXWqj5c4Tbg1sw+MGW2cWx/j52cq9VaA+0Zms5nR UWw1/0S7mMnYqpSvbugWLA5MOPXWuHhWm0hBeRRKQ1XmsjWpPrcTVtlDOb07MpmHBQwIDSUff+TMf mvyXqQ599jtUa72Qumcqv4XqROYqwia5dsLxYmJ+Uxay+YdYC0SKHiUQLwP/lzXqadmQ4QgeEcZ7k c/pB5PuCCkzMs1GYpqOYRqYjKEVUkmq5QWoH21Bae8OhlcKV1WXFe+xUyhnR4QvFcFFCcSF6Ov7az 4655W4iQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM6QN-0000000324n-3wG9; Tue, 25 Jun 2024 13:41:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM6QH-00000003239-2m2B for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 13:41:27 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4FE35339; Tue, 25 Jun 2024 06:41:48 -0700 (PDT) Received: from [10.1.39.170] (XHFQ2J9959.cambridge.arm.com [10.1.39.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 367FF3F73B; Tue, 25 Jun 2024 06:41:20 -0700 (PDT) Message-ID: Date: Tue, 25 Jun 2024 14:41:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 18/18] arm64/mm: Automatically fold contpte mappings Content-Language: en-GB To: Matthew Wilcox Cc: Baolin Wang , Kefeng Wang , Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Mark Rutland , David Hildenbrand , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Yin, Fengwei" , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240215103205.2607016-1-ryan.roberts@arm.com> <20240215103205.2607016-19-ryan.roberts@arm.com> <1285eb59-fcc3-4db8-9dd9-e7c4d82b1be0@huawei.com> <8d57ed0d-fdd0-4fc6-b9f1-a6ac11ce93ce@arm.com> <018b5e83-789e-480f-82c8-a64515cdd14a@huawei.com> <43a5986a-52ea-4090-9333-90af137a4735@linux.alibaba.com> <306874fe-9bc1-4dec-a856-0125e4541971@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_064125_838311_2F5E5731 X-CRM114-Status: GOOD ( 19.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 25/06/2024 14:06, Matthew Wilcox wrote: > On Tue, Jun 25, 2024 at 01:41:02PM +0100, Ryan Roberts wrote: >> On 25/06/2024 13:37, Baolin Wang wrote: >> >> [...] >> >>>>> For other filesystems, like ext4, I did not found the logic to determin what >>>>> size of folio to allocate in writable mmap() path >>>> >>>> Yes I'd be keen to understand this to. When I was doing contpte, page cache >>>> would only allocate large folios for readahead. So that's why I wouldn't have >>> >>> You mean non-large folios, right? >> >> No I mean that at the time I wrote contpte, the policy was to allocate an >> order-0 folio for any writes that missed in the page cache, and allocate large >> folios only when doing readahead from storage into page cache. The test that is >> regressing is doing writes. > > mmap() faults also use readahead. > > filemap_fault(): > > folio = filemap_get_folio(mapping, index); > if (likely(!IS_ERR(folio))) { > if (!(vmf->flags & FAULT_FLAG_TRIED)) > fpin = do_async_mmap_readahead(vmf, folio); > which does: > if (folio_test_readahead(folio)) { > fpin = maybe_unlock_mmap_for_io(vmf, fpin); > page_cache_async_ra(&ractl, folio, ra->ra_pages); > > which has been there in one form or another since 2007 (3ea89ee86a82). OK sounds like I'm probably misremembering something I read on LWN... You're saying that its been the case for a while that if we take a write fault for a portion of a file, then we will still end up taking the readahead path and allocating a large folio (filesystem permitting)? Does that apply in the case where the file has never been touched but only ftruncate'd, as is happening in this test? There is obviously no need for IO in that case, but have we always taken a path where a large folio may be allocated for it? I thought that bit was newer for some reason.