From patchwork Mon Aug 7 23:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345301 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 26B63C04E69 for ; Mon, 7 Aug 2023 23:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9C14940016; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4A3E940008; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EB02940016; Mon, 7 Aug 2023 19:05:55 -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 90F3E940008 for ; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 68A171604C4 for ; Mon, 7 Aug 2023 23:05:55 +0000 (UTC) X-FDA: 81098843070.19.1F1F897 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf15.hostedemail.com (Postfix) with ESMTP id 886B8A0021 for ; Mon, 7 Aug 2023 23:05:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mEF5uAs6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449553; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=fbrOM7ZfYlTPij4FL0ieY/KmlRg9I8okPfFAwXPbie1dfkVEG3X6jQyfbDNNlSn5ygW8J7 nccaQOKAmXZ017cN+xyp8Nj0mze/NaIL6Aci2oLjUjiXJ13kiZTR3KDQRHTM3/F5OWfb1x R4LBm9dUbyFTrpGlZLx2X76i9+H23FU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mEF5uAs6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449553; a=rsa-sha256; cv=none; b=q0ZMLKqRcD+FeQCVNZNvf2VBfNyTSehodazdPDadG33lY5Ask+sfstPbKo32rX9SxsFHYV mLf3p3DKrDzKrrZUsR3TShyjHuILyvs1ZpvSGSFxz2N9reATTld6XVkKmNKmTB8SqErZNN r0K5GpE/XMRIc1tfYtaazztdF44lHv0= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso5465351276.2 for ; Mon, 07 Aug 2023 16:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449552; x=1692054352; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=mEF5uAs6LPH63FkNSBplLFspkb60DHxm6zOnUwvAQJc3E/pOwbhAIiNFZBUYHiCsiM p2tbQp60CKHpnlFx92kmBMq0iICGLFKDwXQ0LyWNPB5CTFYLszQ4c8mEuzgfzEni9mwM Ttmf1qUiq6AjtyU7518jshwfi+pChbC60Sh5kSbXAB+lvEOcHSUd/ZfP7MFS2PgNjGFo r7Bvb+zEwdMz3ovaFVdL7n7AY1JJbQH54hsJVFdRCSvSwoDtl5zIXSCLg5x4eEWrxL65 mP+yB5DlcuhDlbUdEBdiXWCJptk41KogbXQLbDgKd5NU/tlto4itztjaP5et2Hvpw0rt 7VEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449552; x=1692054352; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=hNhP3dPnE9vx/Wxucz8VWahibQm1UEPwy7mWMduGnJPxWq1GPZ3cR+LG+RY3VqMIaF 6T8EPgpmE9zdNAUe5m9FDkT1zJioOSTJZQFxvm7iTB8OxEfuFP/xz3c0qFxfhVSNfLdi kuw64fp8s8Fe4xZ9qjsqBtWZVSURxSEFNZUogY8/wXotGb+6j6RZp7KriRPOKntYXM4h vzCUOhJCYpXHNz8y46tz2IyrdnfS054U+4OeVovoXKVrj/47rFMeVVuprzKGK0sAVAu0 2WMFaqKXptwsLVyDmeJM7/BOETWhzd+D9Qb6KDRZ8G3t9Q6xFqhV0QsTM51NQ5C6qcTQ SItg== X-Gm-Message-State: AOJu0YwgXawTtKhitQVAN7lfm7qfRm1US47qGttf+jZkoBRk4v9rh/xC obLK1Cgyef1c67PaeP0sYu4= X-Google-Smtp-Source: AGHT+IFZB5AVL/MxN7IM/ds0EZn0mK90E4BWht9Xyb7zBcTjMbr/Qp8cCY+l+/2imbi83tiWiC1i0w== X-Received: by 2002:a25:4e05:0:b0:d12:3108:f90f with SMTP id c5-20020a254e05000000b00d123108f90fmr10423741ybb.24.1691449552662; Mon, 07 Aug 2023 16:05:52 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:52 -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 v9 17/31] arm: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:59 -0700 Message-Id: <20230807230513.102486-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: sx16mbxadkywnykhfixnfqosumtx3xhy X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 886B8A0021 X-HE-Tag: 1691449553-54854 X-HE-Meta: U2FsdGVkX1/QqzeM2ypYbJ9KVL9zKcJfQAch6jxRzt+GTeBS5S56Hgti1jQMp4YIp1JOCeuyCRlKKSx2/AQAG6bIpPtSTHcb3Akx6qtk87OfYpTrxesPcdi+siergtZixMGJOqIdx0GVZ4onT5pmR4A9eNwG5mDu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gQCLn5e30jsQ2SjtNjXaCfMYpbSrJYLA7VbF7hNHvLrO+4hBoDnOIcuEDybFR/X9Iw8ZdmRS/XgOs5Ljyd3SdLeWAa2kgPV/9pXqP532vxBpweRAk7I7KUaRqklZZ29CiV/ySSHvTHJyIjjpbQkO2Zhia/2O2F4J25Nf2pZw15PyYaleE/R+2kWXRyvTKbMhJ4leel3AqDRlG0Kl8jk/dlULJ/BDN9R/Wev8ay1SoXArpDUukQOtNIVL11LqXlsbGKU2k7+Ycd6947SFtQXewgfapGg/jTncnVMbutBd7hmkY5vWz8+4w2wuL46Lf4uY2Eai1g6r8ZKvPzxOmj7geywOBcIb2csjvFDw/8eHA== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 c9981c23e8e9..674ed71573a8 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,