From patchwork Mon May 1 19:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227939 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 45333C77B7C for ; Mon, 1 May 2023 19:29:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51C28280013; Mon, 1 May 2023 15:29:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A4F728000C; Mon, 1 May 2023 15:29:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F847280013; Mon, 1 May 2023 15:29:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 15D8128000C for ; Mon, 1 May 2023 15:29:06 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DE28B807A8 for ; Mon, 1 May 2023 19:29:05 +0000 (UTC) X-FDA: 80742674250.23.EA349DA Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf22.hostedemail.com (Postfix) with ESMTP id 1DED3C001C for ; Mon, 1 May 2023 19:29:03 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Qau1TBSy; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969344; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=dsB5K25xHsky1MkcbMi5BFFZaQIWL87e/SVWTQVAEHzjymPPb4p1LUcjei2D3ZR6wbr2Gj hJ+HSi5XYSHxzVEyr4l9J5iChjSH/cggU0hcC2A7Oxc5lEyG5VctX+iS+RsibKq2HUeHRG tjS9PKrYu8SUIPQiAtBzi8Y/HXXh6Yk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Qau1TBSy; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969344; a=rsa-sha256; cv=none; b=pQj0GHFz2yLZVMcwPHRSfsgx/oPnD/uOZKq6Afbjaqd/HthO5hTH6W7901VBPIVa6Lcpep Ut2ve6jQBxa8qYCQ0grRa3gWkU4bczk6t95JqUyrZfDW9OjnsUdba77YqlyRv4QP4+NY9m ZERYejRuHgQloDY0OQfcAFznfVkcd/U= Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-52c3ffc8d13so158595a12.2 for ; Mon, 01 May 2023 12:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969343; x=1685561343; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=Qau1TBSyVipNmef8PNT07M/JoK5y55d5cqgZDlN4vhhP79tr9yaRETSYXvwSfxkzpQ 1wzTUy/T5LzAEZJEeUbvFZuE+VickGgRQkGj6paYz1jDOFsUn9ZCDLvNYYI/Zyr2RUmg bm3l9m5jLCH0toRw7+aEb6gYmXflBLWLMpuQeA0OVXisZ1A5osNX02KzemiZmkdGT+6d H7+k3mn0V3HtUXPo/S8coTYf23tz7uGdOWK0nFPfjqqe58njMrJom/cuk3n4mMysX8dy jTZaIlbFQNlLjrIuXwQgtdhVp6dM9pTxTSdYHIHgZYka1AJxhJpIcTRf9fC09oM2h4fK Ax0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969343; x=1685561343; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=XsW4UF3I9Owzkxgp/P5yC+SjWpZgMFYeTNf0VPdabR6tPVSoxJKc+5hcNSHoFaM98t VvQhIs/CFJyg2G4Q0YwGfG161YQXuN4BZFU4E5PKlaQVlRq9zqa9RBOVBSGSwmU0VrfC /JYACyR9twm4tihkWg+zvXA6OO0GHIz/Qs6+001E+JG1zBfOngUNFP60bl2VMGqlrupz 4bj6+i/ud41eHz+DJ3FCO6XDvuRxEFGFY9cicyn13AxRfYo39PxmaCZByN1T0SUS5/kO kwQaVBqodaoCIE7GKFy1+G5KfzOBrhYRlNLNKspHs+arzdBf6hkNXS5bWYEBTqL5TO61 0wqA== X-Gm-Message-State: AC+VfDzA7L1Un+8MT+3s7PLJTuVT5KnXy6NRJsZFOLxqxw6UHAwz5zXv lvp4ZMPc9dNYzQ5ORaL7oFI= X-Google-Smtp-Source: ACHHUZ7gDAee3JEsjrpH2Z6atN7OAzqWZ2l6e0m4gqF7AbuDA0ihHMvj1UGUNCCunfz91CTNrFO0iw== X-Received: by 2002:a17:902:e547:b0:1ab:8f4:af3a with SMTP id n7-20020a170902e54700b001ab08f4af3amr217267plf.39.1682969342957; Mon, 01 May 2023 12:29:02 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:02 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.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, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Catalin Marinas Subject: [PATCH v2 20/34] arm: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:15 -0700 Message-Id: <20230501192829.17086-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: isge3toaap584ppq7p9rzzpwxap5pe4j X-Rspam-User: X-Rspamd-Queue-Id: 1DED3C001C X-Rspamd-Server: rspam06 X-HE-Tag: 1682969343-51189 X-HE-Meta: U2FsdGVkX18ZvuKrFxwqvKN6KnrRLYfVdKpLpko52mKCEAruS8fIGHpQDs0J96j7PFBHEZzh8sGwGH6q8SQJtS3IrrHcHF7dals/1Zkt0NN/EpnpgjfKZL5w/vjFA0H+x3+9rhL5FAlPogmdAu83z7Erx3ZSrbjBf27TnCnp+t5V3IvXtmwPyZvtHfsgf7N/MnJqTlH7H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GdirwxW9PFFdu6VV7lWWWdKvGPOLHLBsDlW7+/6yCLUnYDmfaqZxU6JlGY4gpVEwVM7kJSzwShaywgkPuAI9THwB8NEUquFOrmKsUwWHX8FHYmiNgol0lA8UK8mNf/dT8vSdeBr1iYnQjlOfcZ2Cpb1AemXx+FacFbWHImc5fP2K3mJ0kOmanBXA5Qdxh/ZGujPAsSGSSqYPTLIBQKJYqlTV23l8+JmHH/DfmVTL2OGyaQCUEve7e78w== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. late_alloc() also uses the __get_free_pages() helper function. Convert this to use ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/arm/include/asm/tlb.h | 12 +++++++----- arch/arm/mm/mmu.c | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index b8cbe03ad260..9ab8a6929d35 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h @@ -39,7 +39,9 @@ static inline void __tlb_remove_table(void *_table) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + ptdesc_pte_dtor(ptdesc); #ifndef CONFIG_ARM_LPAE /* @@ -50,17 +52,17 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) __tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE); #endif - tlb_remove_table(tlb, pte); + tlb_remove_ptdesc(tlb, ptdesc); } static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { #ifdef CONFIG_ARM_LPAE - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + ptdesc_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..7add505bd797 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -737,11 +737,11 @@ static void __init *early_alloc(unsigned long sz) static void *__init late_alloc(unsigned long sz) { - void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz)); + void *ptdesc = ptdesc_alloc(GFP_PGTABLE_KERNEL, get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !ptdesc_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc; } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr,