From patchwork Wed Apr 2 18:17:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14036359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C943C28B20 for ; Wed, 2 Apr 2025 18:17:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E62EF28000D; Wed, 2 Apr 2025 14:17:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC310280006; Wed, 2 Apr 2025 14:17:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C183428000D; Wed, 2 Apr 2025 14:17:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9E6C7280006 for ; Wed, 2 Apr 2025 14:17:32 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ABF331A0622 for ; Wed, 2 Apr 2025 18:17:32 +0000 (UTC) X-FDA: 83289911544.24.A560936 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 0C5CAA0011 for ; Wed, 2 Apr 2025 18:17:30 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=N5iTz+gB; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743617851; a=rsa-sha256; cv=none; b=bAA+0NFOjnZr/ELMj7Qo7D88uE8QnQ1R55ikKMDRMZTKkBb7RXtaVJ8CKGBqixQLtN1GWq d3Q7ZwAT0KYSbgs+sFX3g8UcgaDQnM3a/UWbiuIFZH8pkpiJZ/IAjA2+d7wFGaRNdClmbA kodI37K1PLOyA6ow4/b8l6yqBU7An1w= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=N5iTz+gB; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743617851; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ryaa6rOT3ubAlWnemzdFbAbwh8PCgJz1kds6GBMukSk=; b=5ryb9+BT18WUmOf9PFrD9Y9gnZ0+cCOg7iZwyQ5VgnwTgnj2jyKr2ZnBYQKadx/Z2Vf0LC nQpi168WMSNRBe/duNuEjgzY/nvmwcRnip24e//1MEwgsWAhtg36doS3UALlBCE47EIDER OhEx7EGiJC7m3vnVwA+/4h5tf5zgE5o= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ryaa6rOT3ubAlWnemzdFbAbwh8PCgJz1kds6GBMukSk=; b=N5iTz+gBXug4FAnm6+9WRrVDV5 N5OwVI3QLw6iDzLQfZCZcslVW62ZuycySPvBm3xIBto/uwwBx2OhcddV5uJhSMI97jW/ZXpoFqX+X VhIZc2A+9E1BWxZu/xIz+KKIdhF+oIqDPteqhpNml00kdtNM4paJfX5OjpT6Bxl12ocBS2sB8Maan tiX4bMbTvDEHfx4UysgRjKNgz45cXpVG6NG3nFlzYZbO8L6FNOJIAWtl5btGM0s5mfYpLyc7vUoi8 0B1K0CNi/pLXeBxMKLXOTZ9Uq4FUZPzmHQxkp76p+HEkeyjC8ZwYtsp+tLgP3x/YoQYk/ou8RpykR hA2Yk0Mg==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1u02eF-0000000A0ik-347A; Wed, 02 Apr 2025 18:17:11 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-arch@vger.kernel.org Subject: [PATCH v2 09/11] mm: Remove mk_huge_pte() Date: Wed, 2 Apr 2025 19:17:03 +0100 Message-ID: <20250402181709.2386022-10-willy@infradead.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402181709.2386022-1-willy@infradead.org> References: <20250402181709.2386022-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0C5CAA0011 X-Stat-Signature: ph579jxz4qdjfa8hxkn968mzwuccek1m X-HE-Tag: 1743617850-636878 X-HE-Meta: U2FsdGVkX1/h6+JoIL4v82U/HUO/irkJUfUjGC5j8Lgw8KGYjfr/hgFE4Bu4t152P9IiEr7oY84u7LZH15o5ael/qL58P9neudcxtxf2WrpRkxLTMTgRfyGB6CvXLtdv/3bsmzOQgKjSEmdvb+Xd2R8wxnabKme+RbL/wywCq/PDLE9IOQnAv1v5Frerw+uJTTClY74CMC/7B0uKfWZEoPsITiLE2e+wKfeeDDF/Z8TJWn2I9qyPMDnyZR96zCkQttpyTx42mbRuT9VGUPjV5ibVaDQaRZfgPFEsaOdNqfWCIRwKeO1flcmdNbTmTZzF2IqmWmUR+lpXcgE6VkIYfG1J6+Bd5rqxQucjz/GUvscG6iP6c5CShCwndXlzSa5h5gzT5BvZrXMh/pSzxHnWY1yHPz18D4o2r/ACzByl58WZ9v5slwaFSBp4wfMvWCfejywyvgjLsXf3Zum2rPaGsQzilNo+Uj/MagyYNHzQFHZkKUWjKM6nyAcESW0lxiWBs+fuBzXY0jZogpE4xB/5a5PFDRn6CKfbpDVUKEsgA2ud/+OLPjddCnDTv4TNnk7hGQH5JRQ/6IRB2e5rMM8QphVo1ynvJ9g67mvjaKLqU/rohRE67xJ7GKMY5zQ4l20PdnLctBrXBkb9Bai4YU/1dUMto951GXrZ3tvJ97ri9HKXvNAnC0kEcRLan3Y5/rFqBNsZlrvZEgH2Nl4H28mTBCbQoAZLTj7b/fqPcsLZD92NqHPSrcf5u2LIwUVfy4bFGpzjx/AVAooQCy61LCI6DdbaTo3Wnh4RQIa8K5iCDaqHq2CUWL2f15DLhzVXD+080OgcAT7wSABmkblI68OjEK6WyDDcFqutn504lYJpWmVP9aIASBgXcFw1BHlPUAdNoCwj7xU2Bro+FGEXt364xWt5pz707oyxhPw65d40kIGnHdDmFm5g0oMOeqQobPgxySAakg+u/tclUqjji96 AQGG+3ZW 2uFn9gOcYyFY2wPoK2iuYzIS+LQrj/wN0Go2fYwUC2EFL8P70HR3FhO6W6pMZrrgkV9EuCyXtA4WWuW7mk/DEHw4N8pF3XDI5DFiKxFxJ5vcBH72Xu2K1UefJs6B1SPwjD0Kk1TwCqfpxioXHTVSZenWyWrsvWBCnFwVLtByqOPS+ByZPjc91rfuZ9MX0drvZfOxVElQTBQ8nc6AadEnek0uLD9EJQJObmegY6zOb2mHEZCjVdJt2XL3LqJ5PIh+KZLFGISQ/C2NB6kJqv5oZ/0oBYhfcrGeaVuAk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The only remaining user of mk_huge_pte() is the debug code, so remove the API and replace its use with pfn_pte() which lets us remove the conversion to a page first. We should always call arch_make_huge_pte() to turn this PTE into a huge PTE before operating on it with huge_pte_mkdirty() etc. Signed-off-by: Matthew Wilcox (Oracle) --- include/asm-generic/hugetlb.h | 5 ----- mm/debug_vm_pgtable.c | 18 +++++------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 2afc95bf1655..3e0a8fe9b108 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -5,11 +5,6 @@ #include #include -static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot) -{ - return mk_pte(page, pgprot); -} - static inline unsigned long huge_pte_write(pte_t pte) { return pte_write(pte); diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index bc748f700a9e..7731b238b534 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -910,26 +910,18 @@ static void __init swap_migration_tests(struct pgtable_debug_args *args) #ifdef CONFIG_HUGETLB_PAGE static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { - struct page *page; pte_t pte; pr_debug("Validating HugeTLB basic\n"); - /* - * Accessing the page associated with the pfn is safe here, - * as it was previously derived from a real kernel symbol. - */ - page = pfn_to_page(args->fixed_pmd_pfn); - pte = mk_huge_pte(page, args->page_prot); + pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot); + pte = arch_make_huge_pte(pte, PMD_SHIFT, VM_ACCESS_FLAGS); +#ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB + WARN_ON(!pte_huge(pte)); +#endif WARN_ON(!huge_pte_dirty(huge_pte_mkdirty(pte))); WARN_ON(!huge_pte_write(huge_pte_mkwrite(huge_pte_wrprotect(pte)))); WARN_ON(huge_pte_write(huge_pte_wrprotect(huge_pte_mkwrite(pte)))); - -#ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB - pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot); - - WARN_ON(!pte_huge(arch_make_huge_pte(pte, PMD_SHIFT, VM_ACCESS_FLAGS))); -#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */ } #else /* !CONFIG_HUGETLB_PAGE */ static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { }