From patchwork Wed Dec 18 13:04: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: 13913624 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 60191E77187 for ; Wed, 18 Dec 2024 13:06:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E024C6B00A7; Wed, 18 Dec 2024 08:06:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1506B00A8; Wed, 18 Dec 2024 08:06:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2B676B00A9; Wed, 18 Dec 2024 08:06:40 -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 A37366B00A7 for ; Wed, 18 Dec 2024 08:06:40 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4ABB680DF9 for ; Wed, 18 Dec 2024 13:06:40 +0000 (UTC) X-FDA: 82908103530.11.A647DBC Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 911B280026 for ; Wed, 18 Dec 2024 13:05:37 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=lLBXLN6L; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.179 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=1734527163; 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=qjP41dwIWVz3voDw1szUdJpl6GJGCX1n8EUO4uIA81k=; b=7f7wThVSjUgAPs17NHy198tP2Gfux6Z4M5m9NdzzuuJ1sR9l9CGVrhOy6844oZ9oudSoY9 8eiFUD6losuLH1jtfPw8gm5KEDfO3EuTSQ5zdumahuQYL2zC2TRqc0GVQ39WIcxWLWN/jS HTF/yFhN+FSRkxSUiQh/tMmX/tOLs08= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734527163; a=rsa-sha256; cv=none; b=EMfCQTRQKFAEYi4FElMBhD8EC7MHRgYJjYuuRmMwKAy/MyHqnJQKqVYPQLZW5aKwP70Ow/ b1akc6eGUjnu+RDE0fn1NmGERrgWk27YfTWOWLA+t8Sk003SxhfZBEIIfztD3ZTietX9H2 PHrtnmhL71a/RNwC0LOJwJPr0rF3oaI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=lLBXLN6L; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2165448243fso63081925ad.1 for ; Wed, 18 Dec 2024 05:06:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734527197; x=1735131997; 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=qjP41dwIWVz3voDw1szUdJpl6GJGCX1n8EUO4uIA81k=; b=lLBXLN6LTr8LjHSGRXwNDhg5HxUbpjIQfSpI5RWO4GB6rZp8M4kvkKTpw6GoDJb1/5 sThUGyCW0Un79l86O9zQL9TWzDRj+iNGLU75DhjPh4dux+xRcu6zNtpauU7RpJ9opyov Fx0V9/wAogjMnWvXzR1rcRxaHuuJqs3nUEMWlF/tgwuf015M9/aegDeUitVgAyDJvtpr K4zhAss20QkOsFLSmiD6/kXPourN7smrgwUQOrWtQfxfmX1JPxuFiH1bia8P+QyUz0kM 5DWVzmXnbSP42KaDoSCjThcqsVUXB7YluEWrlegA8L9uMTaGVyj57BIv0MvOjlX3gEQR ZeKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734527197; x=1735131997; 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=qjP41dwIWVz3voDw1szUdJpl6GJGCX1n8EUO4uIA81k=; b=kLY3nl+zzAbz23eyVCUlU64ldwkE7cmpQvDefc+A70WMtD9cVLHo83tne5siiU5pIs w3pGkX6u1MVU0H4XW3tHdFuRlYk0GK2ylQyklBNGksjUMp+E1AqCDLvjYbgvTMX5Z6dt pJtEire79M0jewB1Jofza1v5+ag9JymFCpCDMGjcJ1wXFuYZ0cm0xTOoKddOUNQ58vD4 TeMkizEmmv0WG7rxi6pzN4Igij3cumqth7PChTTr051cbfQUDMTNu4TK1sNAYcR0TCWh zD8igu+Zq12226sr/Zy/GmRY9egjZ7wXvfR8cCADFlWzw5cMkXe6Ta4ncF4iht3YYZFU gDUQ== X-Gm-Message-State: AOJu0YwO9Yfc+chHAc0drR88dfl0ZWOBQA7oJ6VSqLO3HNPSI+yBxkX6 8NR66ts9Xe8Q/zG6KSa4V4zUj92r/TRfvG2+YRGDoY4hgfRVR0aXHb7saYwNhA8= X-Gm-Gg: ASbGncstxmreU8qzoH57vc9IvcNIGA0LCFWXVvGhYN7RzeE5G2HovEhzAMZYNidI1v3 rJ611z3FEcVHQA5KQqID8jHC6xTEzP1qgMyiJ2J17N/Uo9ez9NWEtE3j05W/DwCAPrIu/zTXI++ 5v60TEqtGRUTA5Sepa43H8anjAiPYR9/whxKv7QHKm4TJuB7oaPxOj9YSJaAkx4OkB5yxoRsafp loTf3JaKL/fXFcJ9EHcFVu8pZFWIA4aCzRRhQSNLZQSGC1spCNZBEn+tM9L4JahTA+PXGsWzYbu 1So1ccNjMVxFXt9CbcOIpQ== X-Google-Smtp-Source: AGHT+IGZLlII1E3uD2eJMNDRJL7Et07dogsfo2GqYIDSPjE3P+HLWVdTN80snitMlVb3E/0oGm+VVg== X-Received: by 2002:a17:902:e542:b0:216:7d7e:c010 with SMTP id d9443c01a7336-218d7252c97mr36826655ad.37.1734527197173; Wed, 18 Dec 2024 05:06:37 -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.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 05:06:36 -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 Subject: [PATCH v2 13/15] mm: pgtable: remove tlb_remove_page_ptdesc() Date: Wed, 18 Dec 2024 21:04: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-Queue-Id: 911B280026 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: qbmb7saeaqfnfkehdh8wabgkzrw3em38 X-HE-Tag: 1734527137-128776 X-HE-Meta: U2FsdGVkX181pAvrCOF6DAG76OP3nimNRGgC5KTiDbTGUa08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ou+4VGtsHlQpAQznoLn0Mkgn+QCSeBc3MykJGytgARb2KRrCTlwsne6kT5fWnUc8rRMzJfwBKXCTU72f96rxha6wkHJUXWG6mdj9ZA7M67zCjfIWWtWwb4sehDhajyDCJNkutFlwPFWEyST3A/Rem591khh6WS8T/GAoHYH9vxHknGkIjE/yr6o2EEQ1U5Q+K9hSMJc+5LErN4+gCzv25Tu/nUJqjFxeVXriUQU4TAonkl4v81m6k9Px3ucTJipa/7Gt/7tjHEW8AX/gKCmbY1mg9A87UyOCPCzDURWgqGyj8784Qa9+BHovDwZp+maUG2HKUq693HL5/gqtJgLPy7d6PfYHAGVVB3HqTLCwAkjourc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.005715, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Here we are explicitly dealing with struct page, and the following logic semms strange: tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); tlb_remove_page_ptdesc --> tlb_remove_page(tlb, ptdesc_page(pt)); So remove tlb_remove_page_ptdesc() and make callers call tlb_remove_page() directly. Signed-off-by: Qi Zheng Originally-by: Peter Zijlstra (Intel) --- arch/csky/include/asm/pgalloc.h | 2 +- arch/hexagon/include/asm/pgalloc.h | 2 +- arch/loongarch/include/asm/pgalloc.h | 2 +- arch/m68k/include/asm/sun3_pgalloc.h | 2 +- arch/mips/include/asm/pgalloc.h | 2 +- arch/nios2/include/asm/pgalloc.h | 2 +- arch/openrisc/include/asm/pgalloc.h | 2 +- arch/riscv/include/asm/pgalloc.h | 2 +- arch/sh/include/asm/pgalloc.h | 2 +- arch/um/include/asm/pgalloc.h | 8 ++++---- include/asm-generic/tlb.h | 6 ------ 11 files changed, 13 insertions(+), 19 deletions(-) diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index f1ce5b7b28f22..936a43a49e704 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h @@ -64,7 +64,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #define __pte_free_tlb(tlb, pte, address) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ + tlb_remove_page(tlb, (pte)); \ } while (0) extern void pagetable_init(void); diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h index 40e42a0e71673..8b1550498f1bf 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h @@ -90,7 +90,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, #define __pte_free_tlb(tlb, pte, addr) \ do { \ pagetable_dtor((page_ptdesc(pte))); \ - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #endif diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h index 7211dff8c969e..5a4f22aeb6189 100644 --- a/arch/loongarch/include/asm/pgalloc.h +++ b/arch/loongarch/include/asm/pgalloc.h @@ -58,7 +58,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) #define __pte_free_tlb(tlb, pte, address) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 2b626cb3ad0ae..63d9f95f5e3dd 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -20,7 +20,7 @@ extern const char bad_pmd_string[]; #define __pte_free_tlb(tlb, pte, addr) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ + tlb_remove_page((tlb), (pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index 36d9805033c4b..bbee21345154b 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -57,7 +57,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) #define __pte_free_tlb(tlb, pte, address) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h index 12a536b7bfbd4..641cec8fb2a22 100644 --- a/arch/nios2/include/asm/pgalloc.h +++ b/arch/nios2/include/asm/pgalloc.h @@ -31,7 +31,7 @@ extern pgd_t *pgd_alloc(struct mm_struct *mm); #define __pte_free_tlb(tlb, pte, addr) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #endif /* _ASM_NIOS2_PGALLOC_H */ diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h index 596e2355824e3..e9b9bc53ece0b 100644 --- a/arch/openrisc/include/asm/pgalloc.h +++ b/arch/openrisc/include/asm/pgalloc.h @@ -69,7 +69,7 @@ extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); #define __pte_free_tlb(tlb, pte, addr) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #endif diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index fc50d14010246..da782a80f8aad 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -32,7 +32,7 @@ static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) tlb_remove_ptdesc(tlb, pt); } else { pagetable_dtor(pt); - tlb_remove_page_ptdesc(tlb, pt); + tlb_remove_page(tlb, ptdesc_page((struct ptdesc *)pt)); } } diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index 96d938fdf2244..43812b2363efd 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -35,7 +35,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, #define __pte_free_tlb(tlb, pte, addr) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #endif /* __ASM_SH_PGALLOC_H */ diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h index f0af23c3aeb2b..98190c318a8e9 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h @@ -28,7 +28,7 @@ extern pgd_t *pgd_alloc(struct mm_struct *); #define __pte_free_tlb(tlb, pte, address) \ do { \ pagetable_dtor(page_ptdesc(pte)); \ - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ + tlb_remove_page((tlb), (pte)); \ } while (0) #if CONFIG_PGTABLE_LEVELS > 2 @@ -36,15 +36,15 @@ do { \ #define __pmd_free_tlb(tlb, pmd, address) \ do { \ pagetable_dtor(virt_to_ptdesc(pmd)); \ - tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ + tlb_remove_page((tlb), virt_to_page(pmd)); \ } while (0) #if CONFIG_PGTABLE_LEVELS > 3 #define __pud_free_tlb(tlb, pud, address) \ do { \ - pagetable_dtor(virt_to_ptdesc(pud)); \ - tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \ + pagetable_dtor(virt_to_ptdesc(pud)); \ + tlb_remove_page((tlb), virt_to_page(pud)); \ } while (0) #endif diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 69de47c7ef3c5..8d6cfe5058543 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -504,12 +504,6 @@ static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) tlb_remove_table(tlb, pt); } -/* Like tlb_remove_ptdesc, but for page-like page directories. */ -static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) -{ - tlb_remove_page(tlb, ptdesc_page(pt)); -} - static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) {