From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-101.mta0.migadu.com [91.218.175.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1035144A3F1 for ; Mon, 14 Sep 2026 12:30:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789389056; cv=none; b=FBO8VoG6kcaSrU5eHpJqiCqsUq9A12XxHJYH/f13eyrSU4ITGtOXbomgkGecK0mZkhy+FKNSsmEITV1daS5GUL5U2X7wgZqfa89pIO+NlzsS+TmDtoSAYuO60oRsZHpcZllcJzB4HQWReHeLFlTRWa6U7NLQFRjuCZmoLfj4dKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789389056; c=relaxed/simple; bh=owEO/GVV8kpSqjtX6z75OJu1GLQvZh0Qa08KVOaicH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h09CHJXAHDR8SyL/jGFPj1BMNp6h976tDCJshjKAFYzYYdRktGeMqWnDTcTyfrnWh4DP6z/ildJf4+nUZYBpNa/J3XtOTsO1xju8U7dVwmOBRioQ4Y1IicGndlcddquUbhPeO79q2R6t9Yr8FdDjwZo2NTroOi+KmOV1xhMedrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=isnHcp9w; arc=none smtp.client-ip=91.218.175.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="isnHcp9w" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=owEO/GVV8kpSqjtX6z75OJu1GLQvZh0Qa08KVOaicH4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789389046; v=1; x=1789993846; b=isnHcp9w4G5qacNcvS5Mi2mZmyThOkjHOVouC8pU6qeH1NSF/4NNT1AjSPqvT2kBoal/Bl36 PpumCHIC/3aZbzZR8durkmpjgBuFwOyZtHY8FpN7SL6Dim1DUqq+wrUtM9tO+K/Z5xtgbj5daHa M8TnSIR9IYEB/oZefNVYqUZ4= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id 64381a4a761f26a4; Mon, 14 Sep 2026 12:30:46 +0000 X-Mizu-Trace-ID: 64381a4a761f26a4 X-Migadu-Flow: FLOW_OUT From: Usama Arif To: Andrew Morton , david@kernel.org, chrisl@kernel.org, kasong@tencent.com, ljs@kernel.org, ziy@nvidia.com, linux-mm@kvack.org Cc: ying.huang@linux.alibaba.com, Baoquan He , willy@infradead.org, youngjun.park@lge.com, hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev, alex@ghiti.fr, kas@kernel.org, baohua@kernel.org, dev.jain@arm.com, baolin.wang@linux.alibaba.com, Nico Pache , Liam R. Howlett , ryan.roberts@arm.com, Vlastimil Babka , lance.yang@linux.dev, linux-kernel@vger.kernel.org, nphamcs@gmail.com, shikemeng@huaweicloud.com, yosry@kernel.org, qi.zheng@linux.dev, luizcap@redhat.com, kernel-team@meta.com, Usama Arif , Catalin Marinas , Will Deacon Subject: [RESEND v7 02/29] arm64: mm: add PMD swap-exclusive helpers Date: Mon, 14 Sep 2026 05:27:52 -0700 Message-ID: <20260914122950.3283997-3-usama.arif@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260914122950.3283997-1-usama.arif@linux.dev> References: <20260914122950.3283997-1-usama.arif@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A later patch keeps a PMD-mapped anonymous THP mapped by a PMD across the swap round-trip, so PG_anon_exclusive now has to survive in a swap PMD and not just in a swap PTE. arm64 encodes a swap PMD exactly like a swap PTE, so the new helpers wrap the PTE ones and reuse PTE_SWP_EXCLUSIVE. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Usama Arif --- arch/arm64/include/asm/pgtable.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e89ec5f4787b4..d3f53a601aed3 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -599,6 +599,12 @@ static inline int pmd_protnone(pmd_t pmd) #define pmd_swp_clear_uffd(pmd) \ pte_pmd(pte_swp_clear_uffd(pmd_pte(pmd))) #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */ +#ifdef CONFIG_ARCH_HAS_PMD_SOFTLEAVES +#define pmd_swp_exclusive(pmd) pte_swp_exclusive(pmd_pte(pmd)) +#define pmd_swp_mkexclusive(pmd) pte_pmd(pte_swp_mkexclusive(pmd_pte(pmd))) +#define pmd_swp_clear_exclusive(pmd) \ + pte_pmd(pte_swp_clear_exclusive(pmd_pte(pmd))) +#endif #define pmd_write(pmd) pte_write(pmd_pte(pmd)) -- 2.53.0-Meta