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: 13989225 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72AF22571C7 for ; Tue, 25 Feb 2025 03:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455192; cv=none; b=X4B87vCKZoHD980c/MKYYh8nYuM0UVyUW3UDb7tv8wgOx9HzkPNkqR+tSuxZPWx6Sb6OaNcuEsEOhoxG2GynAtHCMC+MGGkTQEOk0J1UUvczbZYNoyQhL/rXo4QIkX8fOqWOpN/VYa+3wqWV5BvNELhjxwQOL7FPxSg+4FaN1LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455192; c=relaxed/simple; bh=+Ao5l71m8R2KBR4pKhSeuqtrK/FFUTZNCirhHcI/U+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JUGsPdja6mspN3CgfHoxUwh+kezv4a/Qz5hiMRjI/L7bAyi4oU/v3pUh0CoOTXXXE9qQCMuXLifRiLvlhnSNaalO1Rldj162cMStBWJlciuYMLqpYpfivcBkgI6+WMrGkBf0cuMLR3ggQ1XpdPww6YZhlZ1/zdKn7q106qYm5Zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=XqQAFeu9; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="XqQAFeu9" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-220bff984a0so108511975ad.3 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=vger.kernel.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=XqQAFeu9+jAY7gKK2np4vO4g91b9uWMd/6TX7uoukDIaD/obEG/vESFDxfKesdbDoM DUhZSnz6YFmvEDmpJ/nWXcwRcGca7LDIIKRDNxDtW2hjagjoenxWRFn4/kcvQXf3ACwl zJDVmBz48yBwHLGQMaHqSbxVJmbCZbQdfveZIEfNlYxG/y799JFM4vRo7yeCq+nhdKP1 Q+5kr2LA3g3RrNO2bmwI2bN4c50lMhba78Jbd+BDEVb4CwQBNN9S1j46EM/7O6ZtGOUC k7tXgspl9UxEDV8bfxvY+EQ3QwjNTMjGgtNLzJafFP4GWzb1jmwV2nUqgBedoxCyHI37 fAOQ== 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=k0POi+THrNkJFH8QX3LiBodzOafl1k5pOked9wGQHMjSBwmNdrJ87aW5v12IxHHUyM dzO5D0MsELNR5SA/Niv34kgMsADtGMpi6gTNNNyeDYnnEnvV6kmZqSZNuJ0XbqVTYqV9 1I/2dq5FKHQ95/y5HZEfGz/mRJES1ZWdUKCAeesLAgrEz4IiMi11hEVqwoD32tsgrqU/ MObu+5m0NNWITMfthlwX6jjPowjcepFUX2HDtGRO0lXqKlN0OxN4nXZAXWs2mEaSgjHV VPYWARxORRnTWHGZ6NK9mU3NSPpYgZ5H4WpCRy8AwZ4RJw5V0Us5/YWC3tffB3IeqCMu a5fg== X-Forwarded-Encrypted: i=1; AJvYcCXgN7Lix4Vdqf2/3FkIBCSUy/DwCbqvOcejaav4dtmSSKrdVGh7EoVSIYpayMrjnsoF2rSILm+n0w==@vger.kernel.org X-Gm-Message-State: AOJu0YzsT95LQK6ny9XvbHwl54TQLp2MM/XKLorXsglYW/Eq9gyrZ5Fj 3WDSNCXiAcTsv0moCwtja2aceQfaDamqyLXLwhj8KZyt4ywqSIwuxwUM7zzu5Pw= X-Gm-Gg: ASbGncuPeBItG0fQGLdpODwypw/rggs4NUFcQ1XtWVpgxAUTs76wgSacsrL7wQW08XZ zygiSqx2BEQBxBhQyhZ0jVZeqyaeq3wEx51srqH7qn9h32pES5mJl9o6npDKn2XJUrRhNfHdoKv ol4UW3WnJduh4F9ztT6BrJhL0MGjuNZ3NrXJMR6lR0m6pf0FgZcuVHGant7jBWwTAj2Jtsxel4p Wv1CfeysQdVAa57AE+a41Q0ZGdZBafc7GL/nNHFA2ffo/JwNlEK52Ffh/oTNw73tNVaQwerCJOi u/MA8+7loLmhzOC16RHRWHKaPf5Cp8pbZyn4MV5G9JQBz2zQyf63++QKikFa03NIIQ== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13989226 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 797761624C8 for ; Tue, 25 Feb 2025 03:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455201; cv=none; b=QzoInnkmsOQbyF2O87At3EzIKYBt+bafmVJcdf/gRoZD/P9mKqE3sOTt0s2xRMrfuZiM8Jzit8TWMJFM4qUn6ygX4jJaQnvhRCSy/3IWvbpHTj16Q1s3GT3TUypfL7wsq+rErujGj5SDEzMoWKEwIX8uxMYiyPBgeIorv1sfvuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455201; c=relaxed/simple; bh=oBmV5ytFANypY5PKhoeTOhUVK0FgP+zeeiYW6bw8jKk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=achbb3IfEjqmpqnQMdtQbexQTdJ9ZhQTEzM8e5nMa5M24f9lYqAamiVJUeQmeie7wMJX4yfRfJIPcgLQa1dBarfS8in5fWwA9eQu+2yiKZukSI7lULl8Fjw+/M/rjTfPytS15oJEh8Nel8Frv8OBoKDRtXvSAUwAaeNzTcNT7AM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=bWOqBTe0; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="bWOqBTe0" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-220f4dd756eso106403405ad.3 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=vger.kernel.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=bWOqBTe0FNo2JdVQczJkB9CnLCjn2VsxTrBCMVEO2bTkBwn+9fWyHYUfMDgYlHDlO9 TDmuZaxsUyySuy8UYSL6LHNPDqNr06zGC4mt7x9TGkuiwf9KeXk58HpCAKCaDHltt07U YoEE47cleCA2dOCEBABOZdBBc30QtUTENUi3AKhSwSeiyrIeTHWQ72YZw8/nRNL0Eqao MVHiYjurnYfe/P3inyxsjUHjzMLsK9zuTlHqXbnKYH31nouu2ZGM8X3B1qLuKsy5v0OJ fwMwi6YsDiBPkPC9QwuTZlX4L5QbZHPCnOVXqf+5suieKikkI6Jm1O5rCiHa81+a6o9S x9dw== 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=X4W1hU9Df/lqkOYwL9bScDxPOu5yeewWo0AoDxZv7YDxCg2Fp8Um5TakMQcahJtMyb QN+6OnWPKq+p7o4Bz05G8hOPI5ht2Yn01PjXvsmbuZoPwlK5UjkF7QV8CdWhhth9wQzZ bOG6ioUBnQNDDgrIX0R5laCAeE2bp56WM7cNF8OHhDek8HR2Ias8iu4BaSUlriqaKDYX WIvw+IXQ4F6jvC8/B2yAYsmFbS0OHdFwgrk3pXs/yFVViHCtMePju9BQHU2ac/1CqmAV xZEIMiM1W4Kvjm9liY/gRhEfxdD9cItCNoAQnLanDZwh0Vz9BvUyg22sLvGKulnIFB4q VjBA== X-Forwarded-Encrypted: i=1; AJvYcCUZFF6pCT9KbxA/KJiqe+CzZ2tRf8VTpaTum7BFqml7qJljaac3MM4AnS+MTEAHZFXxyX1mMK6vcQ==@vger.kernel.org X-Gm-Message-State: AOJu0YyZjW8Y86aJ1E1qq1H4mnGJrynuLjAvFwMHlp94zhktuLxWzgOq OebU7FX2VxavJsJmoniaJcwzNzlHJBhk95eqM4C5zqxmROH2ZcbX5Wai/pCSMDw= X-Gm-Gg: ASbGnct/VfjTMu0aICFXp8pMchaHtD9Y73MKgSy3k8EC93ipgbqy7zFGfYyKMTCJKS3 DFyHzHbKzfujbVPrP+dd/XDguWNqdTJfO5zONnXMe4BURv9lUlm5i2eKhhGxUh8CEKVZaqAz7fo 6mLT5XT65D+zM/YsyfhxAYMYGs1R3gEP+ZWnHc2kA0mEFVPOmLNjnUJaxxZIqzc/PsTgbOW/f2N ilz1aIjZqlP++cUbyJs62uZy5RvPSV61ixPk4u6g51g82NK0jhm8/PzpQAGOv1AGlHGmeXJkQRq OLWEi2dRtt4qmWKPuNd/MGghEe6t+OFRHGVP+IljIepp5u9zyF2M8nDiIFQl/KtL5Q== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13989227 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CC6F189903 for ; Tue, 25 Feb 2025 03:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455211; cv=none; b=oeG/zsfINv7W3IaBq9joR4/UAhkzGlSFTrxhefZzB4gVXW24JgmQhV8wTMNS0yYxwJEJcqGk+tYB+tm3lWG3URPcU9SWon6eWPLw85hZp4/DSa3FNWLGcKBq8Vr/XMdnJLIey5nz60s+pHfQ2kmuQnkmz49zZKr+YJC6kb+zdwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455211; c=relaxed/simple; bh=qOYOmYv6AcpiD6NAdQLP8Px3mufRdB0wo+qS2NmvqWQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cMLTVatJKdup4e+Ai/wuzpZJ1udU4xTktlRwfH9eC/fxbKoiszd4z/aZm3vqq0Oaz4mn/tMAU8gMoaBD6qK4FsL41sT448Bp655MO3P4n5s4H4KjBoERJZjG9+/rqL4Uwpv2c1SdOty/hJ4pHEYxhN4MYjXlO7ChE7qdMJh1kKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=XxJVPKXQ; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="XxJVPKXQ" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2fc0d44a876so8263341a91.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=vger.kernel.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=XxJVPKXQRhHu8vXHjLSJytIsBI9a9NMtzbR17v5ArbR6O9v4DosIc11N0Kzk+h4gVu KApjkrXOXpEWnMqunL3baMwyfjt6dZ4+odxhwoCdEejYmT2in6L4bHY70qe66MsLWBHw d5pAzp0FhB4gIZUs+yvBPJxNqiNM8fBseaWklJrBvV8uQmK5zyzdhEXKEYD1wAVtTco4 ZdDE1gWA96Tq6D2d7OnUa1JgQZk1GOlhCVMEFBN6m5XlMLJFsYZw67Wh/A8z5uqhGy6f wJIqN6lsGUkzQeqlsv5j6GFAhIXsH14WYDzE+F3ypEqJLFTAvBRLHBOIJrksx7fSRs0W VVsQ== 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=KZvmfRZgzvzjmsFYH5cn/hHnaYnlwQT2EJDhSbxBhisDMYJ1HT+ccBmx6T+N9woiBC wW276usvOUs9VcLm7UgImPytn4oWMozjKqFs42eOD6kaP5PXvQXgAedi1A28jhGFtDzg A84aR7/bAj+1fbvFlCyyVVr2RKexIFy3o3DZQrsPCTTSneLoIyREzu9tk0OygrIWoxky S4fLVLnZML4piqf1UkV9fMl0VJumOvFcRtejGv2DJG93erb0uG9cgx6DAFCHC/eSOJCb k1uW66Ht5SwcZO1Quu1Z3ajnwaUjroaQICBVR7T4bNfR2bgyl5r5Ku15f9fDCvMirqEh LaEw== X-Forwarded-Encrypted: i=1; AJvYcCWQrdh9ueQlhKwo9NBCguvQ8oQew8uZKMXkz4yn/WJMuaawt+/bxgL4/mTgDiluD9REHBir72jUaw==@vger.kernel.org X-Gm-Message-State: AOJu0Ywdcj6ctH2lgqpghjSy0+BEuGIMTUZhxPQVjjjYXtTejYmhAT6R fxxhgB/K2oIyLofAjap6jPH3aazWIwHgYVanK4J/xuFvLeVAgukrX4RArRRywKM= X-Gm-Gg: ASbGncupUiwuba+d1hbONrPdOAVjuQ+gPl6v2/uXtnns8v2Gn4OPxjjBI63zrzksJxv ohda971EgOsAOGtKfkxY0rnS3KLntgk7ATWtA54kx2t939PQOik8gEEGbPOveqQnlKnL+VYqi4L gG5DHEIDOTvPx56YDMNHAccaocS1L9AbfTiA5RnhVmgoQCDVQL7hKARoPM1cyM+jviY2Hrf/ngi rzNvLYxlOLPMUv5kL+f9cc7C2QCZp/EgBzBdVq0etZrqs4dVKZgxIgVJAaltpGigAnwf1t+SZ07 jQkoRuSlRJX7dgnAfOfKPk//9py4Jk8R+ZhsXuhsuvylrRHlvP08vU2mNpg48A96Qw== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13989228 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80DA919ABC6 for ; Tue, 25 Feb 2025 03:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455221; cv=none; b=ctNTlfZNpzX+IfDKhqRGqu8rbgw1Kp4sj+zF/itM+C5jiuLsotQYPf6lvmFX/dhjKSSD1gVpo34dTI0vuBV9rXcII2c5Ji0YhgYJsie0tAVeI84Od7SZHbD+EU/rKBTN7P2XWHSqEDKqEG6ujjStH8kmv8Npenk8Gxcl+C+eV2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455221; c=relaxed/simple; bh=9R+hVIAoZGq7muh+MjTEAY3Ux6O+nL5GCUlW0n8y7ig=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HaPxvF+PvDZ6tdabLzsieCJBHNotZdAPpNFiNBOV5k/0saNN9L2VxosiBr1BAX8t+/PCtgIdb12EEnyxDdyE382VvVCHssQNkrzLYpFIFD0pdiFu0yxHyBFinzN2Pg3e+BzFFA0Ns9gSlcj1lntq9aM6XAqd5O30u/djT9AY6UY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=Cu/mdhem; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="Cu/mdhem" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-220dc3831e3so95475935ad.0 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=vger.kernel.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=Cu/mdhemmCbAerBZ9oVzh0Mkg7UNTtb83FVS7cRwQrf+fw+CvHENqBNF38tX4xjRr1 qyOXtUaGbAguT8/p4zLRW5lb5ryKRykzW066IB+wizfDssHNXLF+6/FVn9oSPsk2nb8x caz1Vmj+BO37leflIM3ZEO8wwf1Kw0eVhFOUP3stmTY/cJxk8hKv83Ku+TI9bYouB+rL VwJ+O7Kd3FTGQLdYS0gBfsk41dNgkbKMy1sGBMk7C4lWRztP2Skl+Akczz36pcGBQzWM QSFTodUUx7q/qy9xxZviWTGHM0F71pcXDZnTWgWQe3lyLKLgbrG+Ga2+TQQh7/JNkIQU 2E0w== 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=iNrYrXg09NGWkEpsAp5kCqL0Wzg0z838Rd4gV5tKrGpa8D2iYSPrS6PbTdrDzIbKGT geyG2u5RlPvRIlopK1npJ4bPH8+/ZR0Eh445aIVWnWyTjkqIVOM6BF4IoYVcrNG86laP r//XqeUurGX9KTDTLFa0U2fRmRtvGRqKCkrLfOgSIlntnA3RxWFI4y22mUdgbW6K0Ufm WbBbPIWU9gDANzjlz/B7iV4QpgZtpc/UrPwIEg3gq0W09YC2f/rtCsUcBnaKKDlvhTSW B2yrjaxizdUlZ4qNuNn+k1fe2ovPZp6Lykwh3NmYgMsDT7DGjLYbI4MSJI0B4EY9cao8 uPDw== X-Forwarded-Encrypted: i=1; AJvYcCVYNnU8OAeIWFz2/Cd2bp6k0zHNaPBT907fRWUwJgzEb0Q5+j4HGIwhF3CUboiYFbx2kduHAm0qSQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yx/lwDdenCaUIYwiwrNzGkT2hutcZ/sv0eYsnBoszLAVW6C3iwF 8a4z+KtA8LiqnnuGQXPpF+qv2sm1cRdsjvqfFrxllacAoPdP4EPjh76Hv6cbSG8= X-Gm-Gg: ASbGncu7lVFSDBpC07GrlsozrjpAXQ3ixXigWAKSkmQUggfykdDJzIXMZwcFDxmIeMd HiG3bCh4ku5U7/rK2n8Il/IDOUWRWebr9cG+G4lWDguRqHSO5a6r4/TCeiOStZ+b5arqt+noLIG 3EtKM+7Es3FlKF5jf4VUftzcYflQ6bCBk1qqHEKoDGsmJZNYnptZFvB0HQScpxs3ihwRGnc9kQq Rak6UepFkJAnN1VGnBdNs6eUDbHuHsiL/m6x4pqz7MBFYq+a+dqjNes4hok6lNiG1GMqHrzMMig G7fHYijxeHxrIVyX7FmjqFLQLq542v84dQK3bZ/6B31GDR5d2lwWQH6i5pzm+cbStg== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13989229 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39CCC2571C7 for ; Tue, 25 Feb 2025 03:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455230; cv=none; b=ObT9C29ja5Wf27U5fXQtiRfpeXZ560a4CuzDWwLyRqhARTS8Uv+pKfz+4ch3tduUxhci/uqRsm1pInNins/TYiSkkCS1TqyuJOsIw95r3106NDZsE0piv3+TMEPeZ0BEdC8wI+iu97FELDpkh1v+mJ3erX0lOybdfhUE8m3jyt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455230; c=relaxed/simple; bh=uEIt0iOIE1wq+fFnae14pvBZV4BJtIqtLEBiBKsbnt4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qqDaprLNIYwQSINP37ig5awSvvhM43u0S0h1xOeCo4AdDdDUJs9u4HAXsSLWS00aQJPof7lW1Ws4OF0RzFbP07kwJmdkUUh9FpG2FpA4ywvGowpZV6W6bg9+KvHUOxLWjpAi0jsq9eXoKkq3L7Ye0CAvZ5uSjU+cmzPHazeAoqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=Db5U3Vsm; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="Db5U3Vsm" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2fa48404207so10341928a91.1 for ; Mon, 24 Feb 2025 19:47:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455228; x=1741060028; darn=vger.kernel.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=Db5U3Vsmaxgd3fgETnudmM8tmkJMVY7pGwdCHDesrQ2DmxvkCMH24Ej7WIgjzAba5j VXZR0IpzmcQrf1Ty36dPjXn1qFLYodTgU515y8LstS9bOvHy6b2XtxPfR/0N1BlisRTl IJbghtr79viov51fa80+AjLf6E5t70zAH3FucoA1JgEPDoqQKe62BDFiGsqEKByFEuFp O5YdSgepx4wgk4bkgQnwCnvSNfPmOccdfnZ/Zr2+8AVuGOhaIYzW1t4AL7pix9/0MMK9 2hkYFCgVZUTAEQRkA52rtp+m3NGecfRQYvKjaOFIHSoUxnZE7NePzAFytri072RCc8lp 58Aw== 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=JF67kO+xX2FJuVScciJ2PBbZcplhKnNqlz+zbHdxAuzVwq7T9gJeoLjzTWa4qeQ+58 uARJHFz/Ogq8W04hLtbcV0SnEu0YhM2lInUL0kA9KKE2FaP36vsfH3SuqVu5WiSezQUx TPyImYJRDVngIreTg5AyegiyLTt1/QbS+LdgVoLRMluqdMVsW2Nu0bBP2TLhIcQtDqHg kxKQcdrXobAOjZmOtarx91l8d0FZibVQW4sMSQ05OsGKGPfLsvbZWavBu7i0x+ASzAPm ZQ7+okE1nMJMQZpk9CeG2TKxx/aAsEzPBqs+DaxhAfT+spU/D+8UiLtrvUL9vtx62Qdl yKdw== X-Forwarded-Encrypted: i=1; AJvYcCVSt2TKdEImx7ZFg27rfTj1FyaO1mmTsNh+6CucRSHXISV0cPQwOH9d8pL2uD1y7hkg5zLkhW0L2A==@vger.kernel.org X-Gm-Message-State: AOJu0Yx8ELemVBdL8l9Xh/BOOCGSc/zetqjyyl2mxJSMANcAdfOWZ7lJ 0JmveHfIAs5KE8W4c/pY6jDEIXj4nDH90UoGqZ2WYOHal6dZaocxnG7N+gBT6HY= X-Gm-Gg: ASbGnctQ4qqLP5rq8Ba9yWSyd9cqrE6rGp5cxlxIuoM8hRmD8sya7G/4JNQaEd4ajwU rXBvtsWfQhOWGRvbYzeEMqu0zrmY8TTTsRpkx6S5aGGkEpwelsv20YbNxZNylBPL3NrfON93ZYM d+DkUrhMo76KLVkm56WZaej3lywqNOMxm8MB0S/hC1RMD9CvgR5KM0kiii7VmbMeS7APZWimHl8 worPzUET58sxncc/RSuirA8b706qtpGdKyk3V6fhBxkMFT5BbITGusXTWIt4fFElvcERxH9RgCL u0xZJnNh6zU4S4WjhNXTfbWImQ99Zo7hcAFrRSupyNtpx4LcmbwprrRKb7oPS6G48w== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13989230 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 490CF1624F8 for ; Tue, 25 Feb 2025 03:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455242; cv=none; b=psh5UO7ArdVvFpl86un2zuHBU+vptU8NFguD1uMgXJx87/nswOFbytPyeHLa/tZWbArwTirV9a7yRCXXZoebMi+MyaPpW24/kUh1Xq4sY0OwDfkykGwOnv7iL56VCLENIvx8OCCCIhl0nUerZrqCRuBPBYa5Z3dglp0Jpu2DjSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455242; c=relaxed/simple; bh=007QVVVFe489JDQoxvXq6IPNtqGHUmY/RQmaczrx98Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=orsCuZry3korfV+dXHvvCO614gKiNMOnWkVVLa/2n36wBzicAETaeWcJvBk+mi7FKZEIQL6E+bKS1d2o7fn8R1776/beQyJoItxz7Rc8nsuBnpgckuWzr/WUjDUKHnX0B9OH9vjqiL+CmLLPwaK9YtXXMT7cnGeR6RwA0ltcWmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=N62m9mDv; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="N62m9mDv" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-22185cddbffso103442535ad.1 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=vger.kernel.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=N62m9mDvTU0KT7/zOgSYI5Gj+Rt2Y3m3JKGSoFuLFr5cQorgKfTRV3LgEs7+XNq9Cl PX6qN90TgUX+eHKhfEK8YzIInYLCyIA2/pOt5HC5z8LmoAvu8jYNeJ/1n7Wy5AZ8lSPC EQ26Vg404rAFBoO2dNhd67BfEQKALCw9FTmPKOaabEw50R2u18jskTqSg7vpL45v2F+l oiu+1rGs13S30DbRSlEK5+05Ejsz0bg5QepFgIJfGolmaG/57Qn897DbgIanmZnB2ayr RQkux5Xr14cSTPhqWwo1Ne2TRXGddxosb9mt7RE5PwdXQh2DtuoP4h7G69I5OvjvxgsE vMPg== 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=QyUVIECNxNrnc4TSriCmARd6ES3Nbw115ichz/7NQkKn6UjENSlfAD5Stu6MbUygtT oiUoRhQKcxzPKw0PXpSt/wshAbqHvGT/APUGocvKWiwk5QsjmD57CfVAUAg8nIset083 8qKuYdutYcVKpO1LVrgScZeYTqK8HJ0bV9TB8wHIs4EdtGTO74CcA/sSG8Wzj5Y4grdN IZCLcwWsObAiOhmYbo1mQ03Iu05G+7j0fUFAwVT8L0YUBPSV2wBWS4zisFerREZANaRH J8KipB3K1L6IWIGdCIcW4qz1DY7MtRRu+dTtjzh3Qt3NWO714bleqkpbri2B41n2XdLq cJzg== X-Forwarded-Encrypted: i=1; AJvYcCUlAxk0AFWDN1e4r7emtGF5XTygfCAWbVdxWrglEa8ev2KU6KyZJgCeWNf7ZpmCkY4Oh0ks2mIH6w==@vger.kernel.org X-Gm-Message-State: AOJu0Yxq2VaqhvnlEmnPA17ajlXOxs1kb48aCZkyu3D4zWITeJjHQSxx D/a7uB7VKPoVX3VL5WPW30TTJcYCEMBHe1YQ5wSJBjF2q1V7Tw2XLEYWmmesIxA= X-Gm-Gg: ASbGncsJQz9M2d0v37fnjsyHrtUSOkiL27dpU/wk5ippF53FX/l/eNxvdW954CoFlit UADAiRT9FeXxQZLFdAmOP3/dhIsqJBz8rDCKoTi7Dcm7xNUhCKfhHlpvkyGombZlYtSmve9lvMX sjl4/jdge4Mk3YnuXP/mP4Ia1Lz6IfOosko4a0p3ONb489cOzIEgcSiXedUQzA0UrRCo1aHf0Y7 iYclgP5WYPZamnfgvrd7Dk8nHazKjiHV1aRq2qoIIzTA7eK6zqIkyIzhdJv3mHRMikRag+9lRTV ehi8LU8Q2KUCiUuo4X9cjV+BlbXBuewOqCnvNWrvSyeVQi7aj/roV3QlNY3rdK6s4Q== 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: Precedence: bulk X-Mailing-List: linux-sh@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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) {