From patchwork Tue Feb 25 03:45:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989232 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32875C021B2 for ; Tue, 25 Feb 2025 03:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=22Pq3mtayNx2OiQBGxwZDCQBPc9tQ79o8QVk2eEKhiI=; b=tFkQc2yrOCxqaa u/+VEiFOw7YfH4cqNEKKUHJj9rFoDKnei4m9BzI6mx+kmhjPhD6mfoLjnox+c3ylaeTiCJUdj9fm7 LE/Hg+F9FON8omdxe1JHCaZfQZ5yDDsgc/SIhbmnUyksIzrXumf55vihxmk+HFonMf7IHiOK/Fj5Q PR9it9FWPNOBGoP+4/BGTbeYZsx25FHt3e2fyULNn5mIng2vewbP2tw5FHN0zZ0G+D7opCB419/1b UDl4V/P0xbhWYp7EnPzrqNZVW3/XUBR5uoPTZDc/8h5ZvdOKTlVrjzndlSBRmsbedNFccYukaLuo5 NYm3fPMCmw2gfYSlp0vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmltw-0000000FtQU-3Xkj; Tue, 25 Feb 2025 03:46:32 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmltt-0000000FtNP-2ykI for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:46:30 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-220e989edb6so139802045ad.1 for ; Mon, 24 Feb 2025 19:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455189; x=1741059989; darn=lists.infradead.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=g0Ocxe5/W3x8AaSNUp1nmQA6Ns9xuyK5JD/uD9z0OJg=; b=Meeg67WWgsTYxId/dV0z+bFKgOuH5m59vap9//IP9UPVHXbSKkNJZMk6h2j+OsqAoQ sd0pezCI5LCpnHkQQ846Gq61vMwvpUX0wCxQ7CmKum6FQI/Kh/Luxy4Zm71xf9/5QeDr ALSIFxVt8XaFxdSrPXbxAsT03DbM5oday/XsHPm5rvJEKvZCoryuBpIg3iVGvyv7QgIW BKkBdce5xKXJlEj/Rliy0Gav/Hro0ISpasnQ9KOpeNzH2KhLBVfi1T+FX1J5Aly6jZ80 tE4v53NLg0UApqNrU14DNiEu5O+blR+/hlfZhXQFjugFWLIh+viOUDqHmHPPadPJrIyG Z1XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455189; x=1741059989; 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=g0Ocxe5/W3x8AaSNUp1nmQA6Ns9xuyK5JD/uD9z0OJg=; b=HS6cd9dDkNvkE4Y7Z93zlFbaup+L6tmLK8BCvw1EGTJKIrB97nFy8hOy/mrgQbfLCV YOVp5ftoud4HiztqD9rOLN2Y3LJHf8t3VwCWSOY3h2CNEKVGfpcj5Tl37OwLFxT4X5ZD Mr0Ju0gCGF2byDyZym/Nd6qiu7TQID4973I2S/wmvhw+t2Sl4wpIKwLKkv8ArZmqTtdY e5TJztGDSUSxFYdFul9xJEgI3Dr2R5hEBikKFPXUwKS6xktaolIer1TPK2owkZtq0msg tliNc4fBTeaI3+AAOPJFNhO/BF294nhsdYLTEZPHWLwL566ACi13eiypigtDfTQF+iON q8Sw== X-Forwarded-Encrypted: i=1; AJvYcCWL8kgHw7nBYN6vWVJAsu33K0zm6FSXT9b6Xj0VF7IGjcSjwH3VuLhHszsAh9bsk74/kXajnVsrpSpVXA==@lists.infradead.org X-Gm-Message-State: AOJu0YzKP44XF3flaxFCu+Nh/uI8zUPe0RfROUjcwfh1kxJBsuka6rkN vQDaoktrkFIpN+4HFyIntwtyNOFKSEvGvOAigTdJ4aGdtzIijRzer8m2HqZ1ol4= X-Gm-Gg: ASbGncutk3DAXA1uXd2P3e/yILS0auOzxjOA/LdP6fQzZZzjOObGWkMvZcwg90ObAsZ pTbBI5/PPxxuZsfCh73i1XZyKHrWT/wotdBLa9IZH8tWeIGY6InUdzobrFzWWqvw7UQDz23UR2k +dgf2Drmm+FLqtdY1i+Mx+b51m+XCebHb5ozctA066LBk7IrKPfVJLiaEvTfE1n4+LHVQB37DTS JjxZ4KRWmCUfIKzCrLDxE3YhfDHbpOjoLcT/4D1+ZQI0u8RH+KEshoWjgBkKI0rKKnyaAA2G+ul Q6TII8Jc32+Ae8UZE2GS+4vsj5maX1gbvnZEUBH4JamwI/3XhjioUq4AafamUIEEQg== X-Google-Smtp-Source: AGHT+IGBfXw23ytiI6FvQDqnu6HA+6X81xKlY5Cdi/AJkyrR2YGvsG8wye6vZ+K3tNu1qHLJYKOiEg== X-Received: by 2002:a05:6a00:22c9:b0:731:771:38f2 with SMTP id d2e1a72fcca58-734790de607mr3427312b3a.8.1740455188892; Mon, 24 Feb 2025 19:46:28 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:46:28 -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 1/6] mm: pgtable: make generic tlb_remove_table() use struct ptdesc Date: Tue, 25 Feb 2025 11:45:51 +0800 Message-Id: <5be8c3ab7bd68510bf0db4cf84010f4dfe372917.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250224_194629_761373_339BA599 X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Now only arm will call tlb_remove_ptdesc()/tlb_remove_table() when CONFIG_MMU_GATHER_TABLE_FREE is disabled. In this case, the type of the table parameter is actually struct ptdesc * instead of struct page *. Since struct ptdesc still overlaps with struct page and has not been separated from it, forcing the table parameter to struct page * will not cause any problems at this time. But this is definitely incorrect and needs to be fixed. So just like the generic __tlb_remove_table(), let generic tlb_remove_table() use struct ptdesc by default when CONFIG_MMU_GATHER_TABLE_FREE is disabled. Signed-off-by: Qi Zheng Reviewed-by: Kevin Brodsky --- include/asm-generic/tlb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index b35b36fa7aabf..54f579750c8e5 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -232,10 +232,10 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page); */ static inline void tlb_remove_table(struct mmu_gather *tlb, void *table) { - struct page *page = (struct page *)table; + struct ptdesc *ptdesc = (struct ptdesc *)table; - pagetable_dtor(page_ptdesc(page)); - tlb_remove_page(tlb, page); + pagetable_dtor(ptdesc); + tlb_remove_page(tlb, ptdesc_page(ptdesc)); } #endif /* CONFIG_MMU_GATHER_TABLE_FREE */ From patchwork Tue Feb 25 03:45:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989233 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17367C021B8 for ; Tue, 25 Feb 2025 03:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/dpP1zN5P8G4NOakBbkhnBdUIi9dZMbtn43AORbNOUU=; b=2k2kYGy5xVHDKr ddpTsLutQiilHFCRf8SXR6+WpBYhr3w8TkOl+YCdHXPUHuoNH0DPc0QB6mpjm+ibR1YZqf02i/GL8 YJpPfRLaAB+E1IgsOSAupLVPsuHsfvBNj6yaXLSwWjJ+VwhJwbKHbVuHL4pJVfy2i++QUAilKC0+G WpWWuZZqJsQYSbtvUP5Fvei3s2Ig3YlsnsIY4t9VewPLrrp9Zgk3GkZoR9OTZUU5HL/7IJOiV5Jay OsiKGESOegeibAYpXNXc+iKeK7Z0Ie/Xc9X54I0FPGe2ktGeYaw6MdtRbejnTJsXtiz079utq9+wb DPNL7Usr8h/jnShhZGQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmlu6-0000000FtWv-0UUM; Tue, 25 Feb 2025 03:46:42 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmlu3-0000000FtUY-1DJE for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:46:40 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-220c4159f87so72120555ad.0 for ; Mon, 24 Feb 2025 19:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455199; x=1741059999; darn=lists.infradead.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=8OP1Tf7pAaJ4pNIvAgoQe1yrsY5TH0xWN2DlWHIb0tQ=; b=X3OkspkbTWOzjOZIRl5pUIycoang0a11pfuSTCtlzNDriQ0v0A8Mc0F5VVt1/hDedH pO8NKFqwbE7B6TxS0dPUGhdRKa9B0XtB5IrDvbywv2l16X4qY+1GrSR5IRCf5BBKiY7q IM/CqmKT2S4nl55yvOjK5OStj/pJiwvOsjUa0D1j+L/pYGnvx419D+zkkN3a4KFS0j4F kOmA40QAKFYNL4CnJLb5e8sIYB/9AsO8VnlCT+dwD9RlfUO5pM1Mw9ZERPHTIvtO2JoR EKuugu7ebyVB+6sAr8xyXWUmgedm/sTI+ST6vYCPVO38qFmdiEHcWglPRjBgXDyYQ32P dDFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455199; x=1741059999; 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=8OP1Tf7pAaJ4pNIvAgoQe1yrsY5TH0xWN2DlWHIb0tQ=; b=kfaK9mSzMp+Rv7eLwC0AfhGeb1y3Q65xtSuKsY7cyzyxO5jIC16arPhdevyJzxhlcu txkJg+lir3Kg4ikwo8k4+7K4H/86zvRhOaMfx30ckm90vWO+nQ77mlKVLjoji3DN5dfD lSdzzK2Y1bsfXowXaPC1zGBy+m0weQCZdV6RwdF8PZaJrgBvlj7mHL43Ecn+Yfl/Y4tg H6cJlP4q6IbLXfSMan0st0M+E4bb8u/S2VmA7bCSRZXwMhlzWvtYHa2qR9qMJlJ9zynB iQieOFWFiHI1RpWkEqnpXVImW9SAbPIgMe7J5yIuqcCuGzujfrnY3vkRKnlSIqVKZxP9 GVBw== X-Forwarded-Encrypted: i=1; AJvYcCX69w/nzapWXHJprLoPFUNY35Hxv1PujFUy26U0/t1xKtZ2xLSH39/JaQDJnCeSfLLiVNucWS2rhnxmsg==@lists.infradead.org X-Gm-Message-State: AOJu0YxQn0Y21IAL1sk5KhyDTApRpOjzIGUlUFP2ht7b/yR0bNzobR88 1LnVNCy9uCTTW+iFWh69EUsbWMGNa9ER5Mj3Ic0Gel+pvHv1XvzSQvDvDg584Kk= X-Gm-Gg: ASbGnctbvt804r3IKWnH8BLDaTxVQC833P8nDfhH1uz/+QBkXMsqtYDVX369rjrjI/E Mv2jnOGjZ9bsPY9rrUalm+FSyIjj2UGoNjxKGssT2oWiAUhtUSzN8RmxB71MHF0dX3CauXbj197 qhNr/i2Cyg8jsFGDIhQCRR258sm2An5PQm8X/LEWXg8823H31L7Q+8Vy45BVWKT4I4DrkObNRMA LoE2vTVWHzB3gjkpOEgyqC7UGMu76Hb4uAVnDSvZvtpa0kKpxcUfrYDEq+3ZoG9Ssgcn9gmaxEU vHMG0ebZTV4tBeq3kMC36SA18NLnIRlPABb/BaHNcoppdalAew0k0Tm+FU3Pngi7NA== X-Google-Smtp-Source: AGHT+IFHXm4yz9k/q53vQDLsSd2kyUiUDLPeAK4sNAWc/t1WzpyNSO/kW4XJ16gHc0dMjVe/gJ+ItQ== X-Received: by 2002:a05:6a00:230b:b0:734:9cc:a6e4 with SMTP id d2e1a72fcca58-734791ab6bfmr3168643b3a.21.1740455198810; Mon, 24 Feb 2025 19:46:38 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:46:38 -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 2/6] mm: pgtable: change pt parameter of tlb_remove_ptdesc() to struct ptdesc * Date: Tue, 25 Feb 2025 11:45:52 +0800 Message-Id: <60bb44299cf2d731df6592e446e7f694054d0dbe.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250224_194639_338533_C4D9192B X-CRM114-Status: UNSURE ( 9.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org All callers of tlb_remove_ptdesc() pass it a pointer of struct ptdesc, so let's change the pt parameter from void * to struct ptdesc * to perform a type safety check. Signed-off-by: Qi Zheng Originally-by: Peter Zijlstra (Intel) Reviewed-by: Kevin Brodsky --- include/asm-generic/tlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 54f579750c8e5..18bf499ef8801 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -506,7 +506,7 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } -static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) { tlb_remove_table(tlb, pt); } 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: 13989234 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AD87C021B2 for ; Tue, 25 Feb 2025 03:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ne203QC5xgse46zRwjxBj10Gtb5A1/ASQhF8i3AkDCw=; b=zxZRi07LPPQIOV 5/AGE41ryMX1iEaCNhasEjUTinW9iy4DtQ6BXS4H+n+bstW4+t+mhOuiBZ1+aufAdcUmzJAQVR8dF rIQNSCvUxljGbIJAyo4+OMP/zuSh++mcOEjlK/789Mb0SEGCJPsns82eIbJI40z4l3gQoVzUPqNnX rDOj3I0AMM7hGn5KZ9Aaj7Emprqclnj9BOQcas10NmPyTAqAbo5HyvIE6GpTSDSNDkTU3qKZS9KBp AbMhK9uSC2GKMGBYO41nOpNruHRu03VBnxCcp4ayIs4st4l1ZHflrX5LrJW78lFtfGgbiN+EwV6zD puJQm+vyhOhFXkv9ujhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmluH-0000000Ftex-0Bu6; Tue, 25 Feb 2025 03:46:53 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmluD-0000000Ftbw-3Q6R for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:46:51 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2fc0d44a876so8263344a91.3 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=lists.infradead.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=KoSINeAiNBPI4GMu5ZabGdCwt8U3/CYgyLW7yU2AdDyrZ4HJri2HOxGNbX2jejzcsh b1G9hLvUxX3emEtG/0T5zPhHhR97MJ3O0wcyKfSQe9f6gBwM8W+BC78M7IJAEcQFcT6w vkoo6RFG/dhv944BQ0SQuRf04+TbdFN8nj3nMvUVMoPhWJJ7NM9yoQmKfWBR77CWRP8B ppPSaAIhU/yPCGckpraNIXBjuQPTf7oTjoL+OErHWe1xStlED54+YSVxBMmQFLDlbDGw GGE3h/brpjUmtw6kklR3Pc48IOzR8Ev96EwzD2/4kqRJHDTT+5uBgEyeWXVo474Q25RE Pndg== 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=EoZnwI66xSKyacbYd7BfNIzSMsKZFYl/VRb/oAx3FjdnkPcLnQsCg9xqe5u2z7gqdz hBKTuy9A5HR0S+4JFePcyxC7RGEwacnAh1CAGiEMPQeVvYYz/C08PuLP2rqfZYGT7x9D LzH5gACPbUZhIXbsf/LDa/f8PVkZg00Xm0vnHhdMSAfDPLuEh60+ScBe3ePBFRmjMk5m CWPIk478EtnPrLVc1e0+Qp0YQjM+g/5eL/SVx6jjcKt8Wjaweqrer+fc8xaRRZmsHcTj LkwGfC1DWBH0lw8DjQAnkZkiMnK7KUP6HDBLV+yZm9fSCVjN3HQKj4xLp+sIEwlY/wGZ Uwrw== X-Forwarded-Encrypted: i=1; AJvYcCUj8EVGuDuQu2KqZwm3OBEuvqlJ24/Ru0B9YtWAE5qRmPudx+2mzSrqol5OnhONyiB+Ak/wpoL9brXh2w==@lists.infradead.org X-Gm-Message-State: AOJu0Yw4nq0cpylA+UiQVfxOGxmCkwb4fYbX2sJq/ygiOH1I/SDN2rZF u51B5HtoJK82ICqkxgEmgC7K04Or0Kw9rfP0UqE8oieqDQCzwX24BfpK2aEw5kQ= X-Gm-Gg: ASbGncv3t62zj0/6UkV34XF4dFHvFRGGMUhWEhej7VbJ+vsbUjRZGyxUK0Rzn2QEGyD UjDOj/qAMgWVQ7P2DMa9J0AcBwTlZ/nRp9tWlw4JYzrb9N4v+GuXXdU44CoQHsYQKc97CEqnrm7 LEl+b013qGakI/MUI8wuBpMX0q2tU74RTxf1tPzl8NsXmAXQnljsE4P+zdIy9RwTq1nuHXf1YUb bXTsFPkVFPvNnUHgcVKihF9uhSJrZ+z2yv1vKXQfDcOLe5SWvMqPQLtusZF5N1EUSzDS2ON2KiE 8Pd/8zAU98Bp+/7FX1+r2lRAj9OmwEvoQjOAo2K3vO1RJfMj2KWdEw7k71ljKuNJlQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250224_194649_850996_5F4055B3 X-CRM114-Status: GOOD ( 10.71 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 Acked-by: Geert Uytterhoeven # m68k --- 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 From patchwork Tue Feb 25 03:45:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989235 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D97C1C021B2 for ; Tue, 25 Feb 2025 03:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n6Ma2NJFcwkJSyzO/jsiEkvQwg4LtNIQ62pTriW3vkw=; b=DOe/67u31rKvPe MaeRS58CEYXThp66+iMUoVWVyFn/hg8cKaEP+EMk7Yaf6d8F2NPFI5zG3TJny8USseCu5bCtyxs6H ta7F5fbCEntkS3iOGgOBtP33JZnrusOtoV9OF+gfqOoq+S0jW1oVwN10gisH2QPEYQXM8L0V95ytF nKCsnUwIFSQNE9mKZE1mUPGb+gT2lNwpl0yMLCzi5MvPruzKzLh0ZxqRaxCs+Gw0+LVvjkRaURydB 77SW5CbzwScXwLMy4tIhJ7m8Adw9Pkhpx5AU5sNz1AqLA0n1w15QbZ8rKVB2Fq2o1l19Gw/IcDHbh kt2xmonjHDkesioP0LFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmluP-0000000Ftl9-3ADT; Tue, 25 Feb 2025 03:47:01 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmluN-0000000Ftj9-1lrO for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:47:00 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-22185cddbffso103440115ad.1 for ; Mon, 24 Feb 2025 19:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455219; x=1741060019; darn=lists.infradead.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=zIKiL/cvy76O78IwclMxfA3FUb4EAj4nzgq2isZtk2Q=; b=NXZ3oyUFlSHCtlRjPH9GogX5hscGHDUbWpSJgYn9AQ7KalLUlZM/W16It4djF+fky1 cr52ZI+I5xbujCc2SoPahNY0SiljcvY1HxESqq2HwhwOhKtHIM2udR7Z7F5ndbgM3P67 atZTT+3pl8aCwexdGgHyH4m4tiq6ldWhwHKcC+G+Srz4r75GlFn/3blw/5S8d6qW6zaP 7qG9cNgKD+1v26LClDwjDF/PRjVwe2CWXF9gIEDTMlMakoOV9LCod0V6gDVHFou8FSZr ePaVSHafNrgyoQnw7hE/U3s85u+FNk/GwUp0ntJgzXcMB+h7YaZghwbmIrNT4e52w28v wFFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455219; x=1741060019; 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=zIKiL/cvy76O78IwclMxfA3FUb4EAj4nzgq2isZtk2Q=; b=P9fxBuBdwpeRPbZAkoCdU0bGIc81gtRlSAT+IWYsofcj2vxLrxgzVdOZ/sMC76zZtT ivAuCA4DaQJsN/jVlsKVtIGhNI6qmftwUHcLb9WpzWvzksVH8uPL9KzUMeYB/2s4Tvbu Um6eAgWZYuBsmZKBK4Yrs8roLFS+lSjyC9hLyeDM8/KurQBOpbNPulHre2ZNsOps73cL ++3XznZbiItM3DyoYr/iY2IfGIj4MOVttuyEKiJSAx85AT3sO1IKP/eXulXUho086ei/ 4iWgFBYZ9ByzRZ5ktezlHoe8YJ+RXVmQorAyNX2/R3u6c/eaF4oW75xl9/XVEnXbt97d vr6w== X-Forwarded-Encrypted: i=1; AJvYcCVzxNn5kA+KcgPcxpZFjgM005Katg68Hia302ZxFF/1y1Ropwpp9WAo0eKNllneDXkLZax/umytEn4+eQ==@lists.infradead.org X-Gm-Message-State: AOJu0Yx3OFiUlt6g94idOefB3M76SQygu0i+/wX9+qW6Of0nX/hZwuAv vThoFBP4gP8EiDYXiFuz+JfeDIA1eWLNAHhAsu3R1jTaCcYKNRy8C48x712OjPQ= X-Gm-Gg: ASbGncsN1IwOxE+AF8YLyBIfv7f827yVwtFeERWNlRt/joUJp3xiUm91W3meiX3arCE Xyc0vX25FahA+IcVwK4AOy1Fv7nY/CfldFLPKK/uWzU/BlEjG2MDjI2K9tE4M9a0RDJV+rmLnZR LYsB2EwHRoCauA7mSuBMVVZw1JC8ukR7mv6ljsk1QerOSTWA23itlloPye/RpeatwtD7JnMjs9q M4vueCgjd5rYXIBQwFgOQweWmBjsFqRkHMoqG8Y+T739FP2FUcaOzuCcOoDUsPkjyZtIRlyhlgD itgOwEPkuR2/dztWUx4AUEYAZOIfPU95CSi4ANVC0Z163v5H9hQdqVFqZzgRDMFZQw== X-Google-Smtp-Source: AGHT+IGrbcobmtkudsLXXtQABX/QCxCZukDHXrGqT8EvNNCQnozfEzflYDWPRR+Q4O9sUaua1jgg6Q== X-Received: by 2002:a05:6a00:3cd5:b0:725:41c4:dbc7 with SMTP id d2e1a72fcca58-73425b7fd45mr26417726b3a.4.1740455218800; Mon, 24 Feb 2025 19:46:58 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:46:58 -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 4/6] riscv: pgtable: unconditionally use tlb_remove_ptdesc() Date: Tue, 25 Feb 2025 11:45:54 +0800 Message-Id: <9025595e895515515c95e48db54b29afa489c41d.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250224_194659_464062_77221851 X-CRM114-Status: GOOD ( 16.03 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org To support fast gup, the commit 69be3fb111e7 ("riscv: enable MMU_GATHER_RCU_TABLE_FREE for SMP && MMU") did the following: 1) use tlb_remove_page_ptdesc() for those platforms which use IPI to perform TLB shootdown 2) use tlb_remove_ptdesc() for those platforms which use SBI to perform TLB shootdown The tlb_remove_page_ptdesc() is the wrapper of the tlb_remove_page(). By design, the tlb_remove_page() should be used to remove a normal page from a page table entry, and should not be used for page table pages. The tlb_remove_ptdesc() is the wrapper of the tlb_remove_table(), which is designed specifically for freeing page table pages. If the CONFIG_MMU_GATHER_TABLE_FREE is enabled, the tlb_remove_table() will use semi RCU to free page table pages, that is: - batch table freeing: asynchronous free by RCU - single table freeing: IPI + synchronous free If the CONFIG_MMU_GATHER_TABLE_FREE is disabled, the tlb_remove_table() will fall back to pagetable_dtor() + tlb_remove_page(). For case 1), since we need to perform TLB shootdown before freeing the page table page, the local_irq_save() in fast gup can block the freeing and protect the fast gup page walker. Therefore we can ensure safety by just using tlb_remove_page_ptdesc(). In addition, we can also the tlb_remove_ptdesc()/tlb_remove_table() to achieve it, and it doesn't matter whether CONFIG_MMU_GATHER_RCU_TABLE_FREE is selected. And in theory, the performance of freeing pages asynchronously via RCU will not be lower than synchronous free. For case 2), since local_irq_save() only disable S-privilege IPI irq but not M-privilege's, which is used by the SBI implementation to perform TLB shootdown, so we must select CONFIG_MMU_GATHER_RCU_TABLE_FREE and use tlb_remove_ptdesc() to ensure safety. The riscv selects this config for SMP && MMU, the CONFIG_RISCV_SBI is dependent on MMU. Therefore, only the UP system may have the situation where CONFIG_MMU_GATHER_RCU_TABLE_FREE is disabled but CONFIG_RISCV_SBI is enabled. But there is no freeing vs fast gup race in the UP system. So, in summary, we can use tlb_remove_ptdesc() to support fast gup in all cases, and this interface is specifically designed for page table pages. So let's use it unconditionally. Signed-off-by: Qi Zheng Suggested-by: Peter Zijlstra (Intel) --- arch/riscv/include/asm/pgalloc.h | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 3e2aebea6312d..770ce18a7328b 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -15,24 +15,6 @@ #define __HAVE_ARCH_PUD_FREE #include -/* - * While riscv platforms with riscv_ipi_for_rfence as true require an IPI to - * perform TLB shootdown, some platforms with riscv_ipi_for_rfence as false use - * SBI to perform TLB shootdown. To keep software pagetable walkers safe in this - * case we switch to RCU based table free (MMU_GATHER_RCU_TABLE_FREE). See the - * comment below 'ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE' in include/asm-generic/tlb.h - * for more details. - */ -static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) -{ - if (riscv_use_sbi_for_rfence()) { - tlb_remove_ptdesc(tlb, pt); - } else { - pagetable_dtor(pt); - tlb_remove_page_ptdesc(tlb, pt); - } -} - static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) { @@ -108,14 +90,14 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, unsigned long addr) { if (pgtable_l4_enabled) - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(pud)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pud)); } static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, unsigned long addr) { if (pgtable_l5_enabled) - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d)); } #endif /* __PAGETABLE_PMD_FOLDED */ @@ -143,7 +125,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, unsigned long addr) { - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(pmd)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pmd)); } #endif /* __PAGETABLE_PMD_FOLDED */ @@ -151,7 +133,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - riscv_tlb_remove_ptdesc(tlb, page_ptdesc(pte)); + tlb_remove_ptdesc(tlb, page_ptdesc(pte)); } #endif /* CONFIG_MMU */ From patchwork Tue Feb 25 03:45:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989308 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A9CAC021B2 for ; Tue, 25 Feb 2025 04:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4pYGTzURkOwIeoCBVlX6IxUM/GmsOmXlLapOOeKIIJY=; b=3bxtA5vhAXrKcz RL0Grcor+CbdAxIZ+j0C6B3fyNzOx3ahsgwG314HOn6taUVfrM/FpxD9/ht7aZXkun7vGpf928s8K uhoSx7QtH3810z5PMrBJNDczA3J6oz/tX8BpKgqN5ouKP2hoKWoY0C2PHntSgY7Xq+OMzRbvdqeKr hUCvGllVYa4wy/S47tEO5vuGRwU2CWYpPVMW0wFn+JhKdifL2uLzncqDWaXsoHfr8zX5YrmJ2OkNA egNypnQ54IBw+nXASHEWApxTR2ekHFseCXQ4r2xFMVpa1g+myN3tfisgrMxMGzsAast0dfDewUNwb dqiN8DBCPlpwIVf1j/sQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmmw8-0000000FyTd-3sKs; Tue, 25 Feb 2025 04:52:52 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmlup-0000000Ftxo-1L7U for linux-riscv@bombadil.infradead.org; Tue, 25 Feb 2025 03:47:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=36KztU5HqI7wNxhzV6WNrh7mWCrhUr2tDKJnWGxYavY=; b=k8Zr6+0cpX+MnxKSSN7kaWcNJq pW40Rr6tHDgqLPKAht5Yh3IjbvqAISO7t6dswh5arxYSwfAUkXxrL6txdgy6s3aan7y1fxmV4Kx7p 2MyboJ6m2Z6NcIMUABxQmsrnNLjeHCjty0nWUYdtrdYbDJxXc95vFwhnvjCkoUyYWGi3t0CHha/4b kMm+/xPWM4L2kxGQsm9D6s3oixTgoW1d7fn5NmzaTNbGW1ehivHFYVrMXeoF/yWty5ecNWdcZrqGm /emRb8uB3PpIzEr/Z1JkvWHSN/5hZrGNc+c8hO+Ds9i49thoTF1AAd0rJj+GCeI0noHoSeFxBaz2m Q+Vz3nFA==; Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmlue-00000003Hu5-0GAO for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:47:21 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-220f048c038so97440335ad.2 for ; Mon, 24 Feb 2025 19:47:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455228; x=1741060028; darn=lists.infradead.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=36KztU5HqI7wNxhzV6WNrh7mWCrhUr2tDKJnWGxYavY=; b=J3PntTs/xUVENdv7e2YSnXXHfalq2wuT0ENTAgW0+zxVq6jmICrFY/8q5LIDpA6AtK EII68QDhRE9qPnghFAwYCY+hzXO2JAr+JedmRFwE7y2TK+3+cH2tKuRI7epDQVuLUhXU 6re/k/lwXyS/52VqtRC11ho0BwacZpc9szt9jBt3b7KQMhWLF9CDIg0gx1A1RyWDqQP2 SrzuHFZkeGTee0u6R5eZgD1xKMp1Zg6/kY3CzRr9yp7cwEZ8yLiHK0iGJmVfOzvjDskC op8WMQYBi9rZ8bua+iV/kNnBjz7/Vf/ncQ3kPrynxzeM8CoAidGSrpQdSXgL48G4Cf5y 45pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455228; x=1741060028; 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=36KztU5HqI7wNxhzV6WNrh7mWCrhUr2tDKJnWGxYavY=; b=xE5UXMp0WhbzWhk5BS6Ih17NelVF/+yb56cTh1rIF1awfufPZXCulgfXc33+n5HRlp Fg8JRXWYxnpzozvbnjmG5ua9qel73OVRrQFrqhPA5MfzY1mWzRuZLobojlF7r5/oWStc ILO4Ig8G4tpElmq2zOgsL7xrTAYqAmSXVcV0/MSDBIGagNBBlWCib9RItkvFPAFvDlN1 FYlbfRZEBtvyxBYpDV4D4COpV+d6Ru4jbhaG2Amdk5/h5sRxH7jknI+69BO4geFLZDOD sjW0RXKqvg9Mrizz08e0p5mxnaNmgZm9SKd9XyAt7932E0CUW0ikDdfEMrVr9ElKb1E9 CbvA== X-Forwarded-Encrypted: i=1; AJvYcCWPOnlWHkt6xj2Srpb+xR7r20eInLrT+/4SP4VVnN5b4Mt6i/hP2I2kAizwJV+cau2vOFRZMTI0dM4QYA==@lists.infradead.org X-Gm-Message-State: AOJu0YwnPu93t/CJ6ZDIOZLpC9t+HoPdFqS79Cd6/LLaKYLreqTBEpLp BNgE8MS3KboYT2e2cmmnI/1bBzmiL9mnqcRT+6IvRL/LEBdkjRlMpip3Z73iK3I= X-Gm-Gg: ASbGncvLF+a06dMHCCRBW66HhUY1arpJcdi/TYozqxgCdeeOzF97dya9+CSfoYWkHu3 iRsQhA5dA0We22YdxntffLTpwly3KZnaUbNuwkNsnEppSThNyF7JXqQhNIvTl+nCMzkTOfsimL5 +kR5N5rn9x9FXGXJaN4CtoXYFwFjnNn0tr1tiBrRH0aTyIQmBAfD1R8QdfA/6hBAPbb7ZL9A0Ff Ww84nKcbEEeVkmtCp7TaBEW7V3v7C560dkfZ845Di7FITAIAyfr2ggCk4P39XrwrMQCvSWkLQpC SJ0XeIII4nOvweCGdNJ7LTwlNHzErpqtN9T9JtHeDl1HSfE0cAEE56Tgz8rs+2wUOg== X-Google-Smtp-Source: AGHT+IHErQlNtWAOdWTcDw4ZwAn3kttLeu4q3Mf0dru9ScBNUcUevexLBEyVDaZ2sKSBMgz3Y5FwbQ== X-Received: by 2002:a05:6a21:7a44:b0:1ee:cb9c:9dc9 with SMTP id adf61e73a8af0-1f0fc89a091mr2965600637.35.1740455228677; Mon, 24 Feb 2025 19:47:08 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:47:08 -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 5/6] x86: pgtable: convert to use tlb_remove_ptdesc() Date: Tue, 25 Feb 2025 11:45:55 +0800 Message-Id: <36ad56b7e06fa4b17fb23c4fc650e8e0d72bb3cd.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250225_034716_263469_70937CF1 X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The x86 has already been converted to use struct ptdesc, so convert it to use tlb_remove_ptdesc() instead of tlb_remove_table(). Signed-off-by: Qi Zheng --- arch/x86/mm/pgtable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index b1c1f72c1fd1b..f28ddac0f734a 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -45,7 +45,7 @@ early_param("userpte", setup_userpte); void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) { paravirt_release_pte(page_to_pfn(pte)); - tlb_remove_table(tlb, page_ptdesc(pte)); + tlb_remove_ptdesc(tlb, page_ptdesc(pte)); } #if CONFIG_PGTABLE_LEVELS > 2 @@ -59,21 +59,21 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) #ifdef CONFIG_X86_PAE tlb->need_flush_all = 1; #endif - tlb_remove_table(tlb, virt_to_ptdesc(pmd)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pmd)); } #if CONFIG_PGTABLE_LEVELS > 3 void ___pud_free_tlb(struct mmu_gather *tlb, pud_t *pud) { paravirt_release_pud(__pa(pud) >> PAGE_SHIFT); - tlb_remove_table(tlb, virt_to_ptdesc(pud)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pud)); } #if CONFIG_PGTABLE_LEVELS > 4 void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d) { paravirt_release_p4d(__pa(p4d) >> PAGE_SHIFT); - tlb_remove_table(tlb, virt_to_ptdesc(p4d)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d)); } #endif /* CONFIG_PGTABLE_LEVELS > 4 */ #endif /* CONFIG_PGTABLE_LEVELS > 3 */ From patchwork Tue Feb 25 03:45:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13989309 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08F98C021B8 for ; Tue, 25 Feb 2025 04:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9LzG/zA921bsImXODiAOIjQb97zfhLyEp6gLskyyJHw=; b=AXAe3PdIwTqHQ3 LDf61T3fna/FmmkN9dOzkBcCeZ2KaQ3MWvOTCl2t4TtRL2F6N3udMgNAYL1cSJuussBo+ETYPWVQp giSQqHE2pEvJ4DQftpbTtbPfpYKF30sMxizMERCYOLD9Wkb1LW9QIDjhfVxJ5fUbj4nCTgv/t5jRg YTxiI6k+JVzGTvj32D7Uj9tmOnRgaHcD4zDJc3+GQnTP9D/1WLlM6rh4mOaKjvizoCHjA+JlWKas7 nAdNFwcr/deLF25WJLgIfAKSBo0iaFI4LsCSmwIGqF2bCdISbdX2SmpQ/y9kA1kRV4VpWC0pXBCec XexNu8pwtb6P5Ubi69fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tmmw9-0000000FyU3-3Ffx; Tue, 25 Feb 2025 04:52:53 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmluz-0000000Fu1k-1FMm for linux-riscv@bombadil.infradead.org; Tue, 25 Feb 2025 03:47:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Y+AOLMBHyoEBsAHQDRMLfrp+DU3rIi9C1hjH+u4umGY=; b=fvKgqXEjWVU+kgzLwExkYCqVua VHOHQuDZsPDSNnfPROXtrf1xszDEw0CR0i1kdB4AWHizLhrAl1k2H8cnDEqeoqLkwGXQJYF8ZTDf8 5SpMg5Qox/fnL2EGktq5s/Zb5sdyAV8JutJLqXEmHEMxSWM/JGTHGiKP7UUZgucpmZ9x3p8aw+7MD bT/Ef4F6nnpL/3lvXuoGSh39koEQtc+U4tPdvBou/8zL7s7gpmpBH2V4JYA33YGkkJmowBYKoJqP+ lvwjfm3HxVeG/JVQbMV0bAobYi6zJW2rXB3FwfqxFzHC0MTeese9FKM9Kgo47MkPijmdS009fYJNy hdAABthA==; Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tmluj-00000003Hvr-06Gg for linux-riscv@lists.infradead.org; Tue, 25 Feb 2025 03:47:36 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-220dc3831e3so95477855ad.0 for ; Mon, 24 Feb 2025 19:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455238; x=1741060038; darn=lists.infradead.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=Y+AOLMBHyoEBsAHQDRMLfrp+DU3rIi9C1hjH+u4umGY=; b=GgvCjSq4Gc+YxCcULbNUSwIy1K+bzuxO+D+2uNQdFxpG4NU46lBD4LHmwV/k/8Ihvp o876JKEM3MDlCQpi0V3b1bEf2/t8z2ad2dLO3SEPSbYwkvQWdmSI84HGfXrUJSxIUWrs YK1qu1U8OiKniXuPXefl2L6tzfl8KFA1/Qe/a98Pom2Nsj/KQNjtkYq09jPP0DcNcgC+ 0Af1hhSYw6jEW337/r0bUy//n+NnrWhWBi9KkTmRH/rvPrHiYQErR2R2xHwFiXTS9QkF hgckEs4QO1FWSS2lq3kdo9UW24Ju+r8PonvS+r3mDPynVKZccsC+9+waMVpPgL4APbGP fIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740455238; x=1741060038; 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=Y+AOLMBHyoEBsAHQDRMLfrp+DU3rIi9C1hjH+u4umGY=; b=hn9iKrZwUrgq1uli71A82ZVP4bq7O7/6vZAs8ZQygjxp6mYFIbkvhFOfo/o3wuP94Q RY/7rv/O5B74kxIAIKiM0+GQY2GOHuVB1Y6KV1PMgfaJcgWGYJx4c9GRAMRgWnIBcmMH hGkMUbBiPriZSr+CaHs0emHTPV8ZqKyeaNHwoqQ6qlY9S3J3081kiXYR8WtbuTio6gBa drMCFTmQvS13mqnorXLyl1c91aatbqJIT4UpBY8/QUZCP8ZTqK+1/D346WjKy/m858+9 IEBgAnG9ZMRTdGnpkDBHZqWQXaCYdgfSCn1d5iIhPeTEOhr7NAH4Iq1AFxOxLdb03csW h6UA== X-Forwarded-Encrypted: i=1; AJvYcCWpltEcXYwRjeeMQefhZdzGdo/WCiDTacMHPu3fgctyE1pRgVZt0MGO/A/ILigijQaJq7r8sG3nE6TLQg==@lists.infradead.org X-Gm-Message-State: AOJu0Yyd0UrfT5unbEBs7tvy37O/fFBOjHyGVVdKPT6TGmVvZ/3oktXG tSbEDnSt7zjO4p3c+8+kNIu1ErCI8tdjch/y+svw9C/FmeC75gBeLl5PtgU4gPU= X-Gm-Gg: ASbGnctd+ejHf4aCPzToZIBUm7+MDsc0mLhvAEf03P2uqIjqSGUiotiIQmAO7b8ea5i ZTGdk3YxqDcCbOkqYEoJeXsEsyeWjQHCJQ69EUfu0q40+0lVp8jAvJTD/J72SxZkFXkj1ZOQyOT HljwhcCrcTNGwPcp1niCX51eB6f39eGJ86+84PZi/6JOOh6QiIg/lC8RgRMOhEr3g3N/ga7Nx0z gWExbn1oSlGhxAUOMP/uK7xihXucBi+dzx31OoQ1cvtazjwp7FN7bY7isgL57L0hHXv7/onq6Yg bDNlNBvySQkb7uru/MzzVLaiV1UuMzt2QLT/J8ufpOmymHBGq2jOs0DPa0NGu8iM2w== X-Google-Smtp-Source: AGHT+IHDwvQZzbKv24vEjKNvLJNI+R1iJ4OqsIlmXN9p1d6u9OWq0+ZfVfD6gOTuv6xGQ3OntwSRRg== X-Received: by 2002:a05:6a00:6f0e:b0:734:26c6:26d3 with SMTP id d2e1a72fcca58-73426c62969mr26062579b3a.5.1740455238550; Mon, 24 Feb 2025 19:47:18 -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.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 19:47:18 -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 6/6] mm: pgtable: remove tlb_remove_page_ptdesc() Date: Tue, 25 Feb 2025 11:45:56 +0800 Message-Id: <3df04c8494339073b71be4acb2d92e108ecd1b60.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250225_034726_225220_2A746BDE X-CRM114-Status: UNSURE ( 7.41 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The tlb_remove_ptdesc()/tlb_remove_table() is specially designed for page table pages, and now all architectures have been converted to use it to remove page table pages. So let's remove tlb_remove_page_ptdesc(), it currently has no users and should not be used for page table pages. Signed-off-by: Qi Zheng Suggested-by: Peter Zijlstra (Intel) Reviewed-by: Kevin Brodsky --- include/asm-generic/tlb.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 18bf499ef8801..dd292c6d3ce88 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -511,12 +511,6 @@ static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, struct ptdesc *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) {