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 555A5C83F29 for ; Thu, 31 Aug 2023 07:16:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EE198E000B; Thu, 31 Aug 2023 03:16:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 876FE8D0001; Thu, 31 Aug 2023 03:16:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 718E48E000B; Thu, 31 Aug 2023 03:16:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5B3058D0001 for ; Thu, 31 Aug 2023 03:16:18 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2AB208015D for ; Thu, 31 Aug 2023 07:16:18 +0000 (UTC) X-FDA: 81183541236.09.5E8FC64 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id E99BD8002C for ; Thu, 31 Aug 2023 07:16:15 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.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=1693466176; 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=LDNGymqYRL//872DQAChXUzxMHfQpfN4eEyNK0Lbgns=; b=z5MTGCTklTuRC2uYZIn88YUnAkcZ6PPYZ2ILKMbzkUmEDD4uL5RHbGj1rR5fcvJI/qeJY1 5ouaeEJFax+LUqH2NSAIWTfUMPVu8x1UIrFSx+nmlI0WU92fMq+UqcIphODnJCFHp//9TG RD8FazXKfp37pkbmfZIxqiwURwvWRt8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693466176; a=rsa-sha256; cv=none; b=sEehhhvqBsGVKA09/j+wFgmLM+TnEF2c5YzkTrPGm9w41p3Y23ihF2WvJ50o2P/kMP6oXt 184S577yTO3X8OiDCuNJi+Iug1sB8fdu7gMzeW8440dQggkg21ewZmNNmotFM1Au/UCwvJ GFL+WAFB6HtMG4aK+NOq/Rklddwo+5s= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.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 240D8C15; Thu, 31 Aug 2023 00:16:54 -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 478D73F64C; Thu, 31 Aug 2023 00:16:13 -0700 (PDT) Message-ID: <5e2f7c0e-b834-49b8-93bd-0f521513bf56@arm.com> Date: Thu, 31 Aug 2023 08:16:11 +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> <20bb4831-1fcc-4cdb-a590-c75b357759a4@intel.com> From: Ryan Roberts In-Reply-To: <20bb4831-1fcc-4cdb-a590-c75b357759a4@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: E99BD8002C X-Rspam-User: X-Stat-Signature: mfymbprpc874sfncr7paryhqust3fegf X-Rspamd-Server: rspam03 X-HE-Tag: 1693466175-452692 X-HE-Meta: U2FsdGVkX1+kAf1pmcwa+69YqFiiLlldnRbs2eEOuBmb53/W6tvJE7LbbBqRsEB0pV9MA5b1cPJtiofujLHDgxDAJ+ApGEOwANowGE4kc5tk7DqvV7FKHsMaXaCAqnUe1WfBiHI75O2lcsjOnVR3kDHk4sI0pMtbl42WaRswhkZaKa9XcHNEn/2jnlfAHT1vlue3WYmdhvUh6pTVjfbJ8pOQSgMO7FRecpGX9u+TNYx5RGaWilFM+P4HoV2JkZYjWmYPCyppFAwRUUNZsmHngCuGCNQmy0M1Bm/YtbJ1AjudftdJ020EelZgY9KeXmzBF3B3e/LrbAT0CLKC5t90dhNv1ga0qSkJnS1KzDH4YfA4hvRmbW5rQIDFrX8ZiK6sA9D/MSd5BcJpwSOzyFvoN7DcWCmiP0tsM1Ypp9Qp2Fxbw+4KSz5USvMY93MLczjh/LgrOr8cPeANOAmMJRNltwE26Cw+/r+rrYc1qLxftup74Kuzaq4gVik+AwOQ9sh0FSnP0qssf9VXrhAY/73lSKxZxn7x5IsJ0SiA2BgdzNkyayIJ0qXEIhP5i8b8EQjPKCrvGe+u49rkRmPGazCrqx+T4LIoCpYxL6tdZWOutZAr111uIbpH07yBwWeYdRROMTJRv1a8feirVJ29fskraJfRF3rBoKNF52rnwt2sImkYnqePSqm0dpp+tYrNFpeQzy8BuSi89mLjrVJ5AQ5D7aRjLiFKR1eRE37wKyfXfrjGaaFHXjooubJfD8o3gNgpRaEaEo66hSLcC23dR9T8Oq8QHa6A/7bAw6bxohRzeAMywkvxmz9a77kbQlM4AbvqX566PDWcLxaxp6XmjD6P0Uox3oX/ThQyhoiAgX95wvg40H29BsA3PhB19isL0urgwvJdna0HPF0zYVAghOJI4i2QDQFiaEd0SxUBF37a9hdUcZVUdGMFX0mpej3HOuiaZxeks0m+LdEtKzaAUBq NH1rlSvl kJqBBTb8wTpPNtJi5hzonuu0CmYN5wLjGwEp2UIxurBSqGgGfXLgmVJRT12rRkaDkRQk31EDMggqpAIJK9/t7xfxWf6No3xCHzEAxsWZrw+Y4cbrTvk0iRz2uHCW6HSGzVU5oYCnPJa62+7s= 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 31/08/2023 01:01, Yin, Fengwei wrote: > > > On 8/30/2023 6:08 PM, Ryan Roberts wrote: >> 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? > Yes. It's not a real problem. Great - thanks! > >> >> 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). > Yes. vma->vm_pgoff keep unchanged for mremap target vma. So the rmap walk can > walk the source vma and target vma. > > > Regards > Yin, Fengwei > >> >> 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? >>>> >>>> >>>> >>