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: 13989211 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 7661922331 for ; Tue, 25 Feb 2025 03:46:29 +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=1740455191; cv=none; b=Ot6xfGe5jmNHVU2j9qaIXbWhsOtCrvMf7/bDYAGlpvvzRBg77RhlRygYummFT84fNQ03j8A6p/iFGppghIoQEOFm92VtWx0XDTYN3aiCxI1odqHJoD4yigJWxLtXV74ECSng2d6QOoatTbHV5+HlCWnxlvymh6gBLVIIYbgyGDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455191; c=relaxed/simple; bh=+Ao5l71m8R2KBR4pKhSeuqtrK/FFUTZNCirhHcI/U+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QdVmgwMxw47F0LU0UZLjWllPCsi+X2s3Bf0REKL/x2pMC4W3fzR0B3ZSX4syV5G5atEuJPBduK9zXkIThSUmcaxvM4apYaGKMpcaUmzCb1xFHL3UX9NoAw7Cli93mTb4jwh5MKYPjZXcIPkoLQJ0SpBVbdxIFd2jnuIwAfg19dQ= 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.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="XqQAFeu9" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2230c74c8b6so4755135ad.0 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=PNAA2KWotiI9+HmxS64Htkc17J1NZybwr9b8j63zNoO9NZSXiXaB8BEdQQ734Ss2Eb cTk4wLq/NqGDQQCWw5aPJxfccS61zgI7ZixlwYOTgdblxloVx0Wni6xjUzeFb2zndZP/ mJ78zycz3frTM7bUtsBNjDPNW8SScsQ8te1p6KSh1LX4hCxct0U4falSkX/dJfFe3zpr ulpa9xA7l/7NdTj1/tXhtZZGyxHbQ0AobDGu2AVtN4sj4gY9oha+IPCgfVCrP0usDCQI nzfOAbP3R9fQU2/P9v5GsLvQvKTGqcpqDTimfb7jv22sz1wcMrK4IX8pFfTkdTHLmGDy DS6w== X-Forwarded-Encrypted: i=1; AJvYcCWFPmP3RKw7WTWd0rmp07nAv459vWvSQaa/yq8Bzcx1BqVeDeT/iNm+RQ8j0D8O53fhNxPd4/nsKwa+@vger.kernel.org X-Gm-Message-State: AOJu0Yyw+KthQtbikesdDL7muX7lw6oyosXhdS+mjwkfoA+ix8ZEDyee LrCt2bOjUDoPnY3xy+uinBc0zlS6pbW6PdLh6Nz1Qdn1aYk2o0LZvDNo6ro6les= X-Gm-Gg: ASbGncuhI28fSPcAvYbVtnrmJDUTAvn1FgArxe44g8PFgYLlRx2J9Cbn192PDvGtqbu +1Lwgyi02C8B44S5CY0aKPLZ1rzAqWCUAganhVMC5rkbQctHdicZdReiUjwVWA0mobLsQarp7iG vIG3OSh5IST80JyVkzZxJtxMt1MNpHwA3TCmdWwpiExhkdaq7PIQk8327+r+7Eo0JHwnzA0cTKD p2aNc0uLOC6YSfCXb3vHD4nG4XEooyFfUdtqF5IJEKZa5RUThBeYZsUsH4NPd9IS4zNm7EV+CXj GE0BjSW7Lgu966FpuFXN5jxYFFDYrlqvofJ7OVcqcf7T0/2q3d4mfdMOrxL9hXZOOQ== 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-mips@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 --- 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: 13989212 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 7E06B18BC36 for ; Tue, 25 Feb 2025 03:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455201; cv=none; b=albQBI2WYN6XyyZPivKLH9q0fldbgiNZgviBLptjFfktAQMdp3PitcDOjjipzH5rB5FJxAZAcrEgpXf4/sF2J4vxrtx6aRic8YXm8vKMxVpzqJTSGnyztw9ooCxUK07MmpbporkOw6UBUizB6vhJtT/CebfbZaG7PF1HBVk6kHQ= 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.175 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-f175.google.com with SMTP id d9443c01a7336-221050f3f00so115931515ad.2 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=moU5/o1neJyN0fjUjxrdbklFSTTOtnMKifa0+5JZut3lfHsDltPvm6xUefgnz3MrNP 7/ec/b+znf8EZsjoizCoJNugOc7O38LPz/iFAPPOZnPX034qh8t2APTUUyCRsr9WqrII xwrXHMRhr/H/yvKkH7M7IiE1y9PpMJ/bKBe2BNGAS/lNaDX10z7g4iY6UeQi6ysloHWw qxizG7RO7daqbPsC6sRdWzmEXL1O9A445oRKY8BdlWJv2yTyYDrlC8zLwVPw43YFxb9P Rb1V74/kQ8HQWNzZuhr9Uf2SSj+EiJOJVsghQB3rEh8qMPsR53Dusdo2zcyMR7VJ+WlF /DfA== X-Forwarded-Encrypted: i=1; AJvYcCWB+yXwpGHOyodCJdN3NA7RyQABw4SVkX7xxPVAQjdLpU5Ot4cfIfyl7UyTIes2QxkgQhpiyWthziAA@vger.kernel.org X-Gm-Message-State: AOJu0Ywxy38OyRvmxmQMc3VQG1gGP/jBS76TtLIGIjIakGG+7wqMs5Fr QSC1Ac9bpUplHFgSHF5K3OHgDngLEtcttzixfjx+e4yIjhGkSKCM22wFeC82ouA= X-Gm-Gg: ASbGnctdwXI1Gc9vlx+p4jowNSSfYQ6gwpZ3BiTPMPC6TpLsgp9JJog0A5ab4bhNsyf Rvk1lTJ6URRkDb4wO5vBZijcqWNJydby2bi/mjSkvZ6YKYPzP7S7uD6sn8KX6k9nGdYNPWLrlCC UmlAPQ1GAGDZHg8CHAI8LeA4bzBDeiV7JmwZSDBeSM701euxc4LHYJOlc4u2Wc2bBzkKAqszj8I oRH1XcTTBMVBzxb2FD2r6L/M7px6hnMIRup/VdMLYelvEZ191ZI/cpJH9H243fzOvBvnnGnJasw 4zMcot7VKhyhGZmf/D4qJGnk2pXDAiex6tY8u2drmAFCJvBR9oyNW0h5HkqaeWSQiw== 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-mips@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) --- 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: 13989213 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 8FDAD18BC36 for ; Tue, 25 Feb 2025 03:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455211; cv=none; b=ZlDkIAY2WJFhOaqBvgEOpIu5Z91W+EMyjWUqXj5wE/8ANNe4AFhPL1qi6awbrKOQ2mV2hntrU8vezuQujadmgHB+5KfDKxJmcGc1kIiheeJSYIsLxyXHrOF0nHe/qmlmZTBXqqFdYgEpETNR1jJLevGWHOo595awMaTwq1Mj6ts= 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.41 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-f41.google.com with SMTP id 98e67ed59e1d1-2fc291f7ddbso8280922a91.1 for ; Mon, 24 Feb 2025 19:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1740455209; x=1741060009; darn=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=Mc7dT8TRSLu4fw4w619WpdkRselMeYIfo9CLdptFfhlH9jyASp6OYPdseimdBEnxSL E4hx1s6PvUZDyyX5X2asP9ntOzkygV7KUBhkN1coT5M8iyGx9az4UV1FzrOnrLzBTug9 M3VqJyuKVhreeg+oAw+G60WbKh+ZeG2QNcyWzO00s2rFtXOhj+u82NQPgnRWQEGIP9Lx wxY7okdHa9XCTG99wiaCzST54dvENHj3lhMkQInsVRGXp4qTdlSIsW3ZP1xLRJbYy3o2 zBVfdqOFPegX360z4fHDRJW+DFHpZ2pyuJr3/VeT42yBfTACRM/LJDTjo6t8S1D62SYY Ju3A== X-Forwarded-Encrypted: i=1; AJvYcCU89EgjfT99qckrqJtfeoVn6QtLJThGc9yuAnXNgaj7G9goV3fVfKd9vMK6HWl4ng7BP1H9NA1Bu8Q8@vger.kernel.org X-Gm-Message-State: AOJu0Yz8/5JJkl0ko6Y4rVgbV9uYmEbVM5OOADWbFJ2M8xq7S6sm3sFU z2jBn+uqOO7TObO1zrYu0gqHJiU7I3VGyW0dmmUedzvtkcI630Dw4efCUjPzZBE= X-Gm-Gg: ASbGnct8q4SvVznN9QW9+UIHENst2SiQVADwqgSIvyfZFtCEMe1fF/RFwFzkDgEiUfV xTB2m0fkYdDlhsBMHPQauG0Fze63ax3ULhxuFuxI/LFpKrnmpHaZyiUnfhmTUhyL7AzME/6SfWA kaUsBfN4Vm7Kv/toWNFI49pcBRG5F6wCwe9vDah+qYlVfMNfsxQ+FRpF3tfR9mmqvJGgl7NBRW5 6OycJT98wtg9psDWcccenETZVgUKm+pXifYvP5zZhFdE0/1k8bqOqz6eyY4wZD1n7tf8yNXTFJH 4hrDf+hqbP1pNMzmPskq9XI/UzyVIvbx9sYZFGDo6WGTTZ7uJ/S6q7PU5mYZXI7cSg== 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-mips@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) --- 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: 13989214 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 EAFF01A239E for ; Tue, 25 Feb 2025 03:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455221; cv=none; b=Myf5QXkEDyLvVdYB76RCUFvHxag5voIKdn4mra9JeietpeF8I25it/2oUDXCGLGLPpCV15PwczNb+LhNY70/rYzITYA9V5vbERhUfjjDs1W/a08BnH86SzUq7AGlXjAnludMpu80kpLVWv5yabQoZfiVUbscTPjDctW2s5gnnRI= 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.174 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-f174.google.com with SMTP id d9443c01a7336-22185cddbffso103440125ad.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=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=EoVXEj80wO65gF7brwgOba+xxDSqI4X/T8gXrV3XCGwJQb0NfOykZur0ruWTXjvvZa UcMqlJK9wKgYLC9TapUmO4fKuOqz8LOLgZKGu7ttyh1fcb0mSkJDUH7nTD9kL91MAEjG dYqZh5+fiOtTHQzdM3azGz43RWtVRB1GZ8aqQuorZZ+UPRw8ljJfq/QBW8lg0TajYcaY jD/8Ch+0iYGd1SqLcyNrPVZPb5pLGdPOi0NJj6O7cmoHjtFhKsUKDRIibye7MGaBs4Qq Z/VJY8I+INU8pqR5o3HGkDgELoRzC5Q4iTrOyjJAVxcnNf1F9/AZMyy01a5ICZmugtpM CS0Q== X-Forwarded-Encrypted: i=1; AJvYcCW/Ypqq/dd+ZL+i2AulPQuMF3sZzF9RKpSlQfeXUU0nPw5RmRZ+j75Ph8c478j0+Se3QvwwkhWNfrrY@vger.kernel.org X-Gm-Message-State: AOJu0YzHOXcRL2gjdafET/qkgnhcCpeD/DGIKLmhfBuq9tuH3z7TCWuQ yMe3HXBNyh1YUoLDJqMY1oAQfWouGf6dpv5EjBCpRx7PG2flQJHpXdMFZznS8Vg= X-Gm-Gg: ASbGncudfsL0t10nVZAjioGfG/C60MaKMMUM0TFs5WCcBIdhETslEBsVjL1uPUneAxr bKw4SLiBhUvloksPK3Z9e/5rm/ftWjn/KHOgd/D1jggdqX/6l15XvXaVAZwQS+g83P5EhkUNiWC LwfY5M3nDdG+xDftC98Vd39nu4L/jhgZO9DytQqi4tZ4E9TqnJD25THQeGxsew5UDdAeYiLZiSf fpWoAe7JzldDTl/8sONEDvCHJ65gAZ8UPsx168sxrbRsrlr0cepgB2i60PrX4jPzfGIlslFtEW5 rXKy+dNEpygo3TUMGOyBYislFxfN/9YWHihcOuFU2mbUKzX4jGKD8xi5i8Ezq5glWw== 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-mips@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: 13989215 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 503E516EB42 for ; Tue, 25 Feb 2025 03:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455231; cv=none; b=qO6KGnz+LjTaGawDcuPi00UF1RcFpCTu5PXgmW8vQEFi4fadLaP7NUyx2Z/cCGMad9NK38zgWuy3k1RFyoxt8E4bD96XMQVnSr8CQK5EAWIX9OHyl/PBGnfLnqY3VsVUHeIXrD66qs7ZfCyoeLpRYgPjy/i41FXdJPQ4ANJDMWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455231; c=relaxed/simple; bh=uEIt0iOIE1wq+fFnae14pvBZV4BJtIqtLEBiBKsbnt4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=od/lOGjk0s/7DXI60hOb83AEQrESB/YvGhXCS+vbiXmLed7X3DfLvzmFgaHGr6aEmJ6ZGIFbcP1s1CLa+wsKMgAoKr8MCVRrkAzFYIndBBDL5DSLk6Zgdet9dL+TrWhIb8jmksQRM0Jo4hC+mtY+Xhkbn5lj2iUwTe6saYwuIhs= 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.45 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-f45.google.com with SMTP id 98e67ed59e1d1-2fcce9bb0ecso10058436a91.3 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=dAktMgXwkl69VadSEYhYHxlwbFgXT3cf/uufs8Op4VLXUsipzNeesfCmskOTwpA98I iAOar1OvBVKn61Ua9EOc7Cnu3Sfc5wVefBmwd2vZg5wnuVt7uiZMNnytOKYtSGRR/hyl D/FiTZ3FLT8FYReVpXZaffWKz1MJxv+NwEdmqYnnSCuEt0329tVKciEmgaJBQfEKrTYk WEwjZHF8bZtoI8/XbkE/SCIWxP9OdGRd6nphuP3lOpZ0gNEBBhIFd978i0sbxcBLOuti kwtEL/fGLYHGaNYijnaVJaFDyOiRQEf04rwp0+P4qcMJmSi8IKHH/ID+e+WNs9xQdvS9 a5sg== X-Forwarded-Encrypted: i=1; AJvYcCU4N4BnM5HoIhOYXbC0lBUReBjDnHHtE1IjYxnPrBQfVnsJHZUroMIFvB4iai6207BcjFqDHfSyU6Bh@vger.kernel.org X-Gm-Message-State: AOJu0YxuMnVX4U0EayIQiFcLmbjg1YX4Mx8Yj2Y1D+Ghm5MgkVViauSP f9u+mYDjh6yUmKtHzClAHKprKBuEtfr02YSi8Nci9g1n78DctNshkX1lMO61+lQ= X-Gm-Gg: ASbGncssfegDYV+R686NXmrXRlD5bR8goSccJg8OGPb/J9SBWBsJhgLqpXs+I9Di3vI l20UXFgvuV89XFKsRxhPuhCSIVKdRFxH+klUFNyHshMH9etlZgQZrBmPM0HtYsXEeV2sORg+u2B 7sB3i1bgU4z+cYimlNjVxatMKZwaivz4piFOumK+AcB4Z1fMkMutvuxKGKLhLbTQpUOOkyELury ddruJEoDeL3mZVsllNqv0K4H20B43a0kYczLl7CsXaEPLmCLcCfM16BsWJGQtWf+HihZkMsN/QD ZP2KD7hykRx5cCQxtWD/DpNDKA8QOr3hGVbZOthNVTHRj/0hkrV2211iStXQIlxg1g== 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-mips@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: 13989216 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 4910F1684AE for ; Tue, 25 Feb 2025 03:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740455242; cv=none; b=Cd6We8QbLywRkStjgMdcAoeOc4P6WzCv3rzcKf06nnrBf2Z1TK06/nN/GdVHD1eL7P3El6pWXUoIkQXnjSqSdwAJX148m4ptiTVAAgC1WHyLO1VdaXulIkm+ZllyN8DeFl2RRipEJ2nvTDV62Svjeyc2U8ujm1CwyPKbstklfoc= 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.177 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-f177.google.com with SMTP id d9443c01a7336-220dc3831e3so95477905ad.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=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=cJI30fkDS0OW3GDf5nsoyZ1P1e0v/RTLwO92HWgqyDYEPSnw5OxVdfhjJeXVlm60cr GSdFSBEMZcqAxCAg5br+3hTsQtL6xce5QvtQaqAxsTOFaZ1tStQwVtobgOWo+Ju68fTB zLtt8BdhG/jY1hu4fARbiwGuySXzMWFkpv2B07NH8+SRw2Vt3bSkoqZW9U5NU3HGNJFE wqJ/Jg6C7+BGPiHMkWStiNt0fM/JxpbUHOlN8dBse7zMrRLLCv63MpDECUTVl9MDovlf dOTui3S3ysSV4SS1feiVYgBjpl1yRxXx82h4YMEScktHlMWvIZG/LWYKbCJLpQ0Ydq8O Rwkg== X-Forwarded-Encrypted: i=1; AJvYcCX4FEmx6qvXy4e5si0wsF52zTfiiuuP8UyW1aqyQMRjU8fwrtYMmP61zU3UyPHPmcSsXDh5Uz8i109g@vger.kernel.org X-Gm-Message-State: AOJu0YyaHX1Dw4zb/AcjDtLZNQB+e36JqKrMWn6VS1o/NO9buC6xYijO kemXlaxl1gbBxyyuKHUQAynf3RqpFr6SUjcEpeuk4Swzir30I9GARfneODXHn/U= X-Gm-Gg: ASbGncuSs0cTxOn9I2qNrFCjVtV9Q9LuIl1fM8bNJjRgoZznBVJwPzVehf6AYJpz4HZ 4oq2Vx+sdSuLLtwXF/EU4BdDurm7nFDeCMYimBKxvrttLpOCWb94/ofiG91y4EJEWoHHqRl4igL t3pcAhDIc5soeqTO8cfrZXTg49WHh6hl0ltbyR5KolDPK4dTktN4okG74DUxWSEBgHqHku+GwaI FaPVK8Gsczydmla4+eR5Z9n0ja2uHYUN6r2ja4VeMvqxNDuhoko+dmm3/GzzyQSQvAWnXEjIf9S XwTF3ZV+QvIFUKt/k1FFUc5ipuGVnYo8Fh99s9Nk1FFIVyAbyapcBMCpQWNmz7GIzQ== 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-mips@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) --- 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) {