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 CCB5FC83F14 for ; Wed, 30 Aug 2023 10:08:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 424B08E004E; Wed, 30 Aug 2023 06:08:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D4D38E0009; Wed, 30 Aug 2023 06:08:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C42F8E004E; Wed, 30 Aug 2023 06:08:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 19FB58E0009 for ; Wed, 30 Aug 2023 06:08:48 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A39BBC039C for ; Wed, 30 Aug 2023 10:08:47 +0000 (UTC) X-FDA: 81180347094.30.1A5143E Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id 8577A140006 for ; Wed, 30 Aug 2023 10:08:45 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693390125; 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=s47em3EAT/abAANabzDWhRRApaWPkANUEtvM/A3gNhc=; b=hkbDxhETIQ5wTJAp0NzLzoOfT72QUkzUnJHtEFGDmcsDKfnLsWgE0ojd6pMPydGYP0W3TK rwQLwz2UUM5DGEq1b3sTVWjdgAEge3PYjPEdtr9oTI77ZEf/31sC/GwMCzurUU1yAFKh4b coc7TImzS0MH4OY7shpFzV/7hxx/kaw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693390125; a=rsa-sha256; cv=none; b=HzZiJ1QUfDSRDbsGZbWjj92hMEU1UZ3cyRfeACy3BsiVq1FCYexnMfZhJE/6MdGMq0vj8V CjKk186R17jgmzooaES40+ZDfrUykpnJjl5aXFGpYuDkkbqO7g48r1VmqZgxUv9af6IttB kRdy/7a7ruAGwl+RhXEFZ23sU9/q3VQ= 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 D38F72F4; Wed, 30 Aug 2023 03:09:23 -0700 (PDT) Received: from [10.57.64.173] (unknown [10.57.64.173]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D0B53F64C; Wed, 30 Aug 2023 03:08:43 -0700 (PDT) Message-ID: Date: Wed, 30 Aug 2023 11:08:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Prerequisites for Large Anon Folios Content-Language: en-GB To: "Yin, Fengwei" , Zi Yan , Matthew Wilcox , David Hildenbrand , Yu Zhao Cc: Linux-MM References: <3393b7c4-2a21-666e-a791-4c1be63b1af3@arm.com> <2c2e9256-2d14-c7c6-2112-69b198cea063@intel.com> From: Ryan Roberts In-Reply-To: <2c2e9256-2d14-c7c6-2112-69b198cea063@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 8577A140006 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: fb4x1wkh67jrrsofs91xmafayz1yzr94 X-HE-Tag: 1693390125-422870 X-HE-Meta: U2FsdGVkX19iim+vCCPvKT22wkYdBi3g9BfAJ6WnDFtafOg4Ja5mmA9egy4TIVr7lSImTleHYalJfu36tRI/Z0b5fHNASywGbQ2v4P4dSx5s8SpFC8PFbtssL56i1Q3cCexniTe1HcbIJxwsmsV7xdIAwSwmy48eroSZtuvDiicopp0VgcUdBMACgGtoPqgi1DO9ysagtA5qEbVzom7d65XOv/o6/idnDyp1BCLlfk1kzNaHiTvdysEGFHtiia00xA+ATNoIPSco5gsUXGXifyLnAHig4j5aMpW2ni6w6QAx+4mBWgmzv8IItuLr5P/1jnli0joOfKjHrCxP7J1v5+ULQrqCAkGemq4+T+/Zb9tH66+7uZXg8mM8YYQ4fCIlAKj+4M8EFfkEH3leK1A3zCQ8tefpxv365LsO6HU7G7FMrDKKD1j0NJzXXhe5rm9tl7AB3EYpOKW37rwj4iAGj/UeqKQxcjjByrksGtHXqpifM24r2GZdIzXWpu5pSZnZAxoPJrU4NWifxZex7yW1E/HDa3A6A0fuGYgQ272BLZUM1qpa1iAlR93GqObhlkFLTjKjHWE7O8CeRfCIuTEi0NaZcKw1LllN2q6jatc3mB48DWxmDTKCDes29BzEc/hX6IejfHhEjBa9+oswcB9mOSmyA/g7KeV6yywbDyvkPmezqFIWh51yU07sJ7cOHmkBQ/O1D79x3wixVe0ueHseUPdxUbrlFlPV2znCeqAJQ7JgqV1ES5O6FAo3ivjqim7kI4gqYwoH92dOTIURjL+7HNYswi/zp1DfwsBcSySsnoIskCnddzibrn/8WkJAOg3jETL3KjpowgcVCF6AoX8Ht40jCUC3LT33uEqhAE7GXy9sCnH/9O7lCxWgST6yqX4uhfUCahiCM7pXitl4aIaD/WDh8QhEk7bEmWHD6Ajw79trKDBEgumSQnS90TtszkisF94zED3hDJUA92aM20X FIKKAXVU qqxi8K+/8IgRwianQdRbuugMbE4FHg54yvIBJ/tLWyiwyawJmhONSwEs2HjsiWemIDhkko4niAPKf4j34ekbW0donS4vee/vpd85A79J61MbGGC7E4I03LFFE5Ylz1k0QcmkiiF2OYWS6wNc= 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: On 24/07/2023 10:33, Yin, Fengwei wrote: > > > On 7/24/2023 5:04 PM, Ryan Roberts wrote: >> On 23/07/2023 13:33, Yin, Fengwei wrote: >>> >>> >>> On 7/20/2023 5:41 PM, Ryan Roberts wrote: >>>> Hi All, >>>> >>>> As discussed at Matthew's call yesterday evening, I've put together a list of >>>> items that need to be done as prerequisites for merging large anonymous folios >>>> support. >>>> >>>> It would be great to get some review and confirmation as to whether anything is >>>> missing or incorrect. Most items have an assignee - in that case it would be >>>> good to check that my understanding that you are working on the item is correct. >>>> >>>> I think most things are independent, with the exception of "shared vs exclusive >>>> mappings", which I think becomes a dependency for a couple of things (marked in >>>> depender description); again would be good to confirm. >>>> >>>> Finally, although I'm concentrating on the prerequisites to clear the path for >>>> merging an MVP Large Anon Folios implementation, I've included one "enhancement" >>>> item ("large folios in swap cache"), solely because we explicitly discussed it >>>> last night. My view is that enhancements can come after the initial large anon >>>> folios merge. Over time, I plan to add other enhancements (e.g. retain large >>>> folios over COW, etc). >>>> >>>> I'm posting the table as yaml as that seemed easiest for email. You can convert >>>> to csv with something like this in Python: >>>> >>>> import yaml >>>> import pandas as pd >>>> pd.DataFrame(yaml.safe_load(open('work-items.yml'))).to_csv('work-items.csv') >>>> >>>> Thanks, >>>> Ryan >>> Should we add the mremap case to the list? Like how to handle the case that mremap >>> happens in the middle of large anonymous folio and fails to split it. >> >> What's the issue that you see here? My opinion is that if we do nothing special >> for mremap(), it neither breaks correctness nor performance when we enable large >> anon folios. So on that basis, its not a prerequisite and I'd rather leave it >> off the list. We might want to do something later as an enhancement though? > The issue is related with anonymous folio->index. > > If mremap happens in the middle of the large folio, current code doesn't split it. > So the large folio will be split to two parts: one is in original place and another > is in the new place. These two parts which are in different VMA have same folio->index. > Can rmap_walk_anon() work with this situation? vma_address() combined with head page. > Can it work for the pages not in same vma as head page? > > I could miss something here. Will try to build test against it. Hi Fengwei, Did you ever reach a conclusion on this? Based on David's comment, I'm assuming this is not a problem and already handled correctly for pte-mapped THP? I guess vma->vm_pgoff is fixed up in the new vma representing the remapped portion to take account of the offset? (just a guess). Thanks, Ryan > > > Regards > Yin, Fengwei > >> >> If we could always guarrantee that large anon folios were always naturally >> aligned in VA space, then that would make many things simpler to implement. And >> in that case, I can see the argument for doing something special in mremap(). >> But since splitting a folio may fail, I guess we have to live with non-naturally >> aligned folios for the general case, and therefore the simplification argument >> goes out of the window? >> >> >>