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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11B47C3064D for ; Tue, 25 Jun 2024 13:41:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 717786B02DE; Tue, 25 Jun 2024 09:41:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6986B02DF; Tue, 25 Jun 2024 09:41:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5677B6B02E1; Tue, 25 Jun 2024 09:41:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 39AFB6B02DE for ; Tue, 25 Jun 2024 09:41:27 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DD659A195D for ; Tue, 25 Jun 2024 13:41:26 +0000 (UTC) X-FDA: 82269522972.29.EA9A157 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 8CF2A20015 for ; Tue, 25 Jun 2024 13:41:24 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719322865; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y7vsrwE5MC7VTJEMEoHLKCx0O08ykSAVxjKBREfzTG8=; b=7Z0ObVlbDXrrsy3h89jHdOXGrKFo48hlashsOaHu8Erjf8o0Om+W69X/pdUcNnKTTG5gtY YmyBbnCwtDvSR0I2wBKGYXL8cH0iTWs6jgbmBBGiLpKVcNGeM2rHnkyTdT2N1Mv2j/XkDJ p/DV53xi3ikS/SVWakMN3oB+A4Gu4P0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719322865; a=rsa-sha256; cv=none; b=50f5utZfcDnTCU7fevgxV8ZZLPCSdSY8T1eco1RYIg0urfkMfs3pxs3TI18bHaHnGuX+fu PjDnLiPjoU6IC0rBRij97MEXDS0DFnfGCf9R4RAr5b1C44DEZqdlmxWs4IHbRLf4dr1FtP vEJ4IXR7D9fpheNTnO4Da9/ypsr0Ri0= 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-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8CF2A20015 X-Stat-Signature: erncopcegace6e567ezqusxh3qqf5hci X-Rspam-User: X-HE-Tag: 1719322884-900064 X-HE-Meta: U2FsdGVkX1/bh04HnZyWOdh/h6Nd28pLe2gSfbKlAEtcMk7ukrFr+iPVL4VzArDLZ0ykRhGw5N+YV8QgTyRaoDCtG0gjHk0z1tFtIQrDIG9dr8MlzhsZAOdz5xjM5vg1hjRb64FjFwKhQu3Vtt+ekGRgmWhO/ciMdWesnxInz44DJkpP+Q/GvQ7KCPzksXbN+/VXAOJsSo95HxYJqvbXiTCntVED9VvqvRKEiVD5h4BP3Q1OaUCwsbfiGRCkUssdZHp6m5ix4zfE8AT2qtxb3ATMPfUrGq6vFVxLZ9cLAKkqeU1nXsxa2ZP0p5FXcP/uyVPSICGe6GuyDJkse3GH8nSYsiABpE41EMFkAllRmmdoEJGtTBla5jIgtsWMLYo9b19HBvkPe4GGsftgdYvZ9zilrm6xytgqQj+xLFHOz5Uwh6yZbAmsZaJOYwKb4yk+S51enGOCl/0R59bO1ieuBQfkCF/5GRf2KbRbp9fr+IzH6eBCBcHmsaq88y0P+1MfkHJD1r9uGMrcIh9HjXWwTYvTSd+6d5PQ9DHZO7VQxbzZ90Lde191gNUxoqOCP/5FbdGFUHz+bga7lekTGcTjdhWw3ti2wxGuBW8KNpMXxSWfwTmgkBYHAB2KVbGv2vOxsSydq08Jo3s0nA7+VelnzdGP4TRvgcdduDhGCIUnt5A4D2a8RFQoKuevpS9rZ4WGBgnx2234BOkDoA/Q4yiTd9KsMObRzaSgbtBypft8ouLjyvmDfaIlIKhovRrWgTwLFbYU5o6iUu2BUF2bDZqJnxjUX0fuLN/UED3+zizEz9CXKfnTQAMlzmEviGKFGGCOjPOy2+8y++uyXL15gykY39mNMpbhizyGAh57g6xGBmIv7j9ZoyalEvpaPbTN6P0dBRDN6GLuOUc8Qw70yhTaAyI4n0ZVfiX6sW0h1zYlK19a6CKIFvxC7d31tyTATvEvrGbE7rj8zYDi26CkoVJ w8ZS7/iv m1XzW2iXi0/O6e/wchXKFSvPzG4v7Irogu5PhytC19s12YlbF0gV3xh7RX1qvZUpBK1tdiTwfuu9lyFwB2AeR9nxu9vgPIG5Z71g8yIgr3vDvBOytoTKeGX4cRCXdUwHzuMrOUbR0RIupGb9pw306kHvPJZ3b686lejAdr+2OEdUTrxMcx0JkE4S1BcSIr0Ev88hpC5cwi0LCR5cq6aedWqqXfQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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.