From patchwork Mon Dec 23 09:41:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13918680 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 4E390E7718D for ; Mon, 23 Dec 2024 09:46:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4B6A6B009E; Mon, 23 Dec 2024 04:46:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CFB216B00AD; Mon, 23 Dec 2024 04:46:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B74E86B00AE; Mon, 23 Dec 2024 04:46:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 989986B009E for ; Mon, 23 Dec 2024 04:46:18 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3E3EB1A111B for ; Mon, 23 Dec 2024 09:46:18 +0000 (UTC) X-FDA: 82925742858.14.47B13FF Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf19.hostedemail.com (Postfix) with ESMTP id E6CB81A0016 for ; Mon, 23 Dec 2024 09:45:36 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hVoCompM; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.180 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=1734947159; 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=FItpERzyh1wDMphf2PSqriZlspFkmpQlPhA2jGTCtDU=; b=UM5BFORbmtDNgUrKsa/2UeRhYAsbWfH0IaDGRyWtZaiNjyTqm2CyvTmxNeTrATOxkjSxgn RIjtS7c+ZlZ0yi5zZJbjQ0W6sYAA0Pyw+oc+lSYmgM7Oso/azEnrGsxpTpgegoSlmjwofq +hXBJTW5lVf+G+6wrAnruQnPr6BebCs= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hVoCompM; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734947159; a=rsa-sha256; cv=none; b=Od140yefAk1M8WNDQ0Oo1aXTeAyKQ5HzFEJ/avlCFkz99POozWeYdH6c60bZ9HnJ6nCqBp TzbaUtXqQwON27qcc8C5c3/sP71wgdRR8GF1iD3OXi6phToSs4VXmQV35AI8yr2NRwzm5q KxdppNWFHptzdKMknj2IaRptZBvW41o= Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-725ee6f56b4so3378735b3a.3 for ; Mon, 23 Dec 2024 01:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734947175; x=1735551975; 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=FItpERzyh1wDMphf2PSqriZlspFkmpQlPhA2jGTCtDU=; b=hVoCompM+2//nNel3xjaNGArI6lU6ZiT4uDvCVwo+zTDbXS4sQFcR07b7z+b0DzrJ7 ni+dasN7h8imwVA6xQVV1OyA+jrDQLoFryQ8cZzyuW3QNyHp8hHuw7L0FWJUOS2qpOFO E+1DJ0syAypAJqVo96lAZNzJDTRyvyWzU9KLv0a/BUWdAmgHULIVL/Oqintwf7QT0I8G mcbhjSzfVbQbaPH2TacANhxKaCP4GvWBYdT5sEvaDZdM3sGtr11k72rAuCKF8YlUaiRq IFuaiHia+0U5Ynh3eiOouS6zOZzAyKg59v6JaL+harwD82Jnqx26raRt1Yi5i2Nnr26W LEcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734947175; x=1735551975; 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=FItpERzyh1wDMphf2PSqriZlspFkmpQlPhA2jGTCtDU=; b=W73DWV+kvGkFR8N6bh/hm4/mGmo2MzxQ/KcrqEveM+D0TNz8tGNNCWr3Qq+2ol6AG8 OsCmI7YqEiuKn6iBaOkDvIRGbwBIiF1ddTapsKjpXDZgS83oII3ioGxdgwLnbafi9ZMS GSfH1coWByGZ0YLM4BPHWF9nt8yxlaKzLooWuWtD5I2UJoeeXUIJse++gGTnTSMhg6yY GpPhEXtN7Jo3EyWXBtCNTdAJUWPYQGBNKgLxjx133Hfa1aXZ5hR2sMq8rNuRY2DYOQY7 03rV/NdHx9eURwoH/8wqxErK/DhJiB/fere60v2SG9b5JrIN1CbYyE4bvA4d2qaHqvB1 ViuQ== X-Gm-Message-State: AOJu0YxTZhCD75ZdJyr/OjDfDPCjd7I+l8mpj8eo8Zc3CLiZBlFiHhRb drsVO+ghDCWS1OcE2XiUnt7URFH0imGxiGgLv8ODjoCAwDVyMFIMbJKfYgVZx10= X-Gm-Gg: ASbGncsE5fwVbbPsQk/X2Nlk/j3j9hNuUTkmrUuXq76ewZajH7flL87OsHRpREDpHkk DZPSP9x3e5wUEt7C7G5KYQm3i9SnFEv+jMKM6A1Hri5HSh7pDVGngQC2zUO9wTZAN1l5dd04qLB gkZC7/OQRKl92H2yo/N62jRu0CZz3RrgRfuDAiGNE0PyVuIWYgY3m7RSNgUD+pD1fevR9yDvOkW 2WVb/zthrLhuWkWYBSF5U5vUT0rCjPpbG+xll5d6IIfeeqrbG1uRBAj3HRx/xiJRtblT6KfP4da N3/W0ruZaQLWCSbNA9Ed7g== X-Google-Smtp-Source: AGHT+IF9RJvbCaq38Te31r1RKGqLS5POHI3EPqaSbNpVA67C9keEJqX0jQ2rnqy+EikMhfv/vLwTVQ== X-Received: by 2002:a05:6a20:12d2:b0:1e0:c0fa:e088 with SMTP id adf61e73a8af0-1e5e059b19cmr20289317637.18.1734947175103; Mon, 23 Dec 2024 01:46:15 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8486c6sm7468309b3a.85.2024.12.23.01.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 01:46:14 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.com, 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, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Qi Zheng Subject: [PATCH v3 15/17] mm: pgtable: remove tlb_remove_page_ptdesc() Date: Mon, 23 Dec 2024 17:41:01 +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: E6CB81A0016 X-Stat-Signature: c6wnr1omktednyeeieg4hftmeu8h87tk X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734947136-181438 X-HE-Meta: U2FsdGVkX1+Zo3Sa1qWAipNIuMPXkk/l+r4K+JSQrI9Uqb1X7oS7otcA87cHazAjovC2K7K1Uo/1T8XhIH6FOZJ8xYg7dirPyDlVOSFS20clLHl02dwRGeBTODCrN0akUhxQBei+BgwYqNmh0fDxzXj2rXF5GBG3M+vG5zhts0jXdh5ptqy55JArp1f94rFOgnvJBuWPl6AdXtkMxBFRdUl0i8dvvckjXhCAVIEpYd1AhqA3Ee9hXUL2ClQ8pvYLiVml+76g1N7SUIBoNnSbMmh3/r5hiGcPUulN6pdSLiYgVe6cFOQVNV8Rzm/EJwRIKlpopdqRcaj1vSuDynmyr1eQxDykq684zE72SGL5KLHAKh+WMXb8ONWu5nf8g03Eo8Q90zH4zHpmivShGNloEZMyLj5FcFnJ12FRxWI9U2Hh5icwfHX3+Ab2/27/vPiRzDfMEyQEz4ckAxOHLfXK57CO03yWD5HEQXNB8wUhE2KopKiJE02LLIYkYmsP9QJ4bMWFErGwIYP8qbSYQL3kJNszbjCEU/V8vZPTF2pi+8ctiE3aQ4nX8IyusRKEUZO2x3PrCC+9uDdcypkWd2O8xVOO71WrQtdSw8NS9dV6dgbwlJS4YDgcxLMlL3aKuYWEYnN5DLxMXbxF+NTx3XC6L4MgxV5gpyVkeqUT0MZ8DyPQ7Jt/3dEzq1CPd/Fv4JBH5ukyMG1EM9yilKhJw95EuKYmYN3KyWiHsYTl0iWyX/zdW57c0rz8cTbbg4TyYKE8IS+KWvT1cilbBYhm+ZGmoRF6BVTFYS0mCTWb8KYOkLliTOVj8Ww1YGSOiQRS4g6sA9PS2vGRy++BXJadro0cjlmEjaHWST2x0XJO7XGqPTBU1Y91/wOMebU6X9SQNTACmlG3gdQzYmo5fBhs7phk6PK6ADHN9bpRoy7BGiSMKOnsZecJu+XuLHd/9aYHr4hm5Pw39HIcIoGr01xrRKF xV4VdaAV oXn8EFcKnJrG9ix2gBK1Rxx0n8cVDuNIQfjywxJ/jUOoE9e1w55M1xnuqrovwy9ppE21X+FggdU2QNopw47zjbWxXKX3EA//znxR5H5G02I0xwF1r+vxERr0++7V2VBhVliYFaH8WZ/TuxgnWyKghsq2Yk08q5BJO+e7sAoi/D26+zMxUNXvgng/3meWCv1MGvnlXIWv+M7u6Zb6sEyL6bm5wtfsWk16v8yNKQyMoVRq9koaNjeawsj3C3GaeYCwZDFO9ak8cxxWgV2ec7DGvMpnicBH6d0sdQrRfhjcr2ez4paOCLGGlfwOT9OYxwy8Mnr9EIgbnrNAoh/qyYbVDzKeKH2SROrfajHMNf84zYLROcxnHIsVSRuHaUlO49wRAjZ/KqfBALF942kLQzdnrRse/u/lv51y29o8xRcCTblERHrpYZUTawLpibcO8JGbagnBJVJxM7aUJjyotLjCFvUUHmpWNghUOPOh27qCxquBWI+I= 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: 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 c8907b8317115..ab4f9b2cf9e11 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -29,7 +29,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) {