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 06D2AC001DE for ; Mon, 24 Jul 2023 09:46:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9980B6B0078; Mon, 24 Jul 2023 05:46:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9202D900004; Mon, 24 Jul 2023 05:46:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80D9A6B007D; Mon, 24 Jul 2023 05:46:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 730A86B0078 for ; Mon, 24 Jul 2023 05:46:35 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 492CC1C98C4 for ; Mon, 24 Jul 2023 09:46:35 +0000 (UTC) X-FDA: 81046025550.18.5B01B35 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 43E021A000D for ; Mon, 24 Jul 2023 09:46:32 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.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=1690191993; 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=gDQNLQiVQRQNT+9eyUw96C0quFk5V99BVk8z10QDPlM=; b=OzIs/y1s0EfbuQRRmHZKAIpWe/qlYhTPanMKsfZIKyWUkTECeDvgbRMtJzHW/1pYO/AabZ teiMKilJWtrVdXnGaQrdlF5T1QOWHG5BUWbGt1GGvs/9E8KTCerEr2On7BsYXVRREhnfST Z0NVzvyFO4ywQggtb71XbJ374pQl1ko= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690191993; a=rsa-sha256; cv=none; b=cqQAFmWU64QMXiC5UqMOfkhkSxG8bxFo3zN2jLf9pTHQ36yYZ82ZKdCBRoi6KaHCgV5qb6 Sy9qP78azT++FWn1y6kPsxm4BAbcM8aUE3BFx/iewaQroF41JZkjVl/UXUQBtF46X1Rr+W f4q1DifEwMyEY2eesHIZuncrNhPeDKI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.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 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 24A19DE0; Mon, 24 Jul 2023 02:47:15 -0700 (PDT) Received: from [10.57.76.172] (unknown [10.57.76.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD3AB3F6C4; Mon, 24 Jul 2023 02:46:30 -0700 (PDT) Message-ID: <3b08e3d9-29c3-6451-91a3-826f9a28f34d@arm.com> Date: Mon, 24 Jul 2023 10:46:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: Prerequisites for Large Anon Folios 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: 43E021A000D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: yetp4d5qjh1ubjxmip4xhqbk1ajntme8 X-HE-Tag: 1690191992-562023 X-HE-Meta: U2FsdGVkX19lDVf/2VWjkcZz4z109gyqBN69Iu3mepp6EbKSw4SWvD8VhtqPD5bCyWtxhjTUlwUcXDIhxhkzT9H68sxEluuIh4nnmqpYEE8/eRqpTfBasVYRWZs2OyadxYQk0EZyTRmJGTwfPciykac2eEfjNQEIOTdL1icduFImHLKqVnWFnG9KAmdsDetHobZ8LA6PwnpCtKIQd3DQAikMv5fLlw7DYkaJ6pcIChoyimu7C0lzOGUVvefFlU/kJMq70yTWJvA9Tx4Vgj7tvsv4OAkjPgfl1csMaS3Y2C5cHA18xYeWDUwsn/zvTdCABxdUFpoaj7UPI3rkhxxD3DSzdtHZnX52FHLA7YHkg+EgLwxESPq6x2Lb95Z6hHOibuiCid2H6h8fDSHXaCyUv1o2bDNYZV52k2kSDqe/nO2fTBLlF4bBgYGpB4FdMYNMJY/rHebSKXr2XGy8wEbOReMn3wOfsHPBrbuif0j5JguQ/7UIv5J827j/QhrgTetG71fKF6qPy1n92SCZQrRFaX16nwL/mhgaHDnyDznIAHAjsekWhv3MfCBipjJuoi/0Vc1XHkveZ41zlfIQTrGjMIg0Mp4r65j5UGdjBB6F6sxG5/TwPcUpNsUPe6q6CS7BoCk5cHmQjb3ajSoE7cEfhqRU/XZLT0qqptNo17Iolz0s7LKKe59qSbbQemfH716M0szeqlye5fPr9OMiS6WgU6YTrsEiItHMcp9LgDIbIABFvnkP+bMGp546ANoVV52O8fTd5ypsUObSltFmmtTErIDbdJpUHo/YMPcD7XVFvSogOTFtT6H/Unof+HfHQvEFfdEvRGjJP9fk0L4BwpcM09pyPrFMNMWbBX7GgVKUciYWzuY5PRs8v88aSj1TRqOAB+6HVPulQVWloxeU87a+EINg7tbhgQXp1exknGexyACCiEz35fX2qD2tNw6bw4LVuPXDfOqofrltseIRphl is2b9eLN lh0inBR4uDFhJLHhMB3dDAgnjVTo3HpjZ5ZHJe9nsj9k53QlMc52Y1N2MYCRngJ6frQgcKBnuYCTl/27b+cjnYglw1ldkkcZ+oxe0uXINpgGceUw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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. Ahh, I see. So the rmap is broken for large anon folios that have pages mapped non-contiguously in VA? In that case, I agree that this is a big issue for correctness and therefore a prerequisite! Do you have any thoughts for how we could reliably fix this? What are the reasons that split_folio could fail? Is it an option to copy the contents to new pages in this case? - I'm guessing not if the folio has the exclusive bit set. I'm guessing its not really an option to fail the mremap either. What about waiting for split to succeed - will it succeed eventually, or could it fail indefinitely? Is there anything we can do to me rmap aware of the discontiguous large folio and still find the other VAs? > > > 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? >> >> >>