From patchwork Tue Jul 25 04:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325730 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 11312C00528 for ; Tue, 25 Jul 2023 04:21:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 717766B0096; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C7A86B0099; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51A16900002; Tue, 25 Jul 2023 00:21:45 -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 38CF26B0096 for ; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0EA4580818 for ; Tue, 25 Jul 2023 04:21:45 +0000 (UTC) X-FDA: 81048835770.27.F800F06 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf12.hostedemail.com (Postfix) with ESMTP id 3A0E84000F for ; Tue, 25 Jul 2023 04:21:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YmaPL1Vi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.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=1690258903; 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=jy2WQWHtjd329JxH/5S4Ofy24eqaJInOGQdjFSOFecsh8GC8J6ZBmnmd9lPOLBGao1B5gs bSvLzeQoCs9v6WfGU8beqdlAHfjobdl7hTiIk4kp+YPspxQSDkFbCE2lF6n5In8deMpHRK gH/Onm9nA/EqoOSyzBsi8AWinlxB+TI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YmaPL1Vi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.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=1690258903; a=rsa-sha256; cv=none; b=8VZO8dIiD9vRe4vbE0/wcfyX/C+s+jhme+WENctM7368lrKvABkA3CTlj0rg4n6TEgZseb 8BZSWnlDuM9WXa8Shvc9Iff4UYKbcdSiZmKpgvo1ue+LuVPKoMmxPPq0tKCxpv6MXosuaF UHZraJI6J8lDY4hbSS+LfcycSXO3Ys0= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d066d72eb12so4536209276.1 for ; Mon, 24 Jul 2023 21:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258902; x=1690863702; 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=YmaPL1Vi+BQChOKWGw1MlFqz3AIULFncYrkFnUsVyfilrIdeasoH5GHm0MEpRXKgmq DwC9KwXiAQ3MN8gwuAbymt06/p5z+8sYZZRmtF0QZ8N7W0KJLZlIdtmS/iEXcHfRR9pY 2ULSywNr2+fCENRH3Q/SedxdAZmlqvHkU4bXO0Iy6mLyj0C0e7FNRd96oXnepKXsjgBp DVfpoX3+8pHS5yXYZY0DswmNPSsrKwOikBQLnb77xz8k9ebKbrK+QxqOENWwGszD02R4 u3nvQUFC/AuDK1NFsePOhCwUQCv2T+yjXJkyc6tTHY68z6Qz4nIbLO6jQDPO+Xjl6VQM RJag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258902; x=1690863702; 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=RqBfGL6lBAhB2zPTDaAZ7MLhkF3Qk34yyeXMI3amBFc/+cQ/PuHgfeyPDqQEIE7kVZ cujJnYySKGmz6STdxlBh/ofBp/4nIdjQfJkepiLnRP3PYQ+dpbaZgbSSeh6RUzQ1trWY /N+2iz8NqS58TYg6P1p+QG916KsNWfA3DP3qMguDmlTTm3AG8ljiMLkFZltyg2PhwiPp uB24ju8y69TQJtVVZ17UvH/RsLnGhX2E8ub1PVWgG0KCAdmf0T/Tn+nU2y38t5Ob8WVh G7RCvSp5TvZ5eYzC4+f9KKVDB7SD5K2TQ15aBHW8SmjOlEIDXu3Cs2Tx1luqT9CgVnCD c8FQ== X-Gm-Message-State: ABy/qLYPBSJa6nLwBgvAiRwSLyA3pO7j6CDWy7ddDrl8zynoX5xnGY7Y 5pXoJIQLw/e3MWet3Bisd5o= X-Google-Smtp-Source: APBJJlF19R+0iLSXwcqdh2p0QPj8gjsaDLf4/piQLSANpJDw+A6xil+mrxUfv/BGU2XCVUHQZlpYDQ== X-Received: by 2002:a25:dbce:0:b0:bcf:e2a6:7085 with SMTP id g197-20020a25dbce000000b00bcfe2a67085mr1287878ybf.23.1690258902247; Mon, 24 Jul 2023 21:21:42 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:41 -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 v7 17/31] arm: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:37 -0700 Message-Id: <20230725042051.36691-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9qjspnz3uyhgq1p8sqtgcucu9x4k3spm X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3A0E84000F X-HE-Tag: 1690258903-996400 X-HE-Meta: U2FsdGVkX1/VTznuTCJA2kyovbQ04zJCv9IniBw7DnryrFF/BabqX0LSzcazg3R4nlQOqGyMEaQE6tlhU0RRl4DzMyC1oVqbYfGJaykStqp9m6A8DfE2t/RENrkNWW8wzTUhbzr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0S4WUfaGyrPs7FuRVvffKA1mlv0DRX017/QT96Dqurd/RTVkq7/DmP07Ytgo9BhP9i4rEU+dYfiEvswUbIOWfGYT4r3kT1uYwplAUox4pO+5y1h6eCBXOcD2PqsAh4GhDUE7hjZ+sxvNAdbhNcIB4BHEvPO1tOhOaZvEXEbSvmyHGi9yYo7ZoVeQoeMN+JKrpa5F4FAgr0iU+f2f1FSl/gZHXSJKJxKuuOOqW22qgXJ72lAQtHxTowfa+FLWzwY80bYN95f4DQSqpl/tC/Io9mScuO3HptX+ecJ1re0s8fyLxLqB1RkXT1yDRk4HRvo08YdVBuvoPLwrQNnTimupKJ8o/q4hNv+QZvUY3UCDFA1DWIHtkDT4uTTSiQA== 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,