From patchwork Mon Jun 12 21:04:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13277361 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 F02E3C7EE43 for ; Mon, 12 Jun 2023 21:05:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 292C7940013; Mon, 12 Jun 2023 17:05:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21CDC94000B; Mon, 12 Jun 2023 17:05:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 096F2940013; Mon, 12 Jun 2023 17:05:23 -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 E061394000B for ; Mon, 12 Jun 2023 17:05:23 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BD77FC02BC for ; Mon, 12 Jun 2023 21:05:23 +0000 (UTC) X-FDA: 80895326526.16.1CA28C4 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf24.hostedemail.com (Postfix) with ESMTP id CE3A0180004 for ; Mon, 12 Jun 2023 21:05:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IFfUm1+f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.178 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=1686603921; 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=g0EDlTBepFAIScUxyTJ+0DyGhEsxHu6BpoqqcqVDYAk=; b=y/5j08n0q0/E7EIG7eh0kRvCW/J7JA74m74Qo7nO2+b1Vc70ECkkF2Rw+PjatUuuNLhxCl Y9iPc+QkGxLK7jVL4om//vJ16pG4uQR4QwjGhlzqv1PG1kVBYTge6+Ut4gGNAsnIHcLCAD mbMTyQAVJrEg1MNhvj2nhreO9QvFu9A= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IFfUm1+f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686603921; a=rsa-sha256; cv=none; b=qtlFTwlF3IHVh8tkwhQj//KtJ6V6TPBRcVCe+Uj8IhOYUsSx3/rLO6kI3khApZYo6kyYE/ FdGUHARTX1aBby0px5sNfnX5uWGiiVGIVrXSELBF5VqoXYsfAPlp0jyiUAyvonBlQBdwpA +uBnZtjcqrXhx84zTW5TZlIaBtrNi3w= Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-56d05daf0d5so24882197b3.0 for ; Mon, 12 Jun 2023 14:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686603921; x=1689195921; 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=g0EDlTBepFAIScUxyTJ+0DyGhEsxHu6BpoqqcqVDYAk=; b=IFfUm1+ftG1PYGDw7tHBzE4M1Nhxz2Opk18euBEqp2TKE0D4Cnor8glDaNdtYk7aEB /p/Um9wv5HZTulnWj52wM35aDfNBl/ytfQFn4qb8JI1wJsBdYyAcznp6tmoi9yCEZTm7 6pQAvSomQIY3zNEbmIOOm8oH6Wd3RhBVMaDrx4Qr1kynuYgoQqhclVeZehoeR5dFX3Yh JGLwwIfiiLg1ZgDpiJ2+qexN79hRp9c58wCClWfHqZpqGEIFqEVYYyZ/M7/EBo0JZHfV X7pxIQ4C9tp45dXnwLzutma1CHQaYyRI9+M4KE6SjIRg2r7sysMZZ/ZFUWnSf5TI5T17 f1iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686603921; x=1689195921; 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=g0EDlTBepFAIScUxyTJ+0DyGhEsxHu6BpoqqcqVDYAk=; b=gED5VwLAsatM7hyT4T/1DkA5ip46Aac9sschhn3uhemSxHvsyWnGRIRu4GLuttZvwP QMQ4gOjLtvyADRBqApTUShIrGOdd0ECHEyOb5JnG6LSSZ9/veZ30jIY4Enm/9jlqM0Cr b93/jydRbH+zuptvwmNv30ZvQIFtJ/n+6xgbnh2dJ1F8CGyJTH0w3cCYfSZchDDfvMWi i+XeOKpq1gHJK3i1g5/yAnhMrZlxhy2yUEU/QmcG88OKgsZOYG2h6ScgID60+E4uHtPu m55SySTqF8ENZ1cPa60+8TSl028Bb77n2Gj+as836WWk8QpM5ksT16w3aGE6uyTjvVIq 1ipQ== X-Gm-Message-State: AC+VfDz2RSa4rTUsvOgEmOducdy0D/hZwkHJ7woqzrbQDsYHQxn8rn6Q yM0uMcWNK31lrJE/08Z6dlI= X-Google-Smtp-Source: ACHHUZ6/5C9dV3qSGDNsxL0eIlGySV7EoNTae+xvT9pHgv1KAJMONnlMXEnOjc9e+m5K4Puq4XMFCQ== X-Received: by 2002:a0d:e2c7:0:b0:56c:f6cd:7b55 with SMTP id l190-20020a0de2c7000000b0056cf6cd7b55mr7963527ywe.6.1686603920835; Mon, 12 Jun 2023 14:05:20 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 14:05:20 -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)" , David Hildenbrand , Claudio Imbrenda Subject: [PATCH v4 17/34] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 12 Jun 2023 14:04:06 -0700 Message-Id: <20230612210423.18611-18-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-Queue-Id: CE3A0180004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ot1jkc5k9x1rpi5j5stp6yb4xeo8pikz X-HE-Tag: 1686603921-198857 X-HE-Meta: U2FsdGVkX19l5No2P/JW1ZFeZsO4Tu5wYLy6T3LqIwhaelNS1V4NGEJXHoj6KUowXJUNJ3LZv8YEtoL4Ax/PmMm/pDx455eBH4cL8dYF03EIropAQHjamxS185qOsUSIsU88SJJDABSN//JZblsYNKEQ2Rgc8BR+v84bJNajl3sMIoadDp50bJWu9oKN3edrRW6xWQUNkD9vTLasHYud/lQV/TbcGYHMkw9s/MjK0Sw0LDFE8QWH68VpO2rZgc1gd4htiG7JAAQ6R/5z3MCsX1k70MqfnqsTXxE3Il9jKmOU/DvsLqc73yTk2QK9g+XCciov8mzGeIBVDKJCL2SSY9N0HNfeiswVv1PISee4cjNGCGxMSxTS2BShclD6dl8tmgW459HwUgewdIDtQ1sWvn65fOMFaupvYU6yYgGafyF8dk9twX4QUTjmOt+7c+i49WgVOReo0FqFVckvzYFk8ldxXxS0frCMWg4t72LbIPBRSsY2RSBH8XPcIGkBGJ4G4ZguwlnUA+SsvocQDZO/AmWFUqvSbqBHDrBGd34MgfR2AqvjDb5exOKD1Hlh7x3K6KF/nrRIM3vXcGfs3mtz5AGpamn/HhWvTSf+Afk0nLluqMFLa6XKB+dyClUDHz94SvLn9ekWssSaup2ccqAArtUscbFKt/qhJqTteNflomDuaAdTZCTs3FtqlUROwdGtv8x6gbV93zkawslQ2RNC8nMNegokn0kwX4mTKeeL13GidXZmV5Oz+nkJ8z+b/Wrz7LZrN8GTKFFWN1UsOd+C166nJgE1YhIlVa3Ii8XWv4D7b+Jl2AmteJJ/9jrTQX9sVIhp9fCtG3D95CMPOWwZRqIwewFtCWjWNmJn2fGhyiD2kvxDRcB/CJ9LMsl6JZqWHiBWncXxND/V0az0RKYEa0FAmWuXhCOVgy96iK0lJU3ltEaUoPQczD2osDS7tcEm1UqZMXclGmV+5g/a5Lo w1yxkb9B LTMuazbOICGOFuIxJ8h2WwUGHeZ9NxU0kqHdpB+GrZhNZEwFXeICapZb/lASwc2cf5YKkt9bMmrsSFoTi9OVcEMbi+IbCO70ckvmYJtJhTS7sjvr1V18/81BvoPXKExQtkKFTL+m7sZIIQ/oEEcrX/YkodcJtfIgSrm0KZ/ba9t9B23LcvpGkgMOcBnXAjN9o8omh1TK91iI6TeqKBL7VZ0IAlxgH8CY8fct662mcKct98Twxqpicx9eTkCj6LzHKIRpnet3b6fkcD5OnDM0jyFkSWENOyr1N31Lwm+fUmlY5UAmFkQSX6cil7u6BDJntClEOeLhW2TNStOfa9/SOUP3LF9CmE4KeRMkak596tAQnIxoEnE5vZ4r1DuvowMTn/v1+pPzzyiCbEqc9RfLvvJ7qkK9FLm24+8fBHUSt/AVt0IREUqQIsfQR7WP3INJpnd3Sr3phh8sVOOfRWrldLcFBD65MTejqPxbU8pKvyXkaudidNgRTizYil/FN7nE+RbKAfHq0nwiQeDS6+7JxPsXnpg== 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. Some of the functions use the *get*page*() helper functions. Convert these 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/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/tlb.h | 4 +- arch/s390/mm/pgalloc.c | 108 ++++++++++++++++---------------- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 17eb618f1348..00ad9b88fda9 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h @@ -86,7 +86,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) if (!table) return NULL; crst_table_init(table, _SEGMENT_ENTRY_EMPTY); - if (!pgtable_pmd_page_ctor(virt_to_page(table))) { + if (!pagetable_pmd_ctor(virt_to_ptdesc(table))) { crst_table_free(mm, table); return NULL; } @@ -97,7 +97,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { if (mm_pmd_folded(mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); crst_table_free(mm, (unsigned long *) pmd); } diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index b91f4a9b044c..383b1f91442c 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -89,12 +89,12 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, { if (mm_pmd_folded(tlb->mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_puds = 1; - tlb_remove_table(tlb, pmd); + tlb_remove_ptdesc(tlb, pmd); } /* diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 6b99932abc66..eeb7c95b98cf 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -43,17 +43,17 @@ __initcall(page_table_register_sysctl); unsigned long *crst_table_alloc(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); - if (!page) + if (!ptdesc) return NULL; - arch_set_page_dat(page, CRST_ALLOC_ORDER); - return (unsigned long *) page_to_virt(page); + arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER); + return (unsigned long *) ptdesc_to_virt(ptdesc); } void crst_table_free(struct mm_struct *mm, unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } static void __crst_table_upgrade(void *arg) @@ -140,21 +140,21 @@ static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits) struct page *page_table_alloc_pgste(struct mm_struct *mm) { - struct page *page; + struct ptdesc *ptdesc; u64 *table; - page = alloc_page(GFP_KERNEL); - if (page) { - table = (u64 *)page_to_virt(page); + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (ptdesc) { + table = (u64 *)ptdesc_to_virt(ptdesc); memset64(table, _PAGE_INVALID, PTRS_PER_PTE); memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } - return page; + return ptdesc_page(ptdesc); } void page_table_free_pgste(struct page *page) { - __free_page(page); + pagetable_free(page_ptdesc(page)); } #endif /* CONFIG_PGSTE */ @@ -230,7 +230,7 @@ void page_table_free_pgste(struct page *page) unsigned long *page_table_alloc(struct mm_struct *mm) { unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; unsigned int mask, bit; /* Try to get a fragment of a 4K page as a 2K page table */ @@ -238,9 +238,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = NULL; spin_lock_bh(&mm->context.lock); if (!list_empty(&mm->context.pgtable_list)) { - page = list_first_entry(&mm->context.pgtable_list, - struct page, lru); - mask = atomic_read(&page->pt_frag_refcount); + ptdesc = list_first_entry(&mm->context.pgtable_list, + struct ptdesc, pt_list); + mask = atomic_read(&ptdesc->pt_frag_refcount); /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible @@ -253,13 +253,13 @@ unsigned long *page_table_alloc(struct mm_struct *mm) */ mask = (mask | (mask >> 4)) & 0x03U; if (mask != 0x03U) { - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->pt_frag_refcount, + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x01U << bit); - list_del(&page->lru); + list_del(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -267,27 +267,27 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } /* Allocate a fresh page */ - page = alloc_page(GFP_KERNEL); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - arch_set_page_dat(page, 0); + arch_set_page_dat(ptdesc_page(ptdesc), 0); /* Initialize page table */ - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } else { /* Return the first 2K fragment of the page */ - atomic_xor_bits(&page->pt_frag_refcount, 0x01U); + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x01U); memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); spin_lock_bh(&mm->context.lock); - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); spin_unlock_bh(&mm->context.lock); } return table; @@ -309,9 +309,8 @@ static void page_table_release_check(struct page *page, void *table, void page_table_free(struct mm_struct *mm, unsigned long *table) { unsigned int mask, bit, half; - struct page *page; + struct ptdesc *ptdesc = virt_to_ptdesc(table); - page = virt_to_page(table); if (!mm_alloc_pgste(mm)) { /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); @@ -321,39 +320,38 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) * will happen outside of the critical section from this * function or from __tlb_remove_table() */ - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&ptdesc->pt_list); spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x10U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x10U << bit); if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); } - page_table_release_check(page, table, half, mask); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, unsigned long vmaddr) { struct mm_struct *mm; - struct page *page; unsigned int bit, mask; + struct ptdesc *ptdesc = virt_to_ptdesc(table); mm = tlb->mm; - page = virt_to_page(table); if (mm_alloc_pgste(mm)) { gmap_unlink(mm, table, vmaddr); table = (unsigned long *) ((unsigned long)table | 0x03U); - tlb_remove_table(tlb, table); + tlb_remove_ptdesc(tlb, table); return; } bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); @@ -363,11 +361,11 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, * outside of the critical section from __tlb_remove_table() or from * page_table_free() */ - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&ptdesc->pt_list); spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); tlb_remove_table(tlb, table); @@ -377,7 +375,7 @@ void __tlb_remove_table(void *_table) { unsigned int mask = (unsigned long) _table & 0x03U, half = mask; void *table = (void *)((unsigned long) _table ^ mask); - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); switch (half) { case 0x00U: /* pmd, pud, or p4d */ @@ -385,18 +383,18 @@ void __tlb_remove_table(void *_table) return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->pt_frag_refcount, mask << 4); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, mask << 4); if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); break; } - page_table_release_check(page, table, half, mask); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } /* @@ -424,16 +422,20 @@ static void base_pgt_free(unsigned long *table) static unsigned long *base_crst_alloc(unsigned long val) { unsigned long *table; + struct ptdesc *ptdesc; - table = (unsigned long *)__get_free_pages(GFP_KERNEL, CRST_ALLOC_ORDER); - if (table) - crst_table_init(table, val); + ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); + if (!ptdesc) + return NULL; + table = ptdesc_address(ptdesc); + + crst_table_init(table, val); return table; } static void base_crst_free(unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \