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 331B4C54E67 for ; Wed, 27 Mar 2024 14:53:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B80AD6B0087; Wed, 27 Mar 2024 10:53:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B30B66B0099; Wed, 27 Mar 2024 10:53:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1F346B009A; Wed, 27 Mar 2024 10:53:25 -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 83C9D6B0087 for ; Wed, 27 Mar 2024 10:53:25 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4286B1C0463 for ; Wed, 27 Mar 2024 14:53:25 +0000 (UTC) X-FDA: 81943112370.16.8C05F3B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id E2DE8C000F for ; Wed, 27 Mar 2024 14:53:22 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HeAhneLt; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711551203; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ckymK75l4yG52iWkxXUUW1WtPRWM8wKY5jH6qkBLMa8=; b=ffK+UWjTgHj0rIXA7zOUbTCcqH0Xi+eOdURnFQlmBF3eEDwAOhs8QCEMxVLZ+8KYbvbyvp ZouF6Vlz5vfeza9XnFipToguoUj7ofQC8X808n85J6Phj2VUIZQWH1j8VmH452XzKCCRqE gtweZRXANi9px/EkcYi8RakwDKIX0Eo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HeAhneLt; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711551203; a=rsa-sha256; cv=none; b=S/6UPUtxXPR2781tPgp09D0YaZiJmM69znCGpWUTs1gKisVDOsX3onWq/xjkXqeJVte77P gSpjSMOYnWOLYKDtrDKI6ndIPt3Her2RlAzGkyc49ru1OFeAxVxw5IKg2MLWrkh+8yd8rd gcFJV4oLpZMbKbpTc+fdvwzRY/mdNHI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ckymK75l4yG52iWkxXUUW1WtPRWM8wKY5jH6qkBLMa8=; b=HeAhneLtW/QNjhDNzpccWb4Om9 dqBUjJPUJtwc0PpEmi5GPenjk2ym1aCq87sF7VRzGNLdZpgYx+NyUTSZ5ucBAZGHWJkjbY1uDWqjO yXXXfJlYk45/8q4PyWEjbanOmX7IHdq6KfIqsJUiisbisX7P5Y6OkBl3Wi0MrmET1lwG5w837quXJ Xc1CLpbmMFq3467j7q1e4P1CYKwlzetSrc8XwP5v/Yz0wI1zREzGp975/UC//LPNw6fF6U+ZqiCmX xKtL4woJZRihHh7Wmmpv5+QkrKs/Eoh5qxvaqUkeeTWCL4vVkWA1YtNbsgIYN6fZCBZmRFt1RaV+Z jZNN/dmQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpUeR-000000045Yo-2VZK; Wed, 27 Mar 2024 14:53:15 +0000 Date: Wed, 27 Mar 2024 14:53:15 +0000 From: Matthew Wilcox To: 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, ryan.roberts@arm.com, steven.price@arm.com, david@redhat.com, Barry Song , Kemeng Shi , Anshuman Khandual , Peter Collingbourne , Yosry Ahmed , Peter Xu , Lorenzo Stoakes , "Mike Rapoport (IBM)" , "Aneesh Kumar K.V" , Rick Edgecombe Subject: Re: [PATCH 1/1] arm64: mm: swap: support THP_SWAP on hardware with MTE Message-ID: References: <20240322114136.61386-1-21cnbao@gmail.com> <20240322114136.61386-2-21cnbao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240322114136.61386-2-21cnbao@gmail.com> X-Rspamd-Queue-Id: E2DE8C000F X-Rspam-User: X-Stat-Signature: o9dd1pbfkq4p43z9wy6ndr5m4z9hc4pd X-Rspamd-Server: rspam01 X-HE-Tag: 1711551202-389746 X-HE-Meta: U2FsdGVkX1/CVi54cQoxd+T5wtAMF53fKppgZPJQ+CPviUCOhUi1+C/TURiSm7GN5OEejMppHMaXgUOZp/s64LM8eac0NNJp+AwM7hgGcVseO9l4pAaiDPvARCLCXN2G2eAetW22oXYW+aGyjEOmFrz5TaPVLCS+GaBPzOmmvHepYbr/ay23Sjsilpc2LhjiVBUhaE8zZOPSZS/x/aXb8ZzzjYlVjxQH+WVwXDuCFNnQtGXzK1RtMe/H7bbLwTEnPlF9E1S8Ntc8v+r0Dr+amYd7ESjtYsuOkNbEHmJDvf/WPbHBQA4exktqorSslx2cnT4cAy187nOqXjNVTVGoOe8yN3rutek7wceYZF4qpfixCktG6VfRnfx3azWaKdRuwO7Ks0heqNWFHtWwXOzLRc+4krWSuEbmxkp4k4SBpSP8zLthOPHLiHtFwGSZSw7ZQPTdnNOF/DhRJkRezQwCpOy6VRtJCsvd3Cw4bbcQmHF1sBBRll8ei+SA1I4oiWkjhCWX9WJrKzEAJRAXJy2laIzEbzxFAG7CkxS1FU7ogP4c6QFP/Fhhzvuvq5jrFwSlcrnSrqy0Imw+heBBoGQ9jjXe5cJ5znZYPRiVn2ePPrmbKWJamPn7DFW15TL1yCP1XyuUotiAzHtR9Bu0WVHFsSxp86qGQjxtlta3SLR3z5iiaiJhlA9cAbK0IFs0RgJUURBret2YS24romi1swbXp0cLbcaEgus7AA92by9b097wfpgM8LsbKBzJMfTGd+V+rgycYzkP66ATBBawygWsoLMffy0awBgC9eqHYcmx45NRhxvZ/nqRzVf0dGX9OjYkIetLwasuNHj9SvmmA8E4BiOFeIvBKeZayuN5mrh7rbZoBBPJIVZx+5CT9Y+ailS+cnGknqLdPi1olL3P3Ps4ifaz4txBvIsZbJw714d1UUgsuApXVb37LrW2YVuLXBON9RiLpHQ5K18NTlSwDm7 FgekAFBD FsYu4pLiKAJxwkvgMSD6jvqSWnv+YVzQ5qWPE628teSqdOtibQkzOOEK4sxQIKPj1VNu6GAPYCR3bPtBr49kHo6/rq2/WANy5oU2Ffwu9q5Z8y0pEzJ6Nz8uEe+Whiy8O2SAYJ9Ra9AR1narPBcg9OJhZJ9gGNcgGYrFoJHZVFbbuUmnWlyh+/f84Zg== 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 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 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. Looking at some of the callers, the call in copy_highpage() would need to be lifted to its caller so that we only set the tags once per folio rather than try to set them per page of a folio ... might be a bit of churn, and I'd hate to try to do it myself without being able to test it.