From patchwork Mon Jun 12 21:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13277364 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 E3B74C88CB9 for ; Mon, 12 Jun 2023 21:05:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E29794001C; Mon, 12 Jun 2023 17:05:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2940094000B; Mon, 12 Jun 2023 17:05:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BF9B94001C; Mon, 12 Jun 2023 17:05:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F21C394000B for ; Mon, 12 Jun 2023 17:05:29 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C1BED14031A for ; Mon, 12 Jun 2023 21:05:29 +0000 (UTC) X-FDA: 80895326778.14.DB704BE Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf30.hostedemail.com (Postfix) with ESMTP id EB2AB80015 for ; Mon, 12 Jun 2023 21:05:27 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YRMhLn8G; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 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=1686603928; 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=llblHDjuRzdwObovgJjTe//ioNSPoyRpZegKgEWGdOs=; b=pGA3OBD4uNO1gQn57BKFD5ZuvVBNjE4TQvdZS9ScgZXw37PEj7q4fqwFPvXjX7hSRkqoqf eiivP9AcFeh4Q0XhV/WkajmlCdzTn9CeiHa9AABPgFdHhjO5L1X0oz0tRqhP8J+yI8YZ6Y Ysug6I1EQT/8g+I8hUPiA1cdDMkv5cM= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YRMhLn8G; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686603928; a=rsa-sha256; cv=none; b=THS7+w9Rl4JKpsa1C1VzQsTQiyDNhB91o2OdZB7gdx9NOB0ktbG0DOsLO30Gd+dLdYTwSe B9URxhYqjpKJcMKuz+G2v13XVTP3IEVqqI2TNVI/RbR1na/yxKyWOKLsINjSuqMPUKQqk7 nMajF0mx2v1h4yK/Uybn/lDBaXjnyVI= Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-56ce88ee294so19028067b3.0 for ; Mon, 12 Jun 2023 14:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686603927; x=1689195927; 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=llblHDjuRzdwObovgJjTe//ioNSPoyRpZegKgEWGdOs=; b=YRMhLn8GgjXKF9eS1CkYK8/hVT9gPYz37UeBHSWCXWxsEKTB0xKNbO9xfoQxJLGBci pUYRlNAXxGNIort4RFvyqFoVkx12q+4R5GQ2T6iKcv07wKy7zihyGs6NzbSMSMCL6Rs5 mHPuU0pXtsap85DxLGrKUtMBDvnEahRHLKEvKQOX7bhc/KG8s8E1jIJIjYHBV6Mzo8Tw JyoVIgOoI3Qu3/9ICO4yd0mqp02BwnCK/YCnIHcpYzONCtiWYcoEWw9YCE5wOdJRn8uB XPcLMuecwthMMTL6YQJ8OIdeoFxd5Ul+5c4RpJemAGRzK0WgBz8keleyqJxUgTeZRruD CsNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686603927; x=1689195927; 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=llblHDjuRzdwObovgJjTe//ioNSPoyRpZegKgEWGdOs=; b=gmRhOGnukchnfstoQ3FFILtTQMQTqShi7cQPyQktmHaoRaBtn3mLS/Bq4MWlsrlNz0 5s8YaYlpuJEunjjd8mX6iWH1FrJXFFo4SbvaCzQ9QrUPP8siWE1SE4DPYwgoaB4FEAeJ D+d2nE7nG/018gI31QCJIMx7P+ZvoRKEsQpDcBFxJpfgdb07wlNajoHBn/wA+hjUbMLm 64Ne9FS4ug/j/cnByA4h1BT93NKv+kIZEC4ms+ksp9vrzfAqHBr1PNBGSNmelzrxmdIL 3yGhH5H1vge12ResxZgFYId6g0W5OoOo94duHgarQaygX2SivLDKgPm66EB8tHlh+QSM Ra6w== X-Gm-Message-State: AC+VfDzBnnRNo+DsGtYMG+5abqWtTYHN+qCNuSXSUzruWlZbjVABZ4xx 6PJ+N98Ej8ObuG0jx9qwbHs= X-Google-Smtp-Source: ACHHUZ4ft3mDxgWWbZVZ6VtJGRUVYiTphgdB2NgQzT9U5dEGnrQumf24dtXrB3QCjAsLfMmACVzxzw== X-Received: by 2002:a81:6d07:0:b0:56d:29a1:c1c3 with SMTP id i7-20020a816d07000000b0056d29a1c1c3mr3804535ywc.24.1686603926795; Mon, 12 Jun 2023 14:05:26 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s125-20020a817783000000b00569eb609458sm2757115ywc.81.2023.06.12.14.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 14:05:26 -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 Subject: [PATCH v4 20/34] arm: Convert various functions to use ptdescs Date: Mon, 12 Jun 2023 14:04:09 -0700 Message-Id: <20230612210423.18611-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612210423.18611-1-vishal.moola@gmail.com> References: <20230612210423.18611-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: EB2AB80015 X-Stat-Signature: ezbx1puszf356j6hswisftqjdbzxmjiz X-Rspam-User: X-HE-Tag: 1686603927-29742 X-HE-Meta: U2FsdGVkX18PkjNK2k3MPidw6OUW0p3dplF0GtpGSNfuBDZIldcXp3lDV6FiyjzIq1sWQti7Z6xkWbN/xk9DGdrdTyw7Im7/nE5j7ouYIkJwTqDQfov8HekGx7PKUWgw1VyQui0heuocT/kRlZkZITfFEyrRHkxvrgALYyRPYAAZHMTu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Gmso+CtcZdiUR2Uu7z5qrtPcSU5dwqDXMsZIZlrHnOg5gwHZlyytErBqwH+MXm/Bg0M82X+PzT5OCDHcT1R0N0arlAvVU/IqnVZRUpIV3NH6l2j+4+7FM2SHw3YbLgVz6uo+3jVd8GssCoyo0CxWDmvhJphptKSiaaOW1nqsBDYfBZssFu0iiJYFhHyyNvBQ5ebJX14xBGI/4V783kKvKJHpx7wPJogkVZBlk5KOLX8G3AtwqkOWWWNIu14uu5C21jYhNE3q9kg== 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 | 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..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 22292cf3381c..294518fd0240 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 = pagetable_alloc(GFP_PGTABLE_KERNEL, get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !pagetable_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc; } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr,