From patchwork Wed Dec 18 13:04:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13913614 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 6FE23E77188 for ; Wed, 18 Dec 2024 13:05:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC4E06B008C; Wed, 18 Dec 2024 08:05:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E75876B0092; Wed, 18 Dec 2024 08:05:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D156C6B0093; Wed, 18 Dec 2024 08:05:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id ADA956B008C for ; Wed, 18 Dec 2024 08:05:33 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 782FCADD2C for ; Wed, 18 Dec 2024 13:05:33 +0000 (UTC) X-FDA: 82908099078.17.E3E3EBE Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf10.hostedemail.com (Postfix) with ESMTP id B0E40C0019 for ; Wed, 18 Dec 2024 13:05:17 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=O7ybMgrN; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf10.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734527101; a=rsa-sha256; cv=none; b=WEJxkKa64T1wi1Rwf9ZzaHnGcPQd9m2XuNwBoafxa0RLt/6SbYWPPJm+J2by4YL/ovOi2H zXDTxEH2aV7528nnfnyPoEthKXMIiufRazN3vzqfkSthOyo+wONYQZwZEP8/Iq/L3cZNx2 3VfzJFI9/QhtyuSsYk2V5rdkd3Fvlx0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=O7ybMgrN; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf10.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734527101; 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=hRj0wkIcDyLmKPONLgLEnODGJVOQ/lxkeDhrLguGMRU=; b=YwJwpB/2pgVVNylSQULPwlnI7ZnjMANpqmIotir0OVf0TV5rEV7+3QOe0SyTA7Uh6rS8KC cr7oKcxTYU+gi2BpzqcPw2qWxvm52Z2WywF1zYMD+4PJbjUr8SvPKi9xU4dCCTfx27QtTL UHmxY9MODlDG/jCqxos1rBlv5F5aR3I= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21661be2c2dso47941675ad.1 for ; Wed, 18 Dec 2024 05:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734527130; x=1735131930; 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=hRj0wkIcDyLmKPONLgLEnODGJVOQ/lxkeDhrLguGMRU=; b=O7ybMgrNTe+IxaL2eRc4HxwnZWNitNtoc3f1lDKiiv6IiD7NBt8jhILVo2wsTDrI5Q 8C0AqpVX78Gz92gNH44eWEj5BRvNC5uBys5PFLoiINl0Uk7UnTi9d7tRxruiIkgaI7ot d/0WjFu+Eys6HHmCyHq+I4RlhocRWV0fqF7QpSzLHK4Rjg4+tT5svv8kQNfVfJeXqRj9 Ii4bXQisGJx31D41IShFMB125VBYcezY9eBrmQY5SbVAikL4Ak3Tndy+4AN4ZY12nTZM 8DP4NKFJMAgu8pWYV9ktqHl35gizIJdTpeFPuezJF3KoM5mIEF4b8nt7zvwmAFFJ7Rs3 MnOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734527130; x=1735131930; 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=hRj0wkIcDyLmKPONLgLEnODGJVOQ/lxkeDhrLguGMRU=; b=ijgxS7h2WnQ/+TCI+NQ0YObpdlLc4bhfpUBySHcEPkIgsdLdz2PqluzUStFoIyf613 eq6MxNiB13SSTLmjStrHfeMuoLyqpJjoTgtwGvazwhExfMGqZ4CFsXdPwC4GJ98ZFfq3 fmEZRiz29yqXkDBCY8ud2p6xctWzbVX+uE9XNiSsEay8jSiqzhi3j7cu+hAiCLRZR3Br BgCkN0YSF3aScNdhMA3eotznnDtjUVrYWdn82dzoahLTtJB5DLIqkYWjGNpxDUz/qEfF GiU1QzunHJgmritGKeEQ+O8ehc2bPRymzclenZTLHmvho9x0NV+bqep78yYcWbgLc1sL PsjA== X-Gm-Message-State: AOJu0YyqCydfs2RODzszyBDH7rW1zlkzzLv2FsZMY/14/R4jznvMJy2M W4eRiJPSTrbeL+dxq27U5myjoUi/AM0BvYuxCNIlqCHfVaV3VQW0B5ApZV9EL7Q= X-Gm-Gg: ASbGncsufjZf52Pl0saINqsDr2+8kw/shG+ZAQRHbus2D4716pe5D2X/bwTxNEWnlgd +XGa+D+j87yN3jNmd8AK71OhDJs7/FX0XGWX9EKKIif2n8SCp/rjA5JJEz6AzPs/5ce4jvPBGt0 eOs+GejRZ6J7HCWw83F8/UG+hio+gjCEKWVJBhgxmfZhi62ZA8AHEIwCZVtmjb2COgQ/L3oTC1S hyacnbO/18XKNUDyylbPdC8N2sRvOUYs0GJYXHNXXzscs2552vEW1rx7Nb2Ahfy5ZcLpDAxk4/4 UKPssShnI9WW6bTDXkHJ1A== X-Google-Smtp-Source: AGHT+IEbMQUiOWkQtVsukFUm2ZLuTFY97EKfs/PZuqMM+WxRQxlasXxPYQ7Z03KXqwqNdfJrdRWLVA== X-Received: by 2002:a17:902:e5ca:b0:215:4394:40b5 with SMTP id d9443c01a7336-218d724abe7mr34796235ad.43.1734527130325; Wed, 18 Dec 2024 05:05:30 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1db755dsm75751825ad.42.2024.12.18.05.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 05:05:29 -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, vishal.moola@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 03/15] arm64: pgtable: use mmu gather to free p4d level page table Date: Wed, 18 Dec 2024 21:04:39 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: 4wg4yzmo6qq443irh9ssoyrsgmpf7cd9 X-Rspam-User: X-Rspamd-Queue-Id: B0E40C0019 X-Rspamd-Server: rspam08 X-HE-Tag: 1734527117-281024 X-HE-Meta: U2Fs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VIEpr/dbFcrDCPMAfRiiXhdlEwdxBJwykDqIjNlHX3Lyf6/Huu8/1F3ZfaYbUtypRrOD10SY94RnOSLChNbCZ0k6dIl8oUw4Aj7dyFUqbuygMSaqWguANS5ZZfwvl4r8DEyzbM6X7ogD+Mc6hRpELmeH7NW/rNiDhbI1vAVpHGBzzi3aOioTwUgSGGtXkOg16Tun554jfP0mB5KikbvBTBTr+FuSkDiQjaYHAA6bXvCyhwnY05uA8bDCnr4o7nZm7uhE1U8/FPFsULPHiTsCgH7GTJPj39HRaHpO9uwL6ZYvPeyCFFzQJ8UG5dtjDR0YPLaWb3A2KVxs/mKPzTOQbNZ/0QyE6psh+p4OADxZA5AI/8n X-Bogosity: Ham, tests=bogofilter, spamicity=0.002910, 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 Originally-by: Peter Zijlstra (Intel) 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