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 2A594C54E67 for ; Wed, 27 Mar 2024 15:15:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83C1F6B0088; Wed, 27 Mar 2024 11:15:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EC0D6B008A; Wed, 27 Mar 2024 11:15:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 701AF6B0099; Wed, 27 Mar 2024 11:15:41 -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 517686B0088 for ; Wed, 27 Mar 2024 11:15:41 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 03F821202D8 for ; Wed, 27 Mar 2024 15:15:40 +0000 (UTC) X-FDA: 81943168482.28.DC3299F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP id 1D7731C000C for ; Wed, 27 Mar 2024 15:15:38 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.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=1711552539; a=rsa-sha256; cv=none; b=bSCV7ciWx1OnQm2wtUJiHdu+h1Ov/uyNlzvirpnR9qNcQExPtqTAEVSSyVMNg47OcIF2e6 HZvC5b7EdxdK6Qy6TooZAewbxyalGAglF9XzSVBvvuuK/Jp3tNkwBP8qIt3rGqIoByNy1T RLTi6tPvxhidYcRcVLd7c9FlTp2ddyw= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.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=1711552539; 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=pfmPR7leI2XXKf2GJEacldlUF5J1/DaY+Sjjggh0CPU=; b=rheRMGQmbEUu0mLuA9H8zoq6i2/fgMXIesw6I/K8+ms6gukr1Vf/nKSL9C5bigHlyo4wya qGBk9L2vaIgEUrs2ubSPKKwA9DreFvnOmWwDqoTF/Q7akYBF0oR7PcbkCwozDZ1tBXkanK ViN2K2L/3o7POCW+nlZ/+3mTBU8yZNY= 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 5953A2F4; Wed, 27 Mar 2024 08:16:12 -0700 (PDT) Received: from [10.57.72.121] (unknown [10.57.72.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 888F73F64C; Wed, 27 Mar 2024 08:15:34 -0700 (PDT) Message-ID: <775d6fb4-f555-4edc-a3c2-2f5cfde3d9b6@arm.com> Date: Wed, 27 Mar 2024 15:15:33 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] arm64: mm: swap: support THP_SWAP on hardware with MTE Content-Language: en-GB From: Ryan Roberts To: David Hildenbrand , Matthew Wilcox , Barry Song <21cnbao@gmail.com> Cc: catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, hughd@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, chrisl@kernel.org, mark.rutland@arm.com, steven.price@arm.com, Barry Song , Kemeng Shi , Anshuman Khandual , Peter Collingbourne , Yosry Ahmed , Peter Xu , Lorenzo Stoakes , "Mike Rapoport (IBM)" , "Aneesh Kumar K.V" , Rick Edgecombe References: <20240322114136.61386-1-21cnbao@gmail.com> <20240322114136.61386-2-21cnbao@gmail.com> <1006392c-c437-46c0-9a2e-e25e52236b67@redhat.com> <46ba09c5-4186-4e03-81cc-ca27c0301fef@arm.com> In-Reply-To: <46ba09c5-4186-4e03-81cc-ca27c0301fef@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1D7731C000C X-Stat-Signature: k7gtucfwhkmueah39yy5etuzr1ibapiz X-Rspam-User: X-HE-Tag: 1711552538-138180 X-HE-Meta: U2FsdGVkX188UkCAus1F2Vcp+oO5Pguep4edUyhaGhsvhZVnSv4tmOdoF0bmAiUKpnxiX14SxCln6Myos73wm4jVwuV0KrydoaEepg/sDOt4Maa3YvTJnNfqYEwyVU2KLSRfY4HTyVj8ocOzeK/DOmmuIrHNGUJhxCt9yiPh92L16GSVCO+ls32JcXXy0vVp0Nz1Mh/DiI8BGWhLAIgRz68FMcFkEgK7/UHyYqbVIlwsBrliOSNCatz/W3WxhbArs2EVoNV51ulgo3D9inpkNqjD9oPLJHW2hRM/QO5s//tEGDvk5w2JsCkxupSKMCsyVR0jiUNYQxZ3eWBvc1Dg7Z/ZCLoy87MIqVh48uk1Mv+9azdd8MnbaTKN6oKURfNFUKjo07Kv+WwBMLr69G5xA7o0WpRt6xf6xVh60xeVQlCdu88QgtkGe7BQ7C0uwrFTs6u7nqNTdafASXRZbOHoQwWTNjXl6QwaHfrZE0v6ILTrYz8scWL5954Os6PeGF4fhfeDKavbRr9vpRGGTe/gdp4Y4XotaiW7jjVB99mtobYegKsNDaDeDtqAvBqQPwAfXf6I4kQ909ggknzCrbqAXU1RIO0t+yI/tFpCZ22oU5Ud7pXDXyetkBzCZGeum6Wb3HEkLVkRLUXcgjGODVr4SVllArT9ng4PCW8PzQPwDhFIQk1eBPmBXTDf3j4+m+I90ofBjBaN+S+xGwxre6/pRbWi1ZIRFdWyJejZ/sVOvjHBXV/nvbn6gCqLqknziads7Xj/kYTujswTYuBRdZ70w5g15EIBG954khukR8Q5xVWnFF0vM7Mxhqk3Kq/Y5hx0w+ymbi8+8aaY2RFKJUAFYK8WruyrDxJbBd+XRP/zvpqAOaCfQ9/lGoJktDLrZLZkZ47pSwtdLcWuc3curx6ceLuwKu4SLs09/yMrbV58Em9Pno+xAK44IbEvoYAwy8KEwC2DsFbb/cb3SH/TFXs KCVaFWqt SwkavqWbroMz31MnqVcuBQC3K5dRrSAmPQ9bXMlAsv+3jubvqp2d4zipwnqNSwb1TTAQEX7NMZvp/OSP8Eg9q0r3XzXmlvKib1ZCgXoCFUZ/Ll8RUF2ooZY3UII9lcmJwtIO5Jv/1Ayxzmq8stsa2HhG8J4dthUrNvDnfPfdv5aUF61YwYVJLxRUSiA/y82iO6+qz91ZyzLF4R97dppPl4BbdCerpWZXBdMUtxZASaifCfPchySB0ho7uohZQJrKMh16ktV96ZFi1+cJFdZtCbY9PB+UA1lveLd2ylsujBI9pb2MK5GAU17PweXO6yUqO1jWxP+GpW7P/iJDnroxvYLGskw== 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 27/03/2024 15:13, Ryan Roberts wrote: > On 27/03/2024 14:57, David Hildenbrand wrote: >> On 27.03.24 15:53, Matthew Wilcox wrote: >>> On Sat, Mar 23, 2024 at 12:41:36AM +1300, Barry Song wrote: >>>> Commit d0637c505f8a1 ("arm64: enable THP_SWAP for arm64") brings up >>>> THP_SWAP on ARM64, but it doesn't enable THP_SWP on hardware with >>>> MTE as the MTE code works with the assumption tags save/restore is >>>> always handling a folio with only one page. >>>> >>>> The limitation should be removed as more and more ARM64 SoCs have >>>> this feature. Co-existence of MTE and THP_SWAP becomes more and >>>> more important. >>>> >>>> This patch makes MTE tags saving support large folios, then we don't >>>> need to split large folios into base pages for swapping out on ARM64 >>>> SoCs with MTE any more. >>> >>> Can we go further than this patch and only support PG_mte_tagged and >>> PG_mte_lock on folio->flags instead of page->flags?  We're down to using Also, I wouldn't want to hold this patch up in order to do this extra work. I think the 2 things are orthogonal? (supporting THP swap with MTE vs not using tail page flags for MTE). Can we discuss and handle it separately? >> >> I think we discussed that already and what I learned is that it "gets a bit >> complicated". But I'm hoping we can get that discussion started again. > > The original conversation starts here: > https://lore.kernel.org/linux-mm/fb34d312-1049-4932-8f2b-d7f33cfc297c@arm.com/ > > The issue is that you can have a large folio mapped to user space, and user > space only wants to activate MTE for a portion of it. So at that point, you > either have to deal with only part of it being tagged (as we do today with the > per-page flag) or you have to split the folio. > > I haven't re-read the entire thread - so might be forgetting some important details. > >> >>> page->flags for these two MTE bits, a whole lot of s390 junk, PG_hwpoison, >>> PG_head, PG_anon_exclusive and Zone/Section/Node/KASAN/last_cpupid. >> >> ... just like PG_anon_exclusive "gets a bit complicated". Well, I think I might >> have finally found a way to make it work, I'll only have to uglify fork() a bit. >> >