From patchwork Mon Jul 31 17:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335116 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 60A0CC05051 for ; Mon, 31 Jul 2023 17:04:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34AA96B017E; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A9A56B017F; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 124106B0180; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EE44D6B017E for ; Mon, 31 Jul 2023 13:04:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2E1E140BBF for ; Mon, 31 Jul 2023 17:04:15 +0000 (UTC) X-FDA: 81072530070.28.EB1507F Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf19.hostedemail.com (Postfix) with ESMTP id 34EA41A001C for ; Mon, 31 Jul 2023 17:04:12 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=S9WpMAU4; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1690823053; 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=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=AGAtfJNy3uOtgn0O7cRVI1z+VU+jcC+dwBhgea51rKS26KlWa8F2D4ksbpXCULRB8fIZrv T6TDIJNkOGMC9savqbTpTJ8g5jHj8Soyv77IETWG57BE4JlZQV6iYR1H0Up4QkTqPFQXNL E+OivNQ5n61JmUxynHUCERO35tSe54w= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=S9WpMAU4; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1690823053; a=rsa-sha256; cv=none; b=60bSXfhSQml8gfzTYJiuDTWzKTrIpsnBG2VqSKvoXZqarkU39zYBQkOwdVqSnWsD3yoP4e wd4kewmz31j6w+mHr/R8gW9ormrkXkQUpa//TIX+DmZvBf9s9aSfBPKDtNvFr2iQmHGf0I JO0+5VLPq2aBLBV8fL/Xras6PMryr4M= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d0728058651so4980562276.1 for ; Mon, 31 Jul 2023 10:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823052; x=1691427852; 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=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=S9WpMAU4z7s2Ag9JtWlTuDFooWQlFyPv89tIlGGSbz0E38KMeV4JUqyRKP7B2mlsst 3/F+7yoyQbv3i3KcMwuVSsZv9i7LAi+BdMh8bqQ1OIkDFwNfq0t6pWYwMasYC2CpjBTn bovNcdPK8kmT56us8VfFMktVF9KG2tmTn5UTLjX+ZXj2DR3oFDYqVFA7hvTFAXfeR6X5 Q0VEEuNVDIcDX6dTwPvkDuk+ca9lyAO0oa7PZRgQNSWYVbj0QEi1SCUj2cu+UiTNTCrz l0MpQh+abPw7+Fj+nKTUpgwidBjEPvlqq0Mg8+dCJJ46uHZsBMSboAizdy+gmVRglE/z 7Cpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823052; x=1691427852; 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=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=QAm3MpD35q52zLcMKztOhE6SYvryzOjVuJYyzJekyhGlvu/jKZJEtY08sz1MtHkzFC KdN4Ygsl3Cv7ZYOg8kXxu/1/2G7y7I+Dv/YKP7OmkuyXdAEjdzXh7dPwDDDYVhQlcDA/ ugPaH2CmpP/GpD6rQBpY9XPw25sxPnoic0xq2YvRyp1dLA8fHc7/ahRUZQwX9xab2TZG EkwW9jGt099hh3lPxutXjZU3lrPY3YPt31JsAeGmVl27HpwmCicoMFLDBUn3jAAsLzN4 oWkjoJy7q30S77YdLRlmQtjIvh/+vLo6mlRh9qJ3ZL/Okswx8HDiumxxzMsFj65vdqKz 1ytQ== X-Gm-Message-State: ABy/qLaqG2LscjKKlK05gfu2EZZy6hnvUsZWCxyM26Ard1JqKBw+st4Q FVR/Xv9hva+bBpjBe7JdJp8= X-Google-Smtp-Source: APBJJlF45VM+96NADPgQk/bfcoyXe13svaytrCoN6xBKbPq7ENGGS7BXy6U+VNxQQfsm+MAmj6JoEQ== X-Received: by 2002:a25:b296:0:b0:d35:cfa3:cbde with SMTP id k22-20020a25b296000000b00d35cfa3cbdemr1080223ybj.38.1690823052039; Mon, 31 Jul 2023 10:04:12 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:11 -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, Hugh Dickins , "Vishal Moola (Oracle)" , Catalin Marinas , Mike Rapoport Subject: [PATCH mm-unstable v8 17/31] arm: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:18 -0700 Message-Id: <20230731170332.69404-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 34EA41A001C X-Rspam-User: X-Stat-Signature: 3snfnsmf7uybzi3bh1awi3zjs46rw189 X-Rspamd-Server: rspam01 X-HE-Tag: 1690823052-703556 X-HE-Meta: U2FsdGVkX1/lYAFWb3OLGRAVXpsTbG39SOsuTA2Dl/XoCYUURpTt7oKGUDgClkbjpjjppLDS2j2iAZ91L7U14b8E07Y8I7Fj3udssnR9HE1Z5iF5HBQNsQtAIe0v4AbBTq/7H8pFXukQ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u41JJ5uaRbvQzwO6KVJzHBWSnM8C8SYWgojTM3IuXSS4oy8QPnftFSQqr3bT5uylOCF3Kc+Y8+dQsT3uLsVUHWEBSf6UZkXlLKTzfYDUBnu38AdLHxNFLbvrOKsHDq3MNzi63Bp6r3NTFmzvM4kviBqnbJihreKS8OFjGrvoc9a5V7rm8wQxY3DHiJAykupMi4RqH2j+5GuNBQV0xi+GQtrnFR2c4zu4F4g1P1D1fiVSg5BKeV7J/HTg8PhkN7rqe/QTSEe3q5VMSbyDTjezNFgRFGkgQcG2O7d854gTpuM8cvQ8zu8HePIzugd/nHWSTi4dd+wDsC0/Wqs2r7gh8HBBs52cFXFsP3LxvmrJT4MpGtphXx0C0yiRxw== 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 pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/arm/include/asm/tlb.h | 12 +++++++----- arch/arm/mm/mmu.c | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index b8cbe03ad260..f40d06ad5d2a 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); + + pagetable_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); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 13fc4bb5f792..fdeaee30d167 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -737,11 +737,12 @@ 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 = pagetable_alloc(GFP_PGTABLE_KERNEL & ~__GFP_HIGHMEM, + get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !pagetable_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc_to_virt(ptdesc); } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr,