From patchwork Tue Feb 25 03:45:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989220 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 D392DC021B2 for ; Tue, 25 Feb 2025 03:46:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5553B280002; Mon, 24 Feb 2025 22:46:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 505496B008C; Mon, 24 Feb 2025 22:46:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CCF4280002; Mon, 24 Feb 2025 22:46:52 -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 1FA1B6B008A for ; Mon, 24 Feb 2025 22:46:52 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C0CF14B825 for ; Tue, 25 Feb 2025 03:46:51 +0000 (UTC) X-FDA: 83157080622.01.A12EA1C Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf17.hostedemail.com (Postfix) with ESMTP id E9D4440009 for ; Tue, 25 Feb 2025 03:46:49 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=AvDl5Kyh; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 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=1740455210; 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=+WhvhnqTOqnsJRoRSYGkE7Nvf8aJcMBRIuvNZLKTVVg=; b=byz46pn9+JTP2+9ueYDINHWY7+PvwESg+ECmDO6eQP7L1QMBbuQ3Fzx6XzJALAenb6bITb UvnHhg5sAJbAAlJb/HJ7XJdygYcjR4LdqWdaaeKcGNnLBj8j091on1NxI1Pz1/TIYa7IEo qHVLNd5mHHFpgWl3xXCcGOc1wBlIj94= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740455210; a=rsa-sha256; cv=none; b=u0ziN84gcrBFyTZlWidu8Psy4h8AdOSRZ18jG9eN+6abrDOiVqyNtbSgDZa+WyJrIIeK2n DkmK17qoJ+aIg9ybu+RBNRqMonH2AWYsa1R7u+wz+8ctJsqZFmmQy1N1pIbbS4y8zuVRfC zxP1dbbdU2mZfjQoEYk/aa477Eptsrk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=AvDl5Kyh; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2fc291f7ddbso8280923a91.1 for ; Mon, 24 Feb 2025 19:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455209; x=1741060009; 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=+WhvhnqTOqnsJRoRSYGkE7Nvf8aJcMBRIuvNZLKTVVg=; b=AvDl5KyhJzsyTghUsHLkhsiUAadbLm82vCEmvyM201Vcre62ayP+vmwYr0VGuMclhL 1FVmD6krmzSYje/JNUc20Tj6tGjX1RiXxazzOleLkK5c9Q+r+DmMNDxglJ8PO7quZNII uo/lCFk8yl8RN/8Y1ruh2lYBfiHvW+fw7t4WiKxEhp2gBmPI9od88SDfW+GmHmbNwiqQ QHEhtsji2dUC8nuK9Zc8DD9L+Hah8ZkBGvjYACkQO7ZA/xyPYZYHr549xtOhWBHfeZVs gVucj9jpAxeN78xorh8fXol5WHzcbb//gtdgIYg8AGuY9AOjKtjqUsHDYyQ7i9g3UDc1 sweQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455209; x=1741060009; 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=+WhvhnqTOqnsJRoRSYGkE7Nvf8aJcMBRIuvNZLKTVVg=; b=hkjhs2WPLjmAWZBD+F/Lz0odYWTfTb7mluHFzOhM6JMMVOgBxapCXm1iFTUecm68S5 mDJoSHkn4PJ8I1iC1X/pFnH7/L6XL5UUZSkC5oIqsEnH+TsKRzGWMlxe/PVSiDoe4n5O QnRnWo8DLApS36xXgxGwYjDHj6/AZoPrcZPzxfhgBlg5ilvS5eGKoH3G1JQjSe7xwgxH 7RtGI+gVhaq7ZifpFTdlOZBzGySq5fGD+g7TolGFIjemkuNLngARn2rOA300lvzNYWxe e3v6ULi9wwvOjAL/iINz4gLXnbY84yzET1KD+QSZPG/7yY0X092qVimDZ24ATqVfKAzR 5Iog== X-Gm-Message-State: AOJu0Yxb4e+8pMGAkgRWKuiJVopIP12wkGptn08e0RgWh8mS7T3EzL9b ZwzRhiVsoV5GUfUBTxtjapM40MITtFg+irYtubno0W9SIo31uftFlB++ANQEiJk= X-Gm-Gg: ASbGncsUWd1nOaFk+ctIGIIcZu5btQZi1uKAAk89zIEOn6uf6OtR4eTKRw4X74Nsgc+ 6Njj8MqNicLiUehme16EK17LcWnNyR5CiLjUG9l0tF3udt32jJWjKbrM2P4h/E7RijXIY3Ko2F5 KVtkn8y/QpOn0pSCa65yZBMm46MELb2S1yAm25w0CRR2sQBPK6i8cLd+UNC+MbhlYMvXvO/Uclq fDGXekYLtio8HQ1OH1L+cwxWcYOQ/DZ82Te7Cg4PTPvLD+ABChVQahfFUlqIHfNcE0hypCcmtJY nu9m+9PSusEisjQzBEmGeXyRf7SAv/jxNUodFJkCvwwkH+QoarUybrSNFkUw5utbmg== X-Google-Smtp-Source: AGHT+IFoZm5A7KJfLiXXGkFybdFv8MW6FGVkhPNKsRMzkFsrmZE9FMc5jXLgIOhcL2vDMu87N5uJKQ== X-Received: by 2002:a05:6a20:7347:b0:1ee:e16a:cfa4 with SMTP id adf61e73a8af0-1f0fc78fb8fmr2712731637.33.1740455208891; Mon, 24 Feb 2025 19:46:48 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([63.216.146.179]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7347a81f014sm409429b3a.156.2025.02.24.19.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:46:48 -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 v2 3/6] mm: pgtable: convert some architectures to use tlb_remove_ptdesc() Date: Tue, 25 Feb 2025 11:45:53 +0800 Message-Id: <19db3e8673b67bad2f1df1ab37f1c89d99eacfea.1740454179.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: E9D4440009 X-Rspamd-Server: rspam07 X-Stat-Signature: wozstmuczse434x3wkakypxosmjik7qt X-HE-Tag: 1740455209-440510 X-HE-Meta: U2FsdGVkX18zg523daIe6y1eP6z78RLWmIdyCesWW/NXSgYeKaCT58b8BwK91JZD92DYAAXzcWqqLvYG3jpsFgXuGQ8RtJrrFaM553PGNIX7TBDs60FpnFjQVK1fFhis2vaZri/aexvvtvCnKZEcy+H8clnaenMemc/aX3fKnEkdDZTxGVk08kxlNtrsapSibYUaYeKl3TefSGKw67+obRlpZIgbkvZu/H4UT3n/HXTtVenfuLIngHQQjKDNQHvlSRdNH6o7ef9glCayvg+uKcQlPzB5UKB1O/n6wFZc3LQ1vSVm/6WNrVuZk1+79Ha02g47FHrITH9Wjw51DfHWgDuYneF7eSNp6koQ9QAF77VcIeeUJdUpRjLKhAMPcbE4fFcp6urRYY37P/GRPzARmOhaIDOJToYgKJIcN+orvgvjD5IKfYhXHqXCb+WiCxM9Ll3ViF5qxwBrSiAjtRx3/7/f7XMv+8EkINcjPLizMELUVS1UDJJjg4Wog7oNQn2p2SJccFQQF+IdMHsPH6p/ZEtSq0pZsS68A0IUWvS394Arx1CGQinOE17B9gHCl/BH9jZyWZQsJqZ2lbLn/TsbyiI3TlF1Io/gkQ+bXA0cI0wzybya6B1byK+7/0CaaaHTeI/m/yHs2VNz219h8VmFlMtP8whzvU22fiicbS59CBlZ0GpE813gU4/74+mE2rnAoRfLEuI8raTGwnhGB779NUQBUm1WW5/LwajQc7UsHRxWrLSCP42RmFd9Rj6BzjwzmTUNDfsLwWBZ0uloXwlJ6MjV/JX/z+oVOVmirAoGfoUNVEzDlBJTuFfZm+DU9XZcDd0rJKtfSKb/Q69BaYyTbDJAn1+xQvaIUzMO1eHAJIeab8mPCFdC4aHMrwbxUHBbkzmyKTlmBEkmeXi+zl5BafORaNYkDpFaWNQDflqsrEKcp9rcijfD0hzQ7K0JcBEN9VvIzlGWTVpfsDNqGlv v8SHqA9W V/In6Nx4alTiVLBp6siNQyNRkDwHpJyrUhgKava+GqK8Et1Qmp9yROM1YVgF7AbI3HlH6Nd8vbxER4X+VJV+1BJvCnusfGjRWSfUgq26NNZ0/k1Ykn1ZkYOp593SoRvUN2MUNnoK7+NvXA9OnsFMs/nA/94Zo6Uka7VS9uT7ML+DoWRTXkv5Pmv9wJhRS9FVpOT1xOv8zFp8jgfF+XGO7SH4PXJjvP3w68zW7qTJR833PRNo6836XXZks0gMzKdC4mydaLKLJetQCSyu1RzRLbXwWLwsKxrm2xPbin0L9XBZhaEK2Q96YTzicKrbZZMEb/Zvo6mKGXcRMqSjPnEwFrU5cLp53rxP0ZKpx5KRoQMGk6T0ZSf/+Hci6CKBljJrbpD3A2O1IMas8fKr6Q+6n+n8wf3zF+IUvIrZK5uZo+UXdEX0N/MzoSZyjxgxdtE6Epn8kjC/RRao0KdTy4GxyWmFAzL3M+ue9hcD1GuuLE/hsNLs= 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) Reviewed-by: Kevin Brodsky --- 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 80afc3a187249..ddc24812f1832 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