From patchwork Thu Jan 23 13:26:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13948262 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 492DAC02182 for ; Thu, 23 Jan 2025 13:28:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D41426B0089; Thu, 23 Jan 2025 08:28:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF1686B008A; Thu, 23 Jan 2025 08:28:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B91C36B008C; Thu, 23 Jan 2025 08:28:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9B0B16B0089 for ; Thu, 23 Jan 2025 08:28:41 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5AB0F14105C for ; Thu, 23 Jan 2025 13:28:41 +0000 (UTC) X-FDA: 83038796442.17.A1A0EF3 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf05.hostedemail.com (Postfix) with ESMTP id 8813D100009 for ; Thu, 23 Jan 2025 13:28:39 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=c9zyR0gR; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf05.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737638919; a=rsa-sha256; cv=none; b=XioTIrtYIWHCQ9aLczwuuuIocq+fBDOSQhCs4MQ8NRXx8sr1hJGo+Ddm2sY5Io3i9FO+KB 5flnNYQ6vOKtWFVq42lt1DgNu8G5s5cKCKjCfsqT94BCmFJI9ko0Yk9QmoRZqOTOYN+eN3 lfwIDRIdZSSUbNY0fy8aKqOcbKCLjUM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=c9zyR0gR; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf05.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 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=1737638919; 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=FYmxrc32hC6wxjmJA23IxEYTBygiQADV4kK+4R+dKSU=; b=BqgJ79QJbmnUI0L1ymPKOELkL20/KXvtsxxNSP/WBs+TKUiQKhHtDUVWnJvi0vBIL0NaLl 3ctzeyr4fQOsgkFWWkcLaQGVWlcewG4c/CALIHasIBF2hWzDU+N/qa9E4JmR7Q8/t1Ta6v pL/3krDFPGtW60Y3+30Y+ku4aBS5sX4= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-216395e151bso12320765ad.0 for ; Thu, 23 Jan 2025 05:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1737638918; x=1738243718; 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=FYmxrc32hC6wxjmJA23IxEYTBygiQADV4kK+4R+dKSU=; b=c9zyR0gRJQqi7fZ9Y9aw7qcrVVdxDmxuTmIVRy2EVmscrz4EpsvA+SrGCCP6mGE5kB fJ4ushOqXDFFGB13BjfFx++D3EOXCkIhgd2Kts58EtNbNvQTxcHRfokb0V4KxS+C4UjP 6r1/d1IpdLyYYrbPOBFPOIANCaWEpKWmSTo470WSSIXG+7cULu8O/VyT42leN05n1nwr 6EtAQTLpOrZHE/zAInVHYJhbvjGJRmeqGTukQ48afNX31BLeHqVPEo+3GJJ6SVKzSpqN Ztuk65ai1WdrfjhJisWjTJmCmGXWFwLVXIzTvRjOxJybVGMBgA1nNXzwe1fuHOkJP8ii +MNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737638918; x=1738243718; 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=FYmxrc32hC6wxjmJA23IxEYTBygiQADV4kK+4R+dKSU=; b=mWbkH0xg1Na5DDcnuHhn5qt26DexxuBFAAE1+/05zqNdiiNv8I1yjryCXysTMZZVhe Lq7Z00n7HljNDEqSKTZZVtzt/fs/IegUIMH6kPFr3V64xxMaYjhODwLFyKsqT+Oy9KkV cIOMSELaV7TgQvPDnNSwHPPn8LW41WbGYbLML7gyEotbtgWHJejGh+0nDwYxat35lcwO vYLJcx6NpuXbxBm05TiG4yqLyAWL+TbRNUfL83DmjxIdn98lx01iyVXxOIKaHRKpqLy6 aafwSDMWcH76ZdTDClxihyxlH8A92v74XGBX77ieUUJp3jiELOV2but0cyCGodjtpwGM oscA== X-Gm-Message-State: AOJu0YxNZPJt1XtvnoWkYnq6Nz95khc11ZvUDfRqrrr5cPwBrZWZDeWj cY3AFJRdSEOHT/29qtyN7ifL11cIrfSgCOLk7NDzFHIMtRTOYXJ3F71JTX1KOa4= X-Gm-Gg: ASbGncvKgmXToyuC7pChnBuuwtT/wwcd1bWuEc2tV772e1kW0RDlomgxpaTrb4r2jqZ diSHamlcXNR6vQCNGgW9B3e/N221+ssU3EiWlwBZAZ0d0fbhZYhjiF/zCOAFZvthOvK9rl0Ua1K YihVkkr5W6OJW6XpewHJVfgNhVpv1NxCrQx58tKTBjNAoA6moKAbQkEG2dowS+KYBCFwKhaPunY 3ALjFMC/H+D7fI65mjhT7LJ7WlBuY1qAc4ZyS07NwEBRVbL5Iuykz7+Msia9Ii3tCyEYIxV30mB RP7eHOkUHFVbYbo/kLN6w0rmMa7S06sg1GzLK51Ra4hU X-Google-Smtp-Source: AGHT+IG+jllXP/317uDYbnlVUGPZ9HFJ1DJp/HAbnaAGo0uqbORoOrOrnQgvR5mS4AHQ1q7HvBksTg== X-Received: by 2002:a17:902:cf45:b0:216:59f1:c7d9 with SMTP id d9443c01a7336-21d9937ac97mr46072665ad.19.1737638918431; Thu, 23 Jan 2025 05:28:38 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([63.216.146.178]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2d3ac3e2sm111583655ad.139.2025.01.23.05.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 05:28:37 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, kevin.brodsky@arm.com, riel@surriel.com, vishal.moola@gmail.com, david@redhat.com, jannh@google.com, hughd@google.com, willy@infradead.org, yuzhao@google.com, muchun.song@linux.dev, akpm@linux-foundation.org, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, arnd@arndb.de, dave.hansen@linux.intel.com, rppt@kernel.org, alexghiti@rivosinc.com Cc: linux-mm@kvack.org, linux-kernel@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, x86@kernel.org, linux-riscv@lists.infradead.org, Qi Zheng Subject: [PATCH 2/5] mm: pgtable: convert some architectures to use tlb_remove_ptdesc() Date: Thu, 23 Jan 2025 21:26:15 +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: rspam04 X-Rspamd-Queue-Id: 8813D100009 X-Stat-Signature: cwtrroobzgs5xftstkrqg4zmkxh3wupi X-Rspam-User: X-HE-Tag: 1737638919-731632 X-HE-Meta: U2FsdGVkX1+m244h4q7lGbn1+X2QZ7zpAPpgl75lnxT/YyQGDCK976bNZ9fLmyITP7Q4Df6FDw67OMONxQD4F8nn1OAB3ntm9XcZS78g05PKhBC9MX+CW7xuI85c1ZrbgWUOgGjVabCNHE6/BAbKfK2hHWBbLV6jPf2VUVqF7QeiyJ8z7Qi9B/op2cAdWUTUfeXLatoZYNtGNJ3AIOL9m9JTIBLxxr1ls+umt5Uv2BfCTdU+FAed6poWbrovzra5gvI4guA5fMGxh/juPdI6dzHqO9A8olM/5Ji6fP+p4PNYhut5wSmPs9RKpW0JpyBijF7pH4QR4BAXajpBIXxBJXHFjpKOgwPk/ELV8gwhW9fATFtH3yLgHGnp4olhPWBjoWRbDQRB8ei6i/lc72gptmk41mPxWwmm4AzP904VxJL0qs7GZ957MYYeZSk5Vx5QVnKI4j9ERPy+DJiSR9RlI70uPsfoe1TOZHKhCAWkFBhf3Ak11uhwvgqUKy9dMuQJCFECt48bGgmj/56hg5NlGDabYW29x8Q5vu6eFA+Vpbpyutjzv1S6/c4EXmjaXICeQwxUid/kAGxr3ixyRuPbkNlGBo3F/Ps0bXGnmbQIkTt/QZAcrSMqjpe9ICpyRu/jER/joQgZi6aKP5vSIMNzSV88/yn/clgEia47O6B1Fu1ASozfhwkSgDKeixT7VnBK7TahkBh/Kn/vQCXfbVxm6mee1GBhv1sNr0hOz2Nbfdj5rBJPXnVYFA6U6gGaZn3pn8uI/mgUhJt+88p6vPbAePAHm3UZwoW+etOJu7su5XQlpq6icQZ49qpvH3iPMUxxrbYy0joak7o7iWzzr8tpu1aTT6w7cTrR2HCOd1H2ZS5cuB6d0dCXSq+Z0JIb9o3RXJCZZx+k0O8MM6Qzd+a1eMrpnDzgjXsNwOl7RQKz0wfZ1jBJQ6hu+6wT0TOA213TpYOSfafren8roZJP2A0 FvbIEkqB R97ou6yHICTH7cul6am3b9RyxVftkkh/3qwywdG0F56rFEsddjEbWh3KV5hjRQ1eMD2Av+qC6RLl9LRiYhkDpUvrom6xSoYlG712cqhakfJMNQCyb+KpZMkzVyxJmD8jvn97ke8Ilm7mXh3B/UfNWonigs7X10bXIuHVY3NUIQ9eg0G0assJLIn1GNYaFVfs+JgDcE4mMlySlavxVq8BnskNeBcrJBB2shLhouySBxTmXabzWOUasBuNSmISiRtcg1AvYWseI4eS9dAgUbhGW/J3R8dh6SUE8rc3MPOiHVi/NOdJOCRmKDbGEHsaEFLV/Ua7EapexBSdFbpXxTsRZE6Mp92P2lIQjuWu1k4y90ZXQT5bngHusgd+RbzSvv1nWsAsrG3Tnq8b9zgcoDV6oy/7QnV11ek36z2uGzW97lYhpjcjJ2+gu7vXm/DK51RE+rLiTfkINYED1mRw9+LGLYlduUtYqkOjPS4LqQkjONh3UE0A= 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: Now, the nine architectures of csky, hexagon, loongarch, m68k, mips, nios2, openrisc, sh and um do not select CONFIG_MMU_GATHER_RCU_TABLE_FREE, and just call pagetable_dtor() + tlb_remove_page_ptdesc() (the wrapper of tlb_remove_page()). This is the same as the implementation of tlb_remove_{ptdesc|table}() under !CONFIG_MMU_GATHER_TABLE_FREE, so convert these architectures to use tlb_remove_ptdesc(). The ultimate goal is to make the architecture only use tlb_remove_ptdesc() or tlb_remove_table() for page table pages. Signed-off-by: Qi Zheng Suggested-by: Peter Zijlstra (Intel) --- arch/csky/include/asm/pgalloc.h | 3 +-- arch/hexagon/include/asm/pgalloc.h | 3 +-- arch/loongarch/include/asm/pgalloc.h | 3 +-- arch/m68k/include/asm/sun3_pgalloc.h | 3 +-- arch/mips/include/asm/pgalloc.h | 3 +-- arch/nios2/include/asm/pgalloc.h | 9 ++++----- arch/openrisc/include/asm/pgalloc.h | 3 +-- arch/sh/include/asm/pgalloc.h | 3 +-- arch/um/include/asm/pgalloc.h | 9 +++------ 9 files changed, 14 insertions(+), 25 deletions(-) diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index bf8400c28b5a3..9d2b50265a8d8 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h @@ -63,8 +63,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_ptdesc((tlb), page_ptdesc(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 1ee5f5f157ca7..3d35d2bc42534 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h @@ -89,8 +89,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_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #endif diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h index 7211dff8c969e..ac026146e7e95 100644 --- a/arch/loongarch/include/asm/pgalloc.h +++ b/arch/loongarch/include/asm/pgalloc.h @@ -57,8 +57,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_ptdesc((tlb), page_ptdesc(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 f1ae4ed890db5..55a982ffb0457 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -19,8 +19,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_ptdesc((tlb), page_ptdesc(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 26c7a6ede983c..7e73d2f913dd4 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -50,8 +50,7 @@ extern 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_ptdesc((tlb), page_ptdesc(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..4b4a1766e2cc7 100644 --- a/arch/nios2/include/asm/pgalloc.h +++ b/arch/nios2/include/asm/pgalloc.h @@ -28,10 +28,9 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 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))); \ - } while (0) +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + tlb_remove_ptdesc((tlb), page_ptdesc(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 3372f4e6ab4b5..2964e26980a18 100644 --- a/arch/openrisc/include/asm/pgalloc.h +++ b/arch/openrisc/include/asm/pgalloc.h @@ -66,8 +66,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_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #endif diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index 96d938fdf2244..c376d4b708fda 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -34,8 +34,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_ptdesc((tlb), page_ptdesc(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..a70151cfd11c9 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h @@ -27,24 +27,21 @@ 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_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #if CONFIG_PGTABLE_LEVELS > 2 #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_ptdesc((tlb), virt_to_ptdesc(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)); \ + tlb_remove_ptdesc((tlb), virt_to_ptdesc(pud)); \ } while (0) #endif