From patchwork Sat Dec 14 09:02:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13908428 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 8BDE0E77180 for ; Sat, 14 Dec 2024 09:04:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C21F6B008C; Sat, 14 Dec 2024 04:04:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14BB36B0092; Sat, 14 Dec 2024 04:04:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F06E96B0093; Sat, 14 Dec 2024 04:04:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CBA9D6B008C for ; Sat, 14 Dec 2024 04:04:07 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4B23BC1C5B for ; Sat, 14 Dec 2024 09:04:07 +0000 (UTC) X-FDA: 82892976474.19.4884018 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf02.hostedemail.com (Postfix) with ESMTP id 9984C8000E for ; Sat, 14 Dec 2024 09:03:14 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=WHr52y9B; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734167027; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pyTYWh3zj2l92o0qEOJPcU0U+om/laakNd04Rx8p+XM=; b=sfS8za8yYyrDaGxIqPrdRR5eKPQ8mcJMwKi9GGdOZn2YqJ3ALW6kPrgOUl2JpIVNnL2Kzv 7b3uWQ302gRsREhUO/g5IrHwO23iDhg6vLY09C2vs6NG1bYm/rXXKWcfwB1HE39TT0wGcU 3/+u99ypxFOkCqXgA8AKClFU/hcJuoQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734167027; a=rsa-sha256; cv=none; b=UAEMpudGSwdNc4/1fqr0NZ1Ay9CHd9QbYx8QNVTlMcQaiIFHQTCJsMMiGC9e8zXm7CxfcS MsIOpfaoTk7vgxKOh6JBrSDwBT51+aoijd96IhUUXVV1Wt/8pYyIh4jDuSANogp8PGHstJ ACaH++TGHLXOF/ad0ITDtLziojM156w= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=WHr52y9B; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2166022c5caso20752665ad.2 for ; Sat, 14 Dec 2024 01:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734167044; x=1734771844; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pyTYWh3zj2l92o0qEOJPcU0U+om/laakNd04Rx8p+XM=; b=WHr52y9BclhaBz2vvpP7Eyk3s36FgffaQZAQ1Am2MemAQlBFHcVj2L3pSuKyGCXEvD O6+o3/iSQvj5iE0V+4Xav5VuTO1uOx4QaMn1PRq5AE5kq9B5J/11S6PbQccxE6vnlti7 N+nVg4eZEt/CA0FsCDAxhFJigLnlL9935FtkIHLE6O6bT3UQ+llggdIpct17dYNV/Ifx ytvOkBf2HxY7sCvi/0wX7d7fmRnaQVRHlIlhvIN6aSuFPSW3yu/z/9nV2jwU9pvRgVF6 /pCrnMmo99t71z/u665189HckiqMv3Za642RJHPcmcIWmWd/1m7vwZ+2hwNHAgdboL7y 2L1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734167044; x=1734771844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pyTYWh3zj2l92o0qEOJPcU0U+om/laakNd04Rx8p+XM=; b=W1Hdsp3Scz8NrdrFHU+ZJKNdXsX1Q3AmUydx9MMLHwDN/vNztjKSWQF0FL+qnt6Qs6 IbUirUBgcBDkrwvPIj70PfnISq2KeS4zQrI1f8Z/mffGVfSk8EoSdEAesbtOOJN50a60 gF4HkKne2ayZgbkM5iEyf3847uYSuccKr54sSYNjic4Y837FjPh82i0g2dQ9IHBv8/JJ +UeT1rwrBKyd1/btqM4KLGT5E3MIksb335gN+y6zBcNAdTfotLYX8yRZ2Nhc/Dp4ggnZ BO3Le13hnsjJyOs8qywuEAUEqN2jDseK0JJ0ho23RD8/lvz+xgpBAsiINWYD6Cwc72le JX1w== X-Gm-Message-State: AOJu0YyFjT3eVU5JdKoR7Sv7S9aZ1HvJ4ViHdp5P4fcPLtdIwQyIKfds NgtRHZB/Vp9iV7yrMDokZIDAQ00PXtxxNvYe58eoZbWATUOB7s0jG/DlCGBPKgk= X-Gm-Gg: ASbGncshUqeGFMVnHFWKONqDgPAjgOqCecdTOZida12yMVInKHHeeNB+8kBtxageCWM wsrwQfC4STiMUataLLSeliwvkyvXX3BfykW0XRdYf7lWOPtKsX8ZDqb2ojpwoTWARmwZ6MjX0A5 xPO7oWjTGjfFxVvrVUhqtP8H/Cx3/F+r0p9znY/HNnA25qWIoItszY3X+FxE1nw+TZ+ZEwIloPx Czq6S2Bt2bRkxhkmyYiYWI/UdIWe2IjQcDerXqZALuji32qiBIrreQZK5vDid9bsnYAyQsX0Rhu ECaeI/2WyQcXBJsC4jFGtAp+zaH2zQ== X-Google-Smtp-Source: AGHT+IFlpyRvtlHG2M4nIIBLJzVMLLLjWf8IFr835Xb0HMOnd3F4yHyM51MIPZOReaS2iWrLwbmGTw== X-Received: by 2002:a17:902:d481:b0:216:4b66:1f1f with SMTP id d9443c01a7336-21892a7c538mr78037165ad.54.1734167044262; Sat, 14 Dec 2024 01:04:04 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([2409:8a28:f4f:a9a4:5d46:4ef0:daa9:1db8]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-801d5a90ba0sm905731a12.16.2024.12.14.01.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Dec 2024 01:04:03 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng , linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/12] arm64: pgtable: use mmu gather to free p4d level page table Date: Sat, 14 Dec 2024 17:02:49 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9984C8000E X-Stat-Signature: 9hu36g8mjgxefafibubcnnijybmngorn X-Rspam-User: X-HE-Tag: 1734166994-963515 X-HE-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QbbaAzEqD0QkImCFpVWcnpkzNwaO9v/7k02fBmE66ikLmlttBCsPL7SkgX0JxNBJAqcTQRy5Jf0zOYu7er7izXBeqEvGo+uGIcqliwzx0V2tTOXYSYjm4tlNyMlY824rOuThBaSCCnWXpBh17PBM/RCLtRGdOGRga8OxCsIbhyvx5UnEFdlvjspaE05cBRb0I6Jo1IQ+0n3IPS1Gu1BnTy2T7xO5oD2G+DV3d9/Tzp6mNOhSes9lh+p28vmNgbCnKy0vLgpWrtPa/zUEIDEPXHmXmX98+UZs9ZVstSAHO0g6M+9lrZYQE X-Bogosity: Ham, tests=bogofilter, spamicity=0.000848, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Like other levels of page tables, also use mmu gather mechanism to free p4d level page table. Signed-off-by: Qi Zheng Cc: linux-arm-kernel@lists.infradead.org --- arch/arm64/include/asm/pgalloc.h | 2 -- arch/arm64/include/asm/tlb.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h index 679c530549327..58cc260b6bee8 100644 --- a/arch/arm64/include/asm/pgalloc.h +++ b/arch/arm64/include/asm/pgalloc.h @@ -100,8 +100,6 @@ static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d) if (pgtable_l5_enabled()) __p4d_free(mm, p4d); } - -#define __p4d_free_tlb(tlb, p4d, addr) p4d_free((tlb)->mm, p4d) #else static inline void __pgd_populate(pgd_t *pgdp, phys_addr_t p4dp, pgdval_t prot) { diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index a947c6e784ed2..445282cde9afb 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -111,4 +111,18 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, } #endif +#if CONFIG_PGTABLE_LEVELS > 4 +static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4dp, + unsigned long addr) +{ + struct ptdesc *ptdesc = virt_to_ptdesc(p4dp); + + if (!pgtable_l5_enabled()) + return; + + pagetable_p4d_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); +} +#endif + #endif