From patchwork Mon Apr 17 20:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214560 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 AE7DBC77B72 for ; Mon, 17 Apr 2023 20:52:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 167F16B0072; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 117C8900002; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFAC48E0002; Mon, 17 Apr 2023 16:52:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E0AF16B0072 for ; Mon, 17 Apr 2023 16:52:50 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B50F540676 for ; Mon, 17 Apr 2023 20:52:50 +0000 (UTC) X-FDA: 80692082100.19.7BE04F0 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf24.hostedemail.com (Postfix) with ESMTP id DF05D18000B for ; Mon, 17 Apr 2023 20:52:47 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FAf7Q7K9; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 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=1681764767; 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=iUQ9/pimfaGXNi0CjQ5OYjWOczKCpE//S8xnkPc78yU=; b=xyjZ83lzlRclJ4eKOUeBYA6ET4sS3XBaA+ejjJepPV38HVK1gY1COskzEDzRymrknrNs/2 AmnFLgObuXq8RL1qegrcNcqSGMBaavw3QZKwY5CmxI804RmzV5aB+b0zGMAOup866ntH/s K3kDYkEU0SBIbLtAhwBI+UhZe+JYK84= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FAf7Q7K9; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 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=1681764768; a=rsa-sha256; cv=none; b=v2jQ8qgdzdaUjhrHq0qpZwKEsFRF1gildiOp9Pgc3kjWFdAzc0rEyPMiuAXCPEskcYS7Zx yUwVQHxFKbplk/LujfN4rOP0Nnnlj413cC3Bi+SqlWwmhOjzHHPWjXhLgM3SHO32Xn9FdT tbUmNKgthnHvzpR9R2IGVB+GhzTaB6Q= Received: by mail-pj1-f44.google.com with SMTP id x8-20020a17090a6b4800b002474c5d3367so9748339pjl.2 for ; Mon, 17 Apr 2023 13:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764767; x=1684356767; 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=iUQ9/pimfaGXNi0CjQ5OYjWOczKCpE//S8xnkPc78yU=; b=FAf7Q7K913ZX6r/eLsy+yAUsXKMRxOHj1fLyHB9UIaactpRsuyZTxwm6yr9/0kHhuJ 4Vp9zU5n5/h6vSIOmrhOIkQhtsXJjouneV7ATDr91jNlm1HLz9ERQ9iZEYmxf7IWZXzO 7Bjl99gPzEex4CTscD2JLBVlVfqL8/78eXbRp1C2OSneg1gvPPXFUCS8B+INtmwbneb1 7xu84pfQjybA5JWgsxDb5XtXBfw3JMpB/K4/MrDjwMi52JjctUf0w80qqRetA0UVkDY9 /WMnuBxaObETeplAy+OYgYm1cMdR/MAIyIhp1m3TGneur/zdkE7Srlujs8An47+1uBTa DS5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764767; x=1684356767; 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=iUQ9/pimfaGXNi0CjQ5OYjWOczKCpE//S8xnkPc78yU=; b=k0iboUCl4zX23lGRqf/sHxLN1HSjsKZk7AgO5G+Mijg2UmwGUpG+JmhT/l2M3iH7Zk soMFljqnguIPBGoPaq3gPh76yf4gcolK6NGBHNaadTibCCo/Ri2+4o9PD4bJgV3gcroq 0tgsqAFiCTkVPeTUCDi1x0kfMOXpQkyB08Fqvjn/huHC2hq0e735THBgRksNZ8foeNeR Jx9+EqB9CDnHzaEXZttDaax/Av+4UXwVFa5jrSdIOtgNgOC2Nf+CwF1cyNqR876bslQR BR3+Dz9lMmfCgXFygjIPDqnWHjeTV67VNB7RIFc6PUHYjVzCd/IVGVatl0TutWcLhW1d 0GmA== X-Gm-Message-State: AAQBX9d/EmqAJlBhv7IBrchEy4tla7euKqhz3CBhocywv28tss/PxP4a KUXBLaUeNq6Tnv/S5SyDDKg= X-Google-Smtp-Source: AKy350bJ+z7DqyQlo/Tq9sm7RhBTmVNaq1jAeXkgM2fHwXUjj/5Rwh13YNUG3IxyilUJQDR+HGgjBw== X-Received: by 2002:a17:90a:e642:b0:247:83fe:12b6 with SMTP id ep2-20020a17090ae64200b0024783fe12b6mr5579845pjb.43.1681764766744; Mon, 17 Apr 2023 13:52:46 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:46 -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, "Vishal Moola (Oracle)" Subject: [PATCH 01/33] s390: Use _pt_s390_gaddr for gmap address tracking Date: Mon, 17 Apr 2023 13:50:16 -0700 Message-Id: <20230417205048.15870-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DF05D18000B X-Rspam-User: X-Stat-Signature: agkwfz9xgr1d4zeasjffg5emsfidgpxs X-HE-Tag: 1681764767-99675 X-HE-Meta: U2FsdGVkX1/mnieFcaCJdT8pIJsiwN+8DC1t3bM7LHEzsta11co+vTlibnkhJtp0P+ymjPMWeUOclhX5gnfvPCG4bOiCF3ez4ToAmw3zCsRPzq6M2/IhQ/odmjIBWTlF112xP4xFy17sB6KZ9wJcCWJbUmiBMZZNWF18k5ntvfa1GHYXC9XwgeQcXz1w4T/tPy7gOcmP03Y4Fw3cV/SPq8ZxxDid0idESRwIPkTRvl2Sqg12Ob3Heugx0FhXpYLv1/hz9kDBY7FS6ZBj0zlTtFZlstWLMpiZdSurPQWMD5thQF7l7W51rfcQDLoGSGc7F4GWQ5rOduZVSVKikcGnssMOJa3UntpZd3bILy65v+WWTem/5eFSIHK2i7AU4pmLnMLYM+nRXOPctbyNn6z4x+VylDZzEVDJBM11Qgs5yPfObmC2kAkMQnrLt5n+UoGGMjG00d/YOm2A5HzIyTAvPjaZPHOJJZnmqs9ThK4Wyi18JuFIuH6WDzdZofe9CIDxumd9ihSgsb/1DaxsaQs8mhaHsm79n0KMP12BeFa8pzSdslY+Xf+2nnlMlcEgQwK1fTedJbsQR+FOFn9epTw4FjbyhPmVMJ00UfNqIm2M5JnxDhNQVeMFxHv7hgVMH51268CKW+J0tJBwx1U/X4HdaABCnAgHiNcZMm1MqvkRyWreqa5UttMorKDi6PalPiSZ5VAcoG0aOf29SRMSDyjIYVNaY8T9P24LiJlUaYi4gZgIu7MfsHQjd3viqHBOWC2xp540NLHSpO9aLEPJnjzeR2cyiNtavL47+WsIp8xw8dqtJV0iYB+y+9omFlRJLS1m8dzy2QGe/OE51z8w66fod6Fqm88K/b0RB/fD0fX/es6prwDCLQg5jpeijQM/crRhYmokHibGh5f7l9orWsksCMySSpg15SQ7lBgRFxAr9bbOoPZrbc94JyDZq535CYWxcW+7yQnjzI8xAbGso9S qUSStTKI qQRKrA/RP1kdDpnm4VU5KyoqTlexSslX2a/TzjKqoub90x81V4SzHJndJP//0EsmA9HoiprDr79VJB8VOVtGcy+HwEuMTnLtuzdLayVl8tGwXTeD0fCEeieUhtCBxl2mlT4yk3dcQ0oETBKPBKJaHZ8eHrdE9pNG1xKjQTtxE9JN8KJWXsKs2D+1H5sQc0cXXGnLYqZIMe/L+r+H7yVkM4ID4os03nr0hTQ+M0J+RTBIoDwzxkMGNCF0VEUjK+vwwMQY1b0XUe6frvGiM5LIH6aPNcJuycIn9amOWezRGjyfvtvIpdJ90xef9TzuQOdxFM4TAOGcwI61VplINxgCfQELsCDx0yQnvscSSaFUqANGXPYJFcDvXv6QEiIWbaTzGZjPZbmC2DnAG7EFTpzXbHdhMeHvr+JXlttK//9q8A5ShAte6Z9iS8A1OC+pXHL4pU6a8Q3HMbzjPTXR8R1kCyrp9gVE2o0ytPxb2FHtyyC90/dw642mLiGCI5YYqPSBmnwVLETvkwKD+grWtJqG9+GHbUwGQTCMONgv/lNvq57CwHPpCfb/EqE1W6vPGpWkjg7LlyDgG40GNgiFQAR4v7v1jVg== 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: s390 uses page->index to keep track of page tables for the guest address space. In an attempt to consolidate the usage of page fields in s390, replace _pt_pad_2 with _pt_s390_gaddr to replace page->index in gmap. This will help with the splitting of struct ptdesc from struct page, as well as allow s390 to use _pt_frag_refcount for fragmented page table tracking. Since page->_pt_s390_gaddr aliases with mapping, ensure its set to NULL before freeing the pages as well. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/gmap.c | 50 +++++++++++++++++++++++++++------------- include/linux/mm_types.h | 2 +- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 5a716bdcba05..a61ea1a491dc 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -70,7 +70,7 @@ static struct gmap *gmap_alloc(unsigned long limit) page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) goto out_free; - page->index = 0; + page->_pt_s390_gaddr = 0; list_add(&page->lru, &gmap->crst_list); table = page_to_virt(page); crst_table_init(table, etype); @@ -187,16 +187,20 @@ static void gmap_free(struct gmap *gmap) if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) + list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) + list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); + } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ gmap_put(gmap->parent); @@ -318,12 +322,14 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, list_add(&page->lru, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->index = gaddr; + page->_pt_s390_gaddr = gaddr; page = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) + if (page) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } return 0; } @@ -341,7 +347,7 @@ static unsigned long __gmap_segment_gaddr(unsigned long *entry) offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; page = pmd_pgtable_page((pmd_t *) entry); - return page->index + offset; + return page->_pt_s390_gaddr + offset; } /** @@ -1351,6 +1357,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } @@ -1379,6 +1386,7 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } } @@ -1409,6 +1417,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1437,6 +1446,7 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1467,6 +1477,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1495,6 +1506,7 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1525,6 +1537,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1557,6 +1570,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1762,9 +1776,9 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r2t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r2t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1814,6 +1828,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1846,9 +1861,9 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r3t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r3t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1898,6 +1913,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1930,9 +1946,9 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = sgt & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_sgt = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1982,6 +1998,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -2014,9 +2031,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->index & ~GMAP_SHADOW_FAKE_TABLE; + *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->index & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2054,9 +2071,9 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, page = page_table_alloc_pgste(sg->mm); if (!page) return -ENOMEM; - page->index = pgt & _SEGMENT_ENTRY_ORIGIN; + page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_pgt = page_to_phys(page); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); @@ -2101,6 +2118,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); return rc; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 3fc9e680f174..2616d64c0e8c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -144,7 +144,7 @@ struct page { struct { /* Page table pages */ unsigned long _pt_pad_1; /* compound_head */ pgtable_t pmd_huge_pte; /* protected by page->ptl */ - unsigned long _pt_pad_2; /* mapping */ + unsigned long _pt_s390_gaddr; /* mapping */ union { struct mm_struct *pt_mm; /* x86 pgds only */ atomic_t pt_frag_refcount; /* powerpc */ From patchwork Mon Apr 17 20:50:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214561 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 E5C02C77B78 for ; Mon, 17 Apr 2023 20:52:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69AB76B0074; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F9B48E0002; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49BE36B0078; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 288DE6B0074 for ; Mon, 17 Apr 2023 16:52:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F094BA0503 for ; Mon, 17 Apr 2023 20:52:50 +0000 (UTC) X-FDA: 80692082100.19.D0591FF Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf03.hostedemail.com (Postfix) with ESMTP id 191732001A for ; Mon, 17 Apr 2023 20:52:48 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BOUYQbRt; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1681764769; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=ScbkDj+y7Y1G7btojWof/NG3L6Z02FWZ8+EIxP28gnQduiraggyjWAtS/+RsxKz1gdKbID Zl5GrYWZaSX/8sPCFET5wA9gm9qZ5glU7TLz0fUJrDJVs4SacXDKcT8EDIltxJQVYP1hqW jqmSeAK2T+wnYIzrG0KYpGGAdQZeTig= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BOUYQbRt; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1681764769; a=rsa-sha256; cv=none; b=CGju/mGOePrkuowYYIIOQVxidf4+zfhs3Z6BYlVNhRMRuqxSlWDDbjjwYY3YsXCLkqviT7 /gY62MKWWPYRIiBBv6PJ+f/2oN0DdG1Dha1mnquBQBhkyFnZYYi1NM0r1bSxmAYbLaqF8w ZYCd1axhmqnMuxBZXQ++qEIBp7nZFqY= Received: by mail-pj1-f47.google.com with SMTP id k36-20020a17090a4ca700b0024770df9897so6597265pjh.4 for ; Mon, 17 Apr 2023 13:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764768; x=1684356768; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=BOUYQbRtprz0j+QE5FspkyGNnQXo7tua/LH56ZXhTbzE3CAOV8yTgXemF8QTCY9h4g g6V6zIZ7VFlE3ubnJkZ/yYqYyanZgx2V65Z6ltF6wcw0210IAZlR8To7Sk4y8TLWY4Hz xNxTo6TOWAdqeGCeg1Pit+CsJNU/MS0gvSxN85F+x2sLQC0IMYUPA6am8ZQrYVGpPzga 8IeLZRTxr8/8Yg1lDFCUFpg2PfjK4sGTGgffRI7OQ6kx1dS8UMGUuVs3EuNQkywAoLYX E+HKq98y8quQjgUskaGG1Ic02lqe4ZtSQ+Zea8JL+rlDVF597bKHVbSZetgCXEY/xB7J hYgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764768; x=1684356768; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=PWC0tYjktqYgwBzK0/gq1fYps8+HLFDvnHP0hkvmWiUPKA6m4iDXGuctcJDJZnLIxP dwqu6xgLENVtkGBCE1QQcxlMUgcI1uZ5P8kaWvuL34yKFQTiB1+3mq9s4e88gPXjZmMx rNH68j+ojC3aK3Dr8OuIX8CRgD2S78KVjkmf+RzpdIBpMhGWQxx+QGazOym3yVQS7Kra lqhghH8LM1zJPwcPEyvucJnB/apzDk0z6wQ5eGPg+4ZjhCTqNjWBYF69ixKnGaWgEglv Rj/8deyKJYLRB492gLK/3n/9910WQA00pp6+os9KU72o78NjkkcFGpv47FjL7Kqz0ldh KtkA== X-Gm-Message-State: AAQBX9eEUOFH7Uthkv4ydFtimMuldg8UMkU0m4GmoCOgmu+o4zgh5KIq FPQvmWDazOxUhl4QpoFxxF8= X-Google-Smtp-Source: AKy350ZtXMgj2Ot8GUfxTmnnYjtYP4oOp+wIKL46L+o6DOMpet2qdkXsjbB50RH+WV9/LkMm+8nkDA== X-Received: by 2002:a17:90b:3907:b0:247:8f24:eb31 with SMTP id ob7-20020a17090b390700b002478f24eb31mr4943020pjb.48.1681764767923; Mon, 17 Apr 2023 13:52:47 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:47 -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, "Vishal Moola (Oracle)" Subject: [PATCH 02/33] s390: Use pt_frag_refcount for pagetables Date: Mon, 17 Apr 2023 13:50:17 -0700 Message-Id: <20230417205048.15870-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 191732001A X-Stat-Signature: f8bjmnen7tafcid3z5b1a6xc6unso7ru X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1681764768-104553 X-HE-Meta: U2FsdGVkX1+7MOO+YwtUPKln1QuKLf9O2BPuAOhfDhdenB+WhkupDd2qWSgjUiClu1tlxE60XxWbLIER9OyjSFeb6zYW9+JA4oZttVvSXLVC/Gj/2PCBC1ILMtAlO2D+/KlxmHQFOYvMmVdFGrg5fGtDMYvz6m9VhEGBi1CJp9pdTrIQ/0gQJzTBnoKFRCwv7BeLaq82plo0FYHIzGpvNq7EH7X9+oh/cKoxRUzpgJIka2JcDjf4mANGC9i1ZkYPDUHVXze5CoxAlyQ+oS2RjteUm+nmdq3ql8zfPYph9ojnF+s4y3ANPFTE4UepNuF147+GyYx+Aseo1HlzRW6VLKKZ9U62H//nmGy9HB7nSm0WDHZ9uK611cjLDAZCZaJKmK+lC2bMoNi55PgmuqKmP6NJ4TDW/p6aIQ8dqIAPlvmNNTei+3FXOawB1Op/os991BZSr91DRRyvPNlVEqYhyYQtsq5yHJvfmQkXMLkLQwyQcjRICyeQvAo/YblrJRvpx4jj4uY6Gf1eaJaGhBrzFEC9UmLEg31iwmSyCcbf+VKAjTBkVbVoDiWibt9UfpTyRhhhGOUFF0Ecf6N7cQAHAAY7y5EcRd0XQed68UdssXK2pLZIsjtK99ufy7GHBdRCYU847MP6y7ipThtl3qVy6uJlwLRlCnN5ncYiGFN5qtxcLcgRoKJd8bfKmIZqiyAgnBt6plv1U5aHNUAgGztKDUY3KlT5LBs6i0eK6Q7WB3TrUWc/7DFs07oO5fEVoTFgMp8tDAx2EjTC4tHl3vaOTvrcADpgWhgJD/mMsBtUwb/riyDnv0609StiX7MDADJN859oglBWltVe0H8IDUeJLFVtA33dISSdNKQMFd+E152dbErvoq+XKQdmcmjNbKDqzizaKC/zc61OwFRN1UNa8IZV/Oc4bJReOcdIBeZrTzs+sBAaHcgq0LtQASyeykr/Ags3NG+IUIKUsGZPNEb cXLdxLbv CTrwerO7NoOtVAUqXS09fInYCYAQaJgZdLOp29nm4FC/JUlQ09/G05BXQ0ChfhlgURuwAQYmSBCISlhWeHEapbolH2C8LIuMEwfhiFCuyi1i/djJXTNZeisB1TQPLRCL3dk9uHzTU7y4i76RX0dt6r4faey5dvaf3ctE4tuizr29lUcPRb1UYjTSHd/Wk1RPLHUuf6nJWMSNK6Rq9/M1dnQ4guPdFN7YQEY1ylSBTyFLXh5Z2vVLytQeJe8K8/ireH/pwGEBipHCuYgwiOESYroRA1xA7vDCgFPe7oEwC8UQvflZaneSgymR567BaQHTBdUiaMLb1gS4Jo1pH2zxNL8yZbrKy1bbBut9ZwlQUcb0kOHM3OHx00qpJt7t5pL8LoAQO8/HVN0sYzYeEP46vWpBEcO/v2NPCAQAbRegNUERfOzmf8HZfA6c7llS1kTj7R7kTrmN4TRRzLrfEZx9VrzrStDlZoMnBQRAuRyxHkJVmKh2ch8yjZQWk3YOgg1/9IgVcyNbwCZrSQmJrIl03Awy3pQs49BV4cErhwLDxo9JldP07kX8dqZeVURY6qrlIoe5drb4wqbLnMkYQoLVwZKsL4A== 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: s390 currently uses _refcount to identify fragmented page tables. The page table struct already has a member pt_frag_refcount used by powerpc, so have s390 use that instead of the _refcount field as well. This improves the safety for _refcount and the page table tracking. This also allows us to simplify the tracking since we can once again use the lower byte of pt_frag_refcount instead of the upper byte of _refcount. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/pgalloc.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 66ab68db9842..6b99932abc66 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -182,20 +182,17 @@ void page_table_free_pgste(struct page *page) * As follows from the above, no unallocated or fully allocated parent * pages are contained in mm_context_t::pgtable_list. * - * The upper byte (bits 24-31) of the parent page _refcount is used + * The lower byte (bits 0-7) of the parent page pt_frag_refcount is used * for tracking contained 2KB-pgtables and has the following format: * * PP AA - * 01234567 upper byte (bits 24-31) of struct page::_refcount + * 01234567 upper byte (bits 0-7) of struct page::pt_frag_refcount * || || * || |+--- upper 2KB-pgtable is allocated * || +---- lower 2KB-pgtable is allocated * |+------- upper 2KB-pgtable is pending for removal * +-------- lower 2KB-pgtable is pending for removal * - * (See commit 620b4e903179 ("s390: use _refcount for pgtables") on why - * using _refcount is possible). - * * When 2KB-pgtable is allocated the corresponding AA bit is set to 1. * The parent page is either: * - added to mm_context_t::pgtable_list in case the second half of the @@ -243,11 +240,12 @@ unsigned long *page_table_alloc(struct mm_struct *mm) if (!list_empty(&mm->context.pgtable_list)) { page = list_first_entry(&mm->context.pgtable_list, struct page, lru); - mask = atomic_read(&page->_refcount) >> 24; + mask = atomic_read(&page->pt_frag_refcount); /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible - * value of (i.e 0x13 or 0x23) written to _refcount. + * value of (i.e 0x13 or 0x23) written to + * pt_frag_refcount. * Such values violate the assumption that pending and * allocation bits are mutually exclusive, and the rest * of the code unrails as result. That could lead to @@ -259,8 +257,8 @@ unsigned long *page_table_alloc(struct mm_struct *mm) bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->_refcount, - 0x01U << (bit + 24)); + atomic_xor_bits(&page->pt_frag_refcount, + 0x01U << bit); list_del(&page->lru); } } @@ -281,12 +279,12 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = (unsigned long *) page_to_virt(page); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - atomic_xor_bits(&page->_refcount, 0x03U << 24); + atomic_xor_bits(&page->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->_refcount, 0x01U << 24); + atomic_xor_bits(&page->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); @@ -323,22 +321,19 @@ 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->_refcount, 0x11U << (bit + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) list_add(&page->lru, &mm->context.pgtable_list); else list_del(&page->lru); spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x10U << bit); if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); } page_table_release_check(page, table, half, mask); @@ -368,8 +363,7 @@ 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->_refcount, 0x11U << (bit + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) list_add_tail(&page->lru, &mm->context.pgtable_list); else @@ -391,14 +385,12 @@ 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->_refcount, mask << (4 + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, mask << 4); if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); break; } From patchwork Mon Apr 17 20:50: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: 13214562 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 AF669C7EE2C for ; Mon, 17 Apr 2023 20:52:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F3D7900002; Mon, 17 Apr 2023 16:52:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A3618E0002; Mon, 17 Apr 2023 16:52:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F5C8900002; Mon, 17 Apr 2023 16:52:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6F24B8E0002 for ; Mon, 17 Apr 2023 16:52:52 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3FFAFC0562 for ; Mon, 17 Apr 2023 20:52:52 +0000 (UTC) X-FDA: 80692082184.10.2D4DD6C Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 76D1240010 for ; Mon, 17 Apr 2023 20:52:50 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=hr7pEt7A; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 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=1681764770; 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=ds3IS9TWlY4iXOF1Vygr3Q/N2fJxO0/Dzlxnv3cq6/0=; b=xJ5AgI6W3dBwlOTwacYfNuaqQeiC6WC8KXFQuu4xawQY8R9RgdlLcT/xuMGnaW/bMw0sUH bDyd5OUyaRM57vw6Atp1EG4QbwHKkis2RWHAk6yl2uM/ZF+3y3wonpv5fR7sn1PJiFQVho Ei4Dby1wVkAqBljFa9iwuVEdQyehzAI= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=hr7pEt7A; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681764770; a=rsa-sha256; cv=none; b=IthICwpkbqJhki/D2GG/9QXRdIknwAIjM9+Rsexbdt3jDgihPSrXwKnnGMzVke/3U4u1b4 Pu6sVAoCVkxEMLlOpvmpXDZMLOGoNyk043+o/oZcv9SXwb+pinHSZ3HX9ffXdluXEjw67Z QRpfF6CutjQNIYkcOMNm0vHajbKhpBI= Received: by mail-pl1-f174.google.com with SMTP id p8so27386562plk.9 for ; Mon, 17 Apr 2023 13:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764769; x=1684356769; 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=ds3IS9TWlY4iXOF1Vygr3Q/N2fJxO0/Dzlxnv3cq6/0=; b=hr7pEt7A7XcPfK4WHrNDJyXTyW/f522/QxHB9K2NM6BmG8KnIlcSk7Prak06XFsubX Sjsu1MPagS5Ajy0wM6nwYZFly4hHrr9DYIrVTEdELHRdfsGo64oEk7qD+41S/NMObi8y l8A2tz8IWZ1X+Du4Mg5V1agW+uGCUPtQdgx1HioQtiEf01hZXw902OFYpkixEmc4936W rbvY3hq0N/ZSHnXC+KGydT6+ZrTUjCaNrxKIoD5OlWamJ5QPi1l2Tt7uz8xTA1Fp0QB2 97/hz5zZCcVfwzgfNZP+zBkRfPzWu3gB3ojY6/LKA9XIpl4tn1OEejbLEhRl9E9QH4p3 YC/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764769; x=1684356769; 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=ds3IS9TWlY4iXOF1Vygr3Q/N2fJxO0/Dzlxnv3cq6/0=; b=iqPLa605BYlldQO32eQaBu4VilwEZGfjB28i1fDT/2+w3eNyzCS0B0X4FgiqZc8kbZ f/TbpwTxCKCID94RUQnz1KnYxS+yUeSDDwBjZAolEuvMFFH8VZcO94dDCr/bQTKnbnp1 BHi1gP6o7+Jj1lE9SAyBMEKV+g4st+FojrvqLEzo1y24fnNCyNCCXXQJ9FHECEdiQq1z dpUZnXdJ3apJXN6X463RG2cZMPbNGDkniAm+X2YD406eJFra24EESiixLHJ/lsLEyqWc +DFkMKleJdSthU5OPdXNf1/J4qaA8+BfJVhi1kcT/ugfNZqu62Sq5dnihpr9djKoUldd CpgQ== X-Gm-Message-State: AAQBX9evcVxrGaXPSYZEmF0vCXst6HFpO5HtpiPEPhIMYPxwc2VZcBPF V79duAWkA7+AuZ7WCSCqrlk= X-Google-Smtp-Source: AKy350bKOtS2RU5+UPauyBEeUGcMLqfRctd5dndnPm3bZbQM5N2yHnkL/dVsnC5V83h9pYCSEFQOHw== X-Received: by 2002:a05:6a20:6595:b0:eb:ad6a:ccf4 with SMTP id p21-20020a056a20659500b000ebad6accf4mr15296929pzh.18.1681764769281; Mon, 17 Apr 2023 13:52:49 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:49 -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, "Vishal Moola (Oracle)" Subject: [PATCH 03/33] pgtable: Create struct ptdesc Date: Mon, 17 Apr 2023 13:50:18 -0700 Message-Id: <20230417205048.15870-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 76D1240010 X-Stat-Signature: iun4orphywsapp75d154meai1s1rf5d3 X-HE-Tag: 1681764770-455821 X-HE-Meta: U2FsdGVkX19OAQcBF1pf56AQGiUacsNhiKMNgRqTLKDb5ljcITpcH5CyA/01eP8SL76aab+7jPNb4X6kuPiOB8hwIuV0aLgFoBb80Y4c5AVwnvG/+/o0kA1h9lcbKBkuxJ9eUkMtGJ8NaXIWvfc13aHl9aBVpb/q8bSg9p+ZkfbOfJ84/L55Sx2AemHaCgZ6Yr+se98Ta/ckrvWPjRAsWDjChCjHxGolSAtzFnVr74Wddgo+BOAG3SqTSaCZeiDUa5Pi+Pzd9k13yE3s750LRIl9PP3hk5zhsf1jhu51/8UbXDRQ8KR3QN1OO+e82RpbCnS+icAmleBCaaVxLz9HZzQ0V1wolfWkNvtVDenHNihBqDzjsVI2fM/N8LcOE6ZscoAtpREKxztDCILmuKcsrnruZBbpEUq1FLKA4DyAx22mToWEgpGedvWPTxEoGf0dI5llkOaA1qrzH144QNQfG4IYwOR1efCOWm8DrebTSeN/pSTeI5utUU8D78DFWaDcAut2pyg62B5d5EW4DjOAs5gA5n51k4EeIhiarTCzlMJxbMyPw6NxH/eQDWr4KJeWTfqVJjUZo+tJn/93/qmvwT/4nLAvvU2EkoCrdhXfgv7URKuFZ26ROfQ+mHy7MIuG/OUhp5+tTfWDIaH9D+bBo2kTRMn5dFXSGzTWiRoHAl9bzUjTjJByBjIvBRguise8nP8rfFkasJt8ldJMFhfTqfQqcsvhH+3jUEpgmb7bGHCo6T4+zO+Lu/TIZzMRA8R0+3pJXtOcIy05k3Na+Z4rR6DHNxRx8d4zSVN8BdPruRCPChx7tTX/uBxdOHU9Z58tmZknyAYB19xrO0gSX+yx8GqIhRUHPA89r6eylnTxI4J44pvIiND5yQePaIrvA0kcz//lR4miKT4kIDUXTelCzzoYMPZn9qEYXO1f0qBkhGIWez4VGxDzGyyklj/PVV2lKTno+ul/wfhnLXK1+Is pdebmXPQ SbTTpodCqZM8/tIWGYH+tTduh+FmuquDNspQRTXLMPlN+4ILdBL4nyoDixIGqcpCYjULU6qp9cOU4ALExeXEdWP5pgKyuwxoexfvgNdATTk/7D4rKrdmssIIDiCc9Zm8xusuenP65DygsQpA60fLbVAjsVGB05R8ObomWf5stt/iEiKb2KlnGfxXy62+T8JCrm0mi/xVJ6pG5N8y/IJ2Ot/NZXVZafiREK0v5M2H9CrGam5nOjBj0vJAGak0nwlJUOsOTKH87WY660s6kbt7EVR1u89ADU9xpkpPBjgC4/EZLczdEa+Ob+OWNbkSSF0qC6f1cp9AzVXiu+EPAatbXPniumzVyAg/L0vz/RFmA0ZYy/wS5fXIXYiuBpNiVLuLttJ12u2uuoa7ShR4AQmefRqGRaZUd7UeEGBXUWduyfLojyd9IBuOmMSZgXhijv+yPuYwJLDUikA14V2LqP7sX0EKzd5avkNzS+7yxi4BueTtUl5ANy9sWtY/SW7UTCYmkuTbhQn6UtXNwSuCXiXKbVo7De+PQgnsy7JTB4dOqOK5HN1g= 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: Currently, page table information is stored within struct page. As part of simplifying struct page, create struct ptdesc for page table information. Signed-off-by: Vishal Moola (Oracle) --- include/linux/pgtable.h | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 023918666dd4..7cc6ea057ee9 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -47,6 +47,56 @@ #define pmd_pgtable(pmd) pmd_page(pmd) #endif +/** + * struct ptdesc - Memory descriptor for page tables. + * @__page_flags: Same as page flags. Unused for page tables. + * @pt_list: List of used page tables. Used for s390 and x86. + * @_pt_pad_1: Padding that aliases with page's compound head. + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. + * @_pt_s390_gaddr: Aliases with page's mapping. Used for s390 gmap only. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @ptl: Lock for the page table. + * + * This struct overlays struct page for now. Do not modify without a good + * understanding of the issues. + */ +struct ptdesc { + unsigned long __page_flags; + + union { + struct list_head pt_list; + struct { + unsigned long _pt_pad_1; + pgtable_t pmd_huge_pte; + }; + }; + unsigned long _pt_s390_gaddr; + + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + }; + +#if ALLOC_SPLIT_PTLOCKS + spinlock_t *ptl; +#else + spinlock_t ptl; +#endif +}; + +#define TABLE_MATCH(pg, pt) \ + static_assert(offsetof(struct page, pg) == offsetof(struct ptdesc, pt)) +TABLE_MATCH(flags, __page_flags); +TABLE_MATCH(compound_head, pt_list); +TABLE_MATCH(compound_head, _pt_pad_1); +TABLE_MATCH(mapping, _pt_s390_gaddr); +TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +#undef TABLE_MATCH +static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); + /* * A page table page can be thought of an array like this: pXd_t[PTRS_PER_PxD] * From patchwork Mon Apr 17 20:50:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214563 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 9A998C77B7A for ; Mon, 17 Apr 2023 20:52:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38B6C900003; Mon, 17 Apr 2023 16:52:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33BB08E0002; Mon, 17 Apr 2023 16:52:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18D9A900003; Mon, 17 Apr 2023 16:52:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 07A1A8E0002 for ; Mon, 17 Apr 2023 16:52:54 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CA1881205C7 for ; Mon, 17 Apr 2023 20:52:53 +0000 (UTC) X-FDA: 80692082226.30.1A9E970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf30.hostedemail.com (Postfix) with ESMTP id EEE0A8000E for ; Mon, 17 Apr 2023 20:52:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W9nPVyoX; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1681764772; 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=73w88W+Bv7iZwJaXp6X3OPD7H4X7IV5/5eDbDnIxbNE=; b=aADw+JzT20r3pkAU9nQHNdUv3BWNdlBoNiIpfNvJouYXeOqqNrEl6E76yQSm8Y/MOeqsCv 8yVV3Aykx7DrYDhvTeJknYzX8DjtcOJaWX7YFYBb9LeStlMxMwABA87jlUo6MY3oU1C+j1 sHRrQTEdjx41RKZHWsvQytoC4jCl7/M= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W9nPVyoX; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1681764772; a=rsa-sha256; cv=none; b=fSDcLU2nGM5iOe4yYWxHMYaQL11v7rW8B2BIdipyMlNO7WSYhW5P8uU5gvmBTbGpzflPmK 2Q4RDA/tZMODfLLRRS9yEbhrr5+198NWdk5tnI+yE5JWq0rwP+P0t8v54KuQF5KtRUY9OU FAx0qBE4xSGa4Mxn7V0mQE8odxKNqVo= Received: by mail-pl1-f174.google.com with SMTP id p8so27386645plk.9 for ; Mon, 17 Apr 2023 13:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764771; x=1684356771; 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=73w88W+Bv7iZwJaXp6X3OPD7H4X7IV5/5eDbDnIxbNE=; b=W9nPVyoXWKBUEnGfTyhkHARBTsZqdpJrkrNTKo667lyZEzjN6PxmFbbY0YylZMq9yl YfrdFmghyeO5HwXhYCrYBTje7eKqSW91jSFSDlT0dbMWvyCEN9ttpAXe7AFMT1oxAH0K BCnetbVzBpycS1Tax/m+o/Gfxhef/Kkj1D6sF8rcDiRlOa7VvGL8i+xK5Gl2/zoIf4yK M/9RMi7Hd+G3wH7cuJrpgQnusczVewZS29/AobewpqmBg09r8g/9YIIka/gTIbj6DHBc MFg7CjS5kCFyT6XG4/q3MJQ78bnC2QIXJhA82Tu9j9zbgdzbLpx3IE+L7G092ISLAdCE r0mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764771; x=1684356771; 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=73w88W+Bv7iZwJaXp6X3OPD7H4X7IV5/5eDbDnIxbNE=; b=NY8zx+e3/gGc/TBWJ4DiYPIsFfIc4QLhPCp/OdYpSg5WnC0hlRJ19AvyNK/GfLJt0e 0IPFDsvuJBcUmUAL33qewIPTdKntCUDMmjcOB9ANVI4scr+UG4rGO3wR7MCAZeRVqn2t Ysj7tgyYLmgSYHDwo5FxllxXOdo8rnQeVhXlVqZMG/fREbsL47UWLk49/vhEMEdnDBAs lHKiqImxWn3EM8YoyWvthTGCO8BvhtRfBqzqGSNybxWhzpKQPrVUUtCSIjat+upxtkiv A7X0L+sYpZJv+qOV2M6H1INOiS9Cz94wRrBaoLgCBk0TjhlYARFBg2/d4k5eLwKmNhlm e6KA== X-Gm-Message-State: AAQBX9defhHXY+AFPKofCZkk/UoSlni+lV4bRdwo7oOK9jFl9fIokD6p +vZk4Hm/gS14SfsXOdxYG4s= X-Google-Smtp-Source: AKy350ZgO/j6WOIysdkqHxj8eua8dcgo+KDK2FD0csNlrjJfCGtmgVmsUk4Xos3l7Ag2y16revzrHg== X-Received: by 2002:a17:902:8bc6:b0:1a2:8924:224a with SMTP id r6-20020a1709028bc600b001a28924224amr205356plo.25.1681764770838; Mon, 17 Apr 2023 13:52:50 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:50 -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, "Vishal Moola (Oracle)" Subject: [PATCH 04/33] mm: add utility functions for ptdesc Date: Mon, 17 Apr 2023 13:50:19 -0700 Message-Id: <20230417205048.15870-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: gt55t3htzr958accqfhxujensyf7nxcz X-Rspamd-Queue-Id: EEE0A8000E X-HE-Tag: 1681764771-801760 X-HE-Meta: U2FsdGVkX1/R/ATbPL2FBCQlK/OBnSkX4gANU++OgPRYVP5DPKpYwKJTaYzYhIlDayOwv0cu7dDTbGPr+/5Hq7IW5+nfyVbw9zeTvKtYFgB5AR5Y4Npz6OtFdUTRDi6LocmSP5BD+cu4BXKLsFyOIyon2RfglNqbhVenVbkgJl81L6AQYJv7HKlyScs9yV98f/55SSVrCWTZDq+VOEZvzO/8BgkeRb8TmZkJT2kvAZyVgZxwP0vnX/PMZv87A+YDFtUAtBu5o7teKyEi+v5fNC9+iF6tgIraAxpJjQ77eMm79tCHUYIDwFzrxcQfbpHV199BCCW1MAWnfDNVJIxux8i6qBCntQ16gxkGM7Ak3zEkyBPGRkgpnhKHKnwjbVSNU3JqSEOIyIXOoPbrCT2try19dntPWFT9c9qnv2iwC+upo3n/u1MyuWI8Js2Eg80NMTDRtZ7ztDWk9PUPkrPIaMKoZymwxQAfeCyiLABkoCo3zVbmnLSwq4PvagpEY5QT1BcS4yM5Fti1rB7AFZ8Px7rEXfxVNOZr4Ut9tLWiVKS0/D8M1tbzN3XT3FFktRrXGmCYs49lWx14pQMdMQlzAhsujj5aRZhfAUgLSZnsIp0ugLeMO8n2PKf4u03S+SUX8GSFBHvEsdsIejUBYfxvAXgwvvs0nYujxtqpZ/8PrUCjO2S5P1R1ap0Cdl1N/jeMFK8u6+4yiEKXu4nVh7mErUGTL2orDp9MolpP4BrC/gq7A5GCE7a740fLFd/c+idgQ1VEfX3qDxXXo+9aVLc40fFt0eIEDTX9QbTqb0LBKR2xNPwOU9dxdJp4WEIyiUvh15/A62P2x4mY2eZOBL4tTE6RIgI8ZImp22tNThehUYMjJ5hGSxgz6XguE5vKjrRxZzLjaB29i+NVr6oymcWZwyUtFJ330zR/Jnxgt6P6WTuDo/vcUEC/iZNq6TmLLvGGlcFgD8RqH3L81SRAk4V /lvD78gP zepZ1cclFbeP5gaV7uZLj3qDX0dTmkY6zWjND9TaaaTeBgyzLv3gr2pe8xgdcK/yZ1BibDPFlL37MCiyUgGKbnKsC6T+Emnzgv+j1OVrlsag8jSWFH1v183e7wlN10Pkty4M1WDHpjedLpdpRjEAfNLLDW7KmKeG5oDMdVa8ErcRnVKqJsWr53q6bqtNV+gPvYuuWIe6nh1a2L9Osz/Lh+wiRY2P4b+cTl2EmZTP9kFZ2lX05C/AK29ztdfWeO9db6fx3EczoNBEUHU+9TD4hoQpCNt03mq+m/YejJWjXrS4Q8A/yMXwNWumvZ/aYhWlzhN9GRHOQ3FIiisN0uJn/2BC+kDFppJAydlTlhOkWeNlCM8W+AhnXwy58MgjzcjU24NnSco+H8191SyoHvbyMc0BXIJ9qyURe9J7Q1ZQJDh1L7i7EcQKXpH/cMr1UPuJ0ehRjb8Gv2DNwdtGuO/lvSSrjdE5GzoZrFvHbbyT8slKJg61yuBbwhnJdtMjTofYrLT6scJE54BMT992dMqDs3qLye06oA1uOKdjECDm7gUNeUus= 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: Introduce utility functions setting the foundation for ptdescs. These will also assist in the splitting out of ptdesc from struct page. ptdesc_alloc() is defined to allocate new ptdesc pages as compound pages. This is to standardize ptdescs by allowing for one allocation and one free function, in contrast to 2 allocation and 2 free functions. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/tlb.h | 11 ++++++++++ include/linux/mm.h | 44 +++++++++++++++++++++++++++++++++++++++ include/linux/pgtable.h | 13 ++++++++++++ 3 files changed, 68 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index b46617207c93..6bade9e0e799 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -481,6 +481,17 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +{ + tlb_remove_table(tlb, pt); +} + +/* Like tlb_remove_ptdesc, but for page-like page directories. */ +static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) +{ + tlb_remove_page(tlb, ptdesc_page(pt)); +} + static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) { diff --git a/include/linux/mm.h b/include/linux/mm.h index b18848ae7e22..ec3cbe2fa665 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2744,6 +2744,45 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a } #endif /* CONFIG_MMU */ +static inline struct ptdesc *virt_to_ptdesc(const void *x) +{ + return page_ptdesc(virt_to_head_page(x)); +} + +static inline void *ptdesc_to_virt(struct ptdesc *pt) +{ + return page_to_virt(ptdesc_page(pt)); +} + +static inline void *ptdesc_address(struct ptdesc *pt) +{ + return folio_address(ptdesc_folio(pt)); +} + +static inline bool ptdesc_is_reserved(struct ptdesc *pt) +{ + return folio_test_reserved(ptdesc_folio(pt)); +} + +static inline struct ptdesc *ptdesc_alloc(gfp_t gfp, unsigned int order) +{ + struct page *page = alloc_pages(gfp | __GFP_COMP, order); + + return page_ptdesc(page); +} + +static inline void ptdesc_free(struct ptdesc *pt) +{ + struct page *page = ptdesc_page(pt); + + __free_pages(page, compound_order(page)); +} + +static inline void ptdesc_clear(void *x) +{ + clear_page(x); +} + #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); @@ -2970,6 +3009,11 @@ static inline void mark_page_reserved(struct page *page) adjust_managed_page_count(page, -1); } +static inline void free_reserved_ptdesc(struct ptdesc *pt) +{ + free_reserved_page(ptdesc_page(pt)); +} + /* * Default method to free all the __init memory into the buddy system. * The freed pages will be poisoned with pattern "poison" if it's within diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 7cc6ea057ee9..7cd803aa38eb 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -97,6 +97,19 @@ TABLE_MATCH(ptl, ptl); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); +#define ptdesc_page(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct page *)(pt), \ + struct ptdesc *: (struct page *)(pt))) + +#define ptdesc_folio(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct folio *)(pt), \ + struct ptdesc *: (struct folio *)(pt))) + +static inline struct ptdesc *page_ptdesc(struct page *page) +{ + return (struct ptdesc *)page; +} + /* * A page table page can be thought of an array like this: pXd_t[PTRS_PER_PxD] * From patchwork Mon Apr 17 20:50:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214564 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 92D69C7EE21 for ; Mon, 17 Apr 2023 20:52:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75CDB8E0002; Mon, 17 Apr 2023 16:52:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BD30900004; Mon, 17 Apr 2023 16:52:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ADBA8E0003; Mon, 17 Apr 2023 16:52:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 41CEF8E0002 for ; Mon, 17 Apr 2023 16:52:55 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1DA7E1205E4 for ; Mon, 17 Apr 2023 20:52:55 +0000 (UTC) X-FDA: 80692082310.20.CB5ED6F Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf30.hostedemail.com (Postfix) with ESMTP id 4607F80013 for ; Mon, 17 Apr 2023 20:52:53 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IRDdSASc; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764773; 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=BPCTGsUKFtNZ0E2E3gxAeEJL+3qovRd//xVc9xUETqc=; b=DgNm6nr0uryvmZt9LUCdf11pkVn5Oj/B4UO8TnqjG/Y8c3fBfAms/rw1zHhfr5dQvlJ4H/ bLkpXJKQ1NA3FJo/nUJUGx7irZpHBrQ8Ty7FpKx7P8klFujI4/Iy8j2Wm7+SUhMMRgiy44 braExKyEM4BI2gb/gmt4rAdtB3e73Dk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IRDdSASc; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764773; a=rsa-sha256; cv=none; b=iOsrHxTCx/3+pow3OcSLo7ZVnBPvgnv/mw9LQEh+M9fG8KFNbPKS4egvPQP1N+HIBdL1Ic 9m2p7qj3nbbbKUQug6xlSXCuVSbOJR+fm+uK+nM0DDB6impVJYjehCsd5yDtyLx948YxeP Gx6meqZ593tBTwmwPyKU3ZJaok31WoY= Received: by mail-pj1-f49.google.com with SMTP id kx14so7222039pjb.1 for ; Mon, 17 Apr 2023 13:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764772; x=1684356772; 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=BPCTGsUKFtNZ0E2E3gxAeEJL+3qovRd//xVc9xUETqc=; b=IRDdSAScs3TBGztRzu6QZgH4fMR7/UKueaVS3DDhFsZMLZlJQUDaWkKiPXvov39z8Z bssT73UYUy1LP7uOeEalBEo3irDXhaxWlDKHCjJjWa82XbzBt1YrruOwks0GGaa/KE2/ kcH9ajFlIINgfw2e+eWdEuaQpWFwhb8tF79JjCU2EAC5A/73X/TUfQV/8mop72+F/v41 nZHSSM2ss9/OewEDYIYb1Iz4F1hF7m8KXVNPHD0iWKxsJnaQ4CmjrVdNW0xNgbwEICJR VACO7VFEKZxOIvTtIDcu6wtwdqmMEpSRB4owcroJF6TbGx9VSAN4uiN81drhHklILqhb p9aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764772; x=1684356772; 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=BPCTGsUKFtNZ0E2E3gxAeEJL+3qovRd//xVc9xUETqc=; b=UiWLa+oHn3w9QTrjDQmJx3n38prvgVdFGt+nLXRlb9pGEQdYrzxfoMJSmPJCJeUSea 5Uz8P1f0hCA7BwqawAiFe5h0TnYrKurO4SiSbLDj1ouZWTBE4RFvOniRUX5qSAkT7sSp cYbWJNxk4ykIEyeZjHrtwt/9tWnQLXuLC6BNfM8iysd+DX8oLdX0MTVzIRPOF470vUXd wbYGxDPhvK/bZ8e1HoQYalGWIRqyMjPNADLsLCvjrdPEgZtmq1Y3bTocVM+Fa6z8ZGLz CmvI+Ig0wt1KQQX22rMAAyDJiWIfDvWav9m+c3sENpZjO3rxsbfrpQnMTcGN4K0LN8u0 p/8A== X-Gm-Message-State: AAQBX9fbD4BBQD02Mn8gpZWF7DCdY7UTNqOIoAemPTjCXvmg1mywuDxo XStrFMIOfPHcMKEukMClLRg= X-Google-Smtp-Source: AKy350bms9aSjWgOwaAnzsnpGuFvcEqsOo1myEWAVSaCBXxzFAqV0lCr0DmPVe9wT5EHiIOY8l5jIQ== X-Received: by 2002:a17:90b:f84:b0:246:fc58:d77b with SMTP id ft4-20020a17090b0f8400b00246fc58d77bmr15834371pjb.44.1681764772342; Mon, 17 Apr 2023 13:52:52 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:51 -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, "Vishal Moola (Oracle)" Subject: [PATCH 05/33] mm: Convert pmd_pgtable_page() to pmd_ptdesc() Date: Mon, 17 Apr 2023 13:50:20 -0700 Message-Id: <20230417205048.15870-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: zo8z9dui75z5piutx8hgpzga7skfxpd6 X-Rspamd-Queue-Id: 4607F80013 X-HE-Tag: 1681764773-591829 X-HE-Meta: U2FsdGVkX1/WZswlp0/xy1j66OdIPkROPVbp7LWLlTK1wIEdDDgcKUL5nGmrCNM4cf1MhnQBqhVsVWNljP3aixQ4127AoDOIEcpNh+UiSv09trm37+/xWWJ4Uju/BBc430PDGCr+//Myle+jrvInrXOBOPWtKlRV691Mgk/qOo4g7QwxheLIftJlMJiaNaiudjz0s6UUbmb6Q5mDhNWOenYMTuYX/dGOOPiCDFxGfsFybx/JaN3/vgyYLZyg0pYthsF8m9VXLPRYyUVt3UJ0flb5uEDa5WBZXrSHjcd+EWf3GzkH+kUwhbGRpXHpmvAv7hnbjDOG6HAbWxkfg2up0haRU2RRZBCtX2M0HChz1U64FHPkc1Ug/7fRfYMK5ExO8du17UMBYF4VddUeroSOlvnUU4SFO0ywpuKTgfSqFlnCNvFoSMfGtlROAf4ZByIlvCfYb5nC379RBrM67jIgfnE28wDrOZifQACuaq2sZSfJATvo8GU66CxxcmLSjPyJPEBRznDBwK0Un1tRDuL4o+kSkLPgTq0le1zlDzQ+uQUTY4NVveble+Ivsiv7MM96ETQG/E8qRw11C0GNJLixtE1UVxpEKRwbtCdVUuzNgiZRzzOzCLl8llScvDKBvbJ3ebgAAIk8e2oW0G6bwN8wIWr2aevsdvJ+I7GJZkbHXJ2KT8zRR7jQ5AOWWMq35ZNJul+5vjcXWs+kj/S+5vBrugTISF/JFr/Ap7tPMpm95CAyXcIWGrjInyor47Bo76H6CIiOI6F94XIY/SNGbxmDMYUqxrupt0+RjJnprNC+gq9HpcmxAE4hflLCnCykuRhvJPwzzQUBMmpPkoPiA812Kh93xpXa5+8ZQiplJy8wKHspTgz7bPMRAtuAtn2+7CGyHqaf+hi5r1sn3d9R879g/Jd6U1DX5oNrpgpRijW+YbTjbOjv3Z3uGPyJ+5X0xaoH4zCFIJbSLntmwiKiYuB stO9W+X5 QtMqAg5Xcq0ez1JQIVUb0MePvJd2Go4H3y22N3l297/MQXF95OYKpgNAwlVsyj3Y48T7tXlProj/y/F4MzcccwArfnP+/Mga4ypYVfut8EsnfiFYk7HXthrMFIEu3Kh8mJaISfjTNhUGxE7ophn7XNIyDS8N7GP8BoMIcmqffXG5DmJqLQkfGx5jiNWwP6zAXFQfEWqLI8XZA8sXjtIb6nDqQ8aS00r6YziblMGcJgfwYUJh9WvojoGKLZWxh1I39JFNZv2zRb3yKIO0ozp61Pwu8SsDtYZpF3qm3+NdjtHqDUZx+UrqblP6fgfy5lGHow3FUNZ1oUoKRmuw5AFiCKjbFvTTldT1KVFkTGO/iNm/GrzqlPx1jzIghrz/40RBARyt1cuMsLouYqfZnJGE1FXeobGluXxMmfigdQMmFkACD7z0ULAMGwaKRDKzIW7Iw+TUNyXeD+NAXDNWfKruoBwXOiXYd8jLyE6M1jE6hQIdUP5nRomNrbVl7EZW4u9B6tyVEG6/yax+DL6Pa5w3gNso1/xbH4d8Thi9TfBTlNQj41h0YcmGzURKz+pM6KGeFfxMm3Sb6+4qezABPFIrTS2BNwA== 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: Converts pmd_pgtable_page() to pmd_ptdesc() and all its callers. This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ec3cbe2fa665..069187e84e35 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2892,15 +2892,15 @@ static inline void pgtable_pte_page_dtor(struct page *page) #if USE_SPLIT_PMD_PTLOCKS -static inline struct page *pmd_pgtable_page(pmd_t *pmd) +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) { unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); - return virt_to_page((void *)((unsigned long) pmd & mask)); + return virt_to_ptdesc((void *)((unsigned long) pmd & mask)); } static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_pgtable_page(pmd)); + return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); } static inline bool pmd_ptlock_init(struct page *page) @@ -2919,7 +2919,7 @@ static inline void pmd_ptlock_free(struct page *page) ptlock_free(page); } -#define pmd_huge_pte(mm, pmd) (pmd_pgtable_page(pmd)->pmd_huge_pte) +#define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) #else From patchwork Mon Apr 17 20:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214567 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 19786C77B7F for ; Mon, 17 Apr 2023 20:53:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA3DD900005; Mon, 17 Apr 2023 16:52:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1A81900004; Mon, 17 Apr 2023 16:52:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86B1F900005; Mon, 17 Apr 2023 16:52:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 689CB900004 for ; Mon, 17 Apr 2023 16:52:56 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 23FEC1C67EB for ; Mon, 17 Apr 2023 20:52:56 +0000 (UTC) X-FDA: 80692082352.17.6C939A9 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf25.hostedemail.com (Postfix) with ESMTP id 45CD6A0005 for ; Mon, 17 Apr 2023 20:52:54 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="m9/ZIcz+"; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1681764774; a=rsa-sha256; cv=none; b=qq/plsivs+Z0DZNmIZlixwHBDTaogs62bQYpb9xVRFdij3itfnO+VxUAZs1Y6KiftW8Lyu 20r5nP6jZKWj1hePLdPgEfNHa9QtRuQ7fsRKQAT1H18w6Rsb9CFGdblP07W44ADN6argln tutnhjre0BgWPXDEklyKd2II+cCHgXI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="m9/ZIcz+"; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1681764774; 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=seoMdP0S43tB5tHiAJsyEn/McuL6oTkl/wxfiJ8zej0=; b=zut3WvBa26yNcjcuzvmc1/CVMyEpqGIEJBeTanMPd+UjlwcsyL6qvA/4PLafBuLlCMCq/5 coCv8GfV7BNjM4sXlNm6hXo8+qnyF+kH1Iw711mCZKThkT7HwUwzicE1vAv8wc+KXzxMyl zKZgCewkXyKEUPh1mIs2KxDMBNppE8s= Received: by mail-pj1-f53.google.com with SMTP id v21-20020a17090a459500b0024776162815so6439320pjg.2 for ; Mon, 17 Apr 2023 13:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764774; x=1684356774; 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=seoMdP0S43tB5tHiAJsyEn/McuL6oTkl/wxfiJ8zej0=; b=m9/ZIcz+Tqctc8DsupfPgmRFjJ+xGEJ5QFcDJn618MR0YPogH6sfzkHf8JHJze9cJp x5NQYQBUB4f261Rif3c3u/e/lVyrkb7fkfJolfOwhFk6XOwO7D63t/TQQqs9S95k9Ae8 FKQXzDTaphWXYOHY2MRQP+XNQ8wh3L+YHkBgztA18oGJHjweyg/A/nWWIx5QMqDpAEPB X0wu3GkIqgBlm9RuBmiAr6UEFrV7LCwD9Gy8HkrUbR2REAIxrVGyinkjPCtpi11n6vo5 ARCTsKi2jOZHutSbPq4tlksgdP3OAZq4N0EqMo6MlYwn+u6KLBtMzuBeO5yqTZEreTX6 9o+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764774; x=1684356774; 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=seoMdP0S43tB5tHiAJsyEn/McuL6oTkl/wxfiJ8zej0=; b=Q6CWAMtZzdNpr31esLNgRvsIxz6VXEfZuHAJy5GYQQvKeDSpBOIxWLkaNGRGCQFtbx mfdoEBbsEl+StyH7WJBFWeIFk040FZgdQHvXQUo/fTcQmUiFdPQdxJt70bLIhf0svaur EhzulqEVPJo54LTBFCwkD8JFA8UkPE+6hAA2f+812KZ+708Rr4Z7HAY2t5K6zJavaWev UfcR71yYubq65KXv3Yc7hhXxmuk1caxbDAJc3mLmC9DjXHqnSjFvftEl2+4F1UvN13f5 4u6/jr1Y+IPJ5+wUe6xNMqHk17zF9iMzsjDy/zmnaEulBKd3Qg+vsMjk0TH/CCRhjetD fEhg== X-Gm-Message-State: AAQBX9csCk833+86H+uGSOp2AKkw5e5oU3SptHFSzpiTllNz7bvlZhtl fWlwXFPlVOH65TqveYa5q38= X-Google-Smtp-Source: AKy350aUejw0DeO6puoaXC3R5n6x3DzcxqacgAq+Qj51dxkW8glMsrCpGOXbLfdvjTORWF+TApg9qw== X-Received: by 2002:a05:6a20:b21:b0:eb:8d47:332a with SMTP id x33-20020a056a200b2100b000eb8d47332amr14024065pzf.36.1681764773709; Mon, 17 Apr 2023 13:52:53 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:53 -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, "Vishal Moola (Oracle)" Subject: [PATCH 06/33] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 17 Apr 2023 13:50:21 -0700 Message-Id: <20230417205048.15870-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 45CD6A0005 X-Rspamd-Server: rspam01 X-Stat-Signature: c163shhfaoisga74b4p9ronehwa9y5wj X-HE-Tag: 1681764774-452619 X-HE-Meta: U2FsdGVkX1/Skjtp4cmXlY2FK812M2Ph3E3MRniylxnCiqz+Oq7rvZoHPo5w+zzKyEwNxyG6C/njf7QxpcusGPtSYN1nmLEtM3jFTgJ4ebIEYv3NPibS0Ber8AJkt1tiUUnIl040lbZYDH0AqqVobjMxmbTW5LRPohgFXwU6fd5+jsV9WeaG8qlHy2f+ie53MaQQZ8PPYuanTnSxg3q2flZM04tswPxQvwc1VyRQwzEDx2Z5w6waafKYI1kVKnhubieC8yLnGtwngqFt8NcCx9j+JRsj8qaRlt2DK0MepgoWT0dM8WYzVC9fHhcfd8bHQgykDIZl2BExXBc/QwtaW7aDLqqSzgS7Trq/mihOOG/tx43JKVc9F8/jYsorXhsXHNq4QAGrMebD7H/zyDAncq6J2tkuknN28FFqar6gSXIqN6ZfmLLx4rcxebft4wJYBqvdEY8O4eN2Jy6QKKQshZarqadLACyY6fpMQA9VyF3dAZ6JxbVI0hauZQ5QTfQJJ4rNiRaEzZYLv0epb6ygr32HvbkxlNW/NJamAjmIxNQJiXnRb/OxYUMK+ABH+voAKs7x0pW1W4uQqUEmMFPA8K0wgrUrmLFIb2jfFQVP6y2HpmyfhN9mcm9umUwyhaiDsUxTghK7dm6tv2PhZG3HtlN2Nyz/qmeTkrmhfXR7jHPcNGXE1dAKTJBaQY7wPaRR4P+APW+yLkylnm9mNFy2GLhtCV9pRi3uTKtA7kJHvZEgJ7PgNZ0jMOwwtmNenvLk+1Sxs+CoDQpEfgaYwP57DId8X3qW7BUVJ3sI8U6EdGYNE9nBeyFlCILwtl/Zn4umRMcnd4x/V9mV1dcB/y/AXlPEoHqKmYmSLGoMT5jhYBZIWxJFCS4t00dk3jN1oqRVefH8HO9ImUnFOf+aTvFg9q8dU6g11wNpeiq0LNFSXkSLdze5l7IWnoIPpwtPB2nGenfp8zBHwDYZ3rbv7xA ke23vcbj VuCU5/TO3jcME1upq/SKkbiGNkCs285FJxo2iZbp93bW+0gcFxnuO/JZf7QVRH9hiUq0cE62zTFbde6cY470iJ893oxNid78kNgX7IuRwbfSEbX593JsB7EbkKdluuUXTM0fdnOI17O6zCacyADbrsR/XI3cH2p9tgqAOJei8uy0p3cpsiOflRSXXugnvZAuYbrJip5eKMJoz4tRiiMUtElWWUucQkU0aj29qTl75gVtdScPDe3FqCtoluQXCIk0puQx4wGZNqbmtURj3BGewGENTv38rpPwAx7C+1qc75v2mVp3sXDM+7IQ9llOfwAB0g0yi5nBds3Allc2n0rlc9gtxOo3suFW1X3cbEEX+jEbO4opGlkn454zn0UtQA3kp/4IEMTWk51Rd8MybI+TWTITu1EKWS0/e9LugSlFCcUAgozSw3fYGCo6117ttuiuM5zjUuuzaLph1wB2TBhTT4XaIcPQ3hw6Ri/vxKMUypLrXkV5DeuavhYe0VKyyn/Lm18ta/PCHfy0msYg3o1uOp16MgA8qJHc5DmmchqAmRMs1rY2syn05We2qXUCFWcT9EGA5Q5g73hdwgcldbtvWIuS38w== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 6 +++--- mm/memory.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 069187e84e35..17dc6e37ea03 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2786,7 +2786,7 @@ static inline void ptdesc_clear(void *x) #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); -extern bool ptlock_alloc(struct page *page); +bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); static inline spinlock_t *ptlock_ptr(struct page *page) @@ -2798,7 +2798,7 @@ static inline void ptlock_cache_init(void) { } -static inline bool ptlock_alloc(struct page *page) +static inline bool ptlock_alloc(struct ptdesc *ptdesc) { return true; } @@ -2828,7 +2828,7 @@ static inline bool ptlock_init(struct page *page) * slab code uses page->slab_cache, which share storage with page->ptl. */ VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page)) + if (!ptlock_alloc(page_ptdesc(page))) return false; spin_lock_init(ptlock_ptr(page)); return true; diff --git a/mm/memory.c b/mm/memory.c index d4d7df041b6f..37d408ac1b8d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5926,14 +5926,14 @@ void __init ptlock_cache_init(void) SLAB_PANIC, NULL); } -bool ptlock_alloc(struct page *page) +bool ptlock_alloc(struct ptdesc *ptdesc) { spinlock_t *ptl; ptl = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); if (!ptl) return false; - page->ptl = ptl; + ptdesc->ptl = ptl; return true; } From patchwork Mon Apr 17 20:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214565 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 74107C77B76 for ; Mon, 17 Apr 2023 20:53:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49BEF900006; Mon, 17 Apr 2023 16:52:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44C95900004; Mon, 17 Apr 2023 16:52:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C631900006; Mon, 17 Apr 2023 16:52:58 -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 1E343900004 for ; Mon, 17 Apr 2023 16:52:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E5BE180643 for ; Mon, 17 Apr 2023 20:52:57 +0000 (UTC) X-FDA: 80692082394.30.5B7AC4C Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 13C16180020 for ; Mon, 17 Apr 2023 20:52:55 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EY4pAo5d; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 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=1681764776; 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=7rEN7TkKGGrS4Nr1e9+VSo1FDhdsaSEXyIULzlMdAE4=; b=d6/XlG1X0K+vQxbGY2BSINtES1OOl6zTVF7XfLWiM18F7R7xqebWPMraXuMvrYUSLWaE7p ZEuP05c4TAubdrFbt746sBzDFPuUeK0OiIllGQQw/5Y10hHlJ5LCr1DB/pCVHK2WUXpCyq wTUKMLT3EjhskwrJQ9DXn0MwHGA7KFo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EY4pAo5d; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681764776; a=rsa-sha256; cv=none; b=7hkU5pjlNKZOo/wXhVmgVDTjUpyvOwsc0VpENDkaF/AtwMH9yl9p6Hia9ZHW4BI3+cI8nE EKhhbRnBt0AlJeLAN7uEbTBrtUTEYAQF5jm+tvlchiy7qPpBUwaqveDu58fvfm8CYuT8GG arkXMHheIjJENRnZVzx8piZOXtvoVzM= Received: by mail-pl1-f172.google.com with SMTP id w11so27335278plp.13 for ; Mon, 17 Apr 2023 13:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764775; x=1684356775; 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=7rEN7TkKGGrS4Nr1e9+VSo1FDhdsaSEXyIULzlMdAE4=; b=EY4pAo5dPiMdURcOVQM/Apa82VCO0I/XR1aYYt5qSz76HGumyOhUfKwA9+Mr5OFHh6 y4qX3lmzBRH5sE5hiL3G5H7+P1vU90VNiEuutpY92Aii8KdV81S7nJ0QBzccPQA4L2A1 H0r+gFj2e0wYN/AG4aVILv2cjCWqAiomeMPXPkWjszJF01iQ5TmXH8Bsz45QUOgwxoQ4 sHC8DrgU25+a1fsqdhglJSyR11j/cBOYD1x2MxJDA6rfBM+Ci8Y+wWCZicg642iTcaFB y1U70avkZLTukuwNbayq0JR0dDmctnOUY0ghxZuZ1egx4BqGjtzmW9DXZrJYTWGZ5wwv sRpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764775; x=1684356775; 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=7rEN7TkKGGrS4Nr1e9+VSo1FDhdsaSEXyIULzlMdAE4=; b=RErLrri9efoQ0Vy+CQG5xKBMSTfL54KDulQxP8+hnu3ftxbdP36UWMbjO/43ERWNGz RgbWwZbBt6oO4DjFwEQhAvMyPTo++B0+gcA8kRoGtpz01Jordn5Gp2qj09lCOuW2MU+p zDoCzryhgPIkscqF9xIlm5B/qCuGxZfndwA/bSC/d9/GBo0yc2ma7/RJjb4ohx8/cBqM H8Av+F6gW3k+NKU0ARpCQc6lasM7JZGO5+o/t1oBEIrUyuajrk+crtk5VDDLzOUV5C6k Q6vC7eXl2MlCCR5HIiKPFX8aMEdPo/1PeOP43J5nUBzMzba6psEcn8pSRbm2uq/aGV95 +O9Q== X-Gm-Message-State: AAQBX9ewb76RMlxc4PLLwSjuiqePbnNx91601DTg63rOwm8os99VOI9W jzkd/3zzaqsNaxs7okkgT0c= X-Google-Smtp-Source: AKy350Yghynh+/JYw1Y4OeSQkY97RuGOXV9v1JZPlpoHn0H6WhBdjqt/CneUg+QzYmLvk18Z1w5zNw== X-Received: by 2002:a05:6a20:394f:b0:ef:b02a:b35b with SMTP id r15-20020a056a20394f00b000efb02ab35bmr6833020pzg.0.1681764775054; Mon, 17 Apr 2023 13:52:55 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:54 -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, "Vishal Moola (Oracle)" Subject: [PATCH 07/33] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 17 Apr 2023 13:50:22 -0700 Message-Id: <20230417205048.15870-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 13C16180020 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: w8fst1jmq97n77kxqpomqtue3rnhhjwh X-HE-Tag: 1681764775-35724 X-HE-Meta: U2FsdGVkX1+U4ajRsnwh2f2bPFnLx6QgL7wuzGV99Mt0D2mIuOmKZ+s1s17hSxzg2M4DtzHkypWo8/N53azZfqiGtBk01Js6okwbM8JvvuwWzITec257+oadWc0MMh2rGb4QwMJwfXGU4L6ESx9lNHRopMTEerBhXMJrzo1PFcovuaQ0Juj/eeYtwzsBUfbmgf7m6j0wAN9N2JqeEvUP4Dn3uJHoSa1t+B7g/wgVOsNcsIjTJoElZ8Qao9XchU317ogQXrHyBDavOTwyNB78csqLBvlRFL9Pv/0HoNHJMhh1biF3i4nq22bx54gQn7LXRHy5tiXpJG82bB8l5KrLH4Ly6z3RaxMSK1W/5fvVqF9wgEcisY6++/5qPGEYfe1M6dpi1PjHaModOP1x5YjpfCFXo+GrwAMLPGOFHpTfg5a3GMrv7ltIf+dXCUw5J2+22FWLji+7uuJ2hh6UJJZQF0fUdC+i79phE26GdiF6jPoY0OwbiqrIJLJd1XfJIUIYHYoO95Kp4yY2vRbsSXEwLTIop2dZX055VLt4aUiK+elpV6vBJ/oAA/78c6PqqIYkuOJx8ZGsczHHzjbnos9sBTpLQXhCJPMqCbbHn4GUxSjGbzPKSpWOZ6h83F0PSDQCMMFUKUrzFauwwYO9kJqDt8mZQhJ3LgEQ1hqBz4YXKdd99Xbz6sumWuRDhjoXVN+hgymC4cescviqieaI5Zb4atK1aiUfcLuo/LVzIOabMqLro9wO7whQ23HkU6+gjvDgQoSA+0qHx7EciQT9Lx03r1I5KKgELmdDynSLsWHR6U0Awnmx1kVckxCnXr7nwoYYZy4MwGSPPd7agaSABx+CCeQALFL984lqeVHxBHCNU6M1w2BP6ocQYWe5vy3roSml48t+5GGmJICF3uiSlIrkwI1Iu9ejPeQXdMfzDtLeXqVscxrs+5zr++5QPuwL2UIjhaI6yz1bvfSXK26G9nG vMxYyzyY ZSGUCBvg+0AIW9C+ne6bC2w2hze88nFoD+JyxGaUztjwISlwlxg5i+c8mQSn7kCNGmVsAu/dG1jpBJDv4yx7NYevUv0nYKvV409bZUlN8EvW3J/LFhS3Wm9GyQdzj9JCHKn8NGAoXQalFj8C5n+GpHblxLruAaagYXEmbjatLNfHBgD5LXR3sw1IvFQ1rVlMkS3Eyus8/02qpPje/WVCzFIwAz0vBZEIbjISDOwQGPBQJTqtbb4aEt/j40t19lQomnzigbOUjdh94N/8W5oTJ+vB40GXwEWaRcslt9VEnoOYBylrsVwoqmhuK96KQ+ioiHpUMObJ3rAM5/7mGyPrM5bUGXUZhn2620mjCbVr7g1W1U0+WZH4UtE/8ruEyA/hQQpbuRXaU01LlRN63//PVVvb5qxEeM/YFLyRWdFjb2INGPQsuK/rCGLaAIouDMrybLXib0SALFxUGGCU+RiwLtWAWhYNUY85TVDdj6RhK3kwfKeM1FK6OBpGix/EEiHY1jwTCFcDrf51ocjtKq+1i6MJo32KIwgOVh6wSuWXML/gQNfw0vYWqQJMAcrfgupYjkNGIWjRjzGhsslZoxCoBEij8Jg== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/xen/mmu_pv.c | 2 +- include/linux/mm.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index fdc91deece7e..a1c9f8dcbb5a 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -651,7 +651,7 @@ static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm) spinlock_t *ptl = NULL; #if USE_SPLIT_PTE_PTLOCKS - ptl = ptlock_ptr(page); + ptl = ptlock_ptr(page_ptdesc(page)); spin_lock_nest_lock(ptl, &mm->page_table_lock); #endif diff --git a/include/linux/mm.h b/include/linux/mm.h index 17dc6e37ea03..ed8dd0464841 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2789,9 +2789,9 @@ void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return page->ptl; + return ptdesc->ptl; } #else /* ALLOC_SPLIT_PTLOCKS */ static inline void ptlock_cache_init(void) @@ -2807,15 +2807,15 @@ static inline void ptlock_free(struct page *page) { } -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return &page->ptl; + return &ptdesc->ptl; } #endif /* ALLOC_SPLIT_PTLOCKS */ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_page(*pmd)); + return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } static inline bool ptlock_init(struct page *page) @@ -2830,7 +2830,7 @@ static inline bool ptlock_init(struct page *page) VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); if (!ptlock_alloc(page_ptdesc(page))) return false; - spin_lock_init(ptlock_ptr(page)); + spin_lock_init(ptlock_ptr(page_ptdesc(page))); return true; } @@ -2900,7 +2900,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); + return ptlock_ptr(pmd_ptdesc(pmd)); } static inline bool pmd_ptlock_init(struct page *page) From patchwork Mon Apr 17 20:50:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214566 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 1100DC7EE24 for ; Mon, 17 Apr 2023 20:53:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DD50900007; Mon, 17 Apr 2023 16:53:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19047900004; Mon, 17 Apr 2023 16:53:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E37D4900007; Mon, 17 Apr 2023 16:52:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D2C7C900004 for ; Mon, 17 Apr 2023 16:52:59 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9BB42AC3FD for ; Mon, 17 Apr 2023 20:52:59 +0000 (UTC) X-FDA: 80692082478.22.ADDE322 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf10.hostedemail.com (Postfix) with ESMTP id A7C02C0016 for ; Mon, 17 Apr 2023 20:52:57 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=XGW0pwJ3; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1681764777; 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=I0S9vHWOxLue2VyFd3w8q0WLRZoA25NyvyllT+RcawU=; b=Jib7y9GlPixLU9MGqoXC/SLJ9Z7nrdNJ/cPBFwFKr2KBLkbrfi4v3JRq28QmK6gRG1D9iu ahLqov/HlrBhljliltIQ8NYGJRkGHMf0EU+sxmWbedIXShul22qSU9ca27I7fE3XkVaXGW uoaQvYYbBOxHusRi4iiU++0RyvfLwpc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=XGW0pwJ3; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1681764777; a=rsa-sha256; cv=none; b=DMqpv8RaGES0fST797kRKBWQCasgLtAoWqQn+t67NICoZsvcrE6q8dlIdEIe7RJtCamLYc 7lprqVB/MU9i2KglEKnvPXZ8Pft3UmFX7+hwhsMZC7yUAsMjB5HMLdFxrrUTE0g94du4ZB IIQQAZ6KKSu0sMp/LnRA5RMR+TYSFzA= Received: by mail-pl1-f170.google.com with SMTP id kh6so25752522plb.0 for ; Mon, 17 Apr 2023 13:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764776; x=1684356776; 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=I0S9vHWOxLue2VyFd3w8q0WLRZoA25NyvyllT+RcawU=; b=XGW0pwJ3AeguS3BSEjZkQda83npB8B7RbJEymTCypauBOGiv3vWjnUTzzYfl8eoJ/G l8vpSac3iXyBMdZp/fMD6sum0gW4MOCVqLS502CXgyi0RUYYf3ntgvAGSXGBolZoNn2i V+ToiFcIdhtDlP2wctGltXpdu2C91rdsIF1S9oPOQ0O7Jf0vF/Q8QloTMvDXpKn4JpZo XwyusDwNIWazvsnj/elh4vmpM936WP8JEzePXhLQ+OdbmLb8t8oYaUiKKrqV8mjQTuNV U8/37jTeHtYYWs9KLzMjZZ9An2VnMVkd7CaDSgdHdeupgwKBIBRRGFzwxZa8/Q4lnujL ZhVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764776; x=1684356776; 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=I0S9vHWOxLue2VyFd3w8q0WLRZoA25NyvyllT+RcawU=; b=A4HFgi9Nt2bbL8JAfWx6pdqqsUlEdC/CkfKZ97SYI5zUxtl6ByD9Ek8tPdujnS9Mxk j5NdZOIpFdN/ipFI7krmRghicHBZdQEI3Zr2ONq+aOFEcVOIkjG/ECLRmXbbwtz1rDy7 rdZ3a5xm1Lod8bz8nh5mdrTQXvM3FTgMZw3y1oujDOyktwGLb+LrQ9uobWOPA+mg/7zb Qc9kkFPhU6VV2spAie/MrR45sU08S79i+QHzhj93QICw8+JAaxBsg4J/i1S46iy6cpYj EVUSs5P8qLevdJOlmDL8IaJAu5XJB4eb8jqY/j5ma+TBVRAumPOj2hJQiid9nc1ytn3+ UwwQ== X-Gm-Message-State: AAQBX9cALeQr6Yp351B+LfaPCn9K3ZZFloSxiosv2Cy0h3HOrqKCZYcG N0sHFc0IJFLmi3ZsTYtzzto= X-Google-Smtp-Source: AKy350ZxT8mmBCzqXXqE8vhbMJvpIdAkvQhshhpl/b9NVru4kEOX264b08aZJzrt7Emcu03WoO14SQ== X-Received: by 2002:a17:90a:3fc8:b0:23d:15d8:1bc3 with SMTP id u8-20020a17090a3fc800b0023d15d81bc3mr16271900pjm.39.1681764776607; Mon, 17 Apr 2023 13:52:56 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:56 -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, "Vishal Moola (Oracle)" Subject: [PATCH 08/33] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 17 Apr 2023 13:50:23 -0700 Message-Id: <20230417205048.15870-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A7C02C0016 X-Rspam-User: X-Stat-Signature: mea7hc984rxfuqdwsbp8jjruugrdicwx X-HE-Tag: 1681764777-568996 X-HE-Meta: U2FsdGVkX1/sD+yaXUKKJM1oXY3SNKwkswGqF6P33D0iKr/KvXWlpeYaFukuLWhBMZutW6SrrwZHYsTcQ0Jqsza1qVexrDyNYe0QGGSqrpcFhI8j/1QKwuA5KJrLBf6GxhAI/q9tRhICFIN/cOK3fFSjxd5cS4WcEffcc4IYOX26mOJaLEAuWK5Mw5uXgrNGl4WAk47AJ10BB3ZBQFP+RbITfadId1xKUPoRKsThCWcKGPTLQgVWkh5SXuxBed2bcEcahdQ8ylNNHt8WaotNLMNVtAcl0ErO9WRUPRlNFEhKALMW/bUiJemUJ24dfOwc4rSyTiN7yzOVr9pA/f8a1oO7fZMzafF41HEUkcVBe8t3prcyyZsoV3Kjm+arzUJct2HucLkzaDAAN/KllJazMO7PGiQvl8eoqnQX6nEUnT/XMOuR+v5alnaRHMt02xodc5cl/bl9atIMllplGSYA8UAbZTm8g5rIb3lrd5Swgk/VUtOfPbrIy+EARxyS8zStsBw74ODfZqJ/LK39nxAquAP6Ue2le8G45QTAfcHMM5yRH0AAGD3/+LDOB10hTzeSGUo0RE7qKV0xxVwQOfkNJT9pdPsQEqpK6JXKjHIA+o6swev2eopNhZW19uMM9CIXxPKalWjaRETP9/MSxeOIhQqtGVX3ntAOytdKT05I8JtCos+ndzoUlEU2mm/sEl1TR6EvBQJnfiErhSnfnTSboAXEzLYDzchctHrNsK76+L9Oknv9lNwZkm1tTsA9IaWgaViacYcs2tbtzx9NMrlir+NfEbHhUnLohPU2M6JLeHh+MMf04xkDk6QDOl0Nh76FIA5P0K5yTJ0Z9XWL6r9HNLeMgAs3NQ6//3+P4crbqCqbt4gl9z7sxTy0My29aAxTmV47aw5JHQaSx99qvRjLsq2uVtSnUGGmwVZPgZCGNrutmLCGsY2EVWIqnRBg4cXvK7yxSg83FWnxM+a52k/ NTWeI8Gx qiYG2ic5tsduBV8rkcZuoSBgoqpc8dQlL0opQxUpjpJz390BunaxDNhCYXTkQ6GS+hyPYa5NJ63UBFEud7R4RrZGQykaZT0eunYqJ1Kg1Inx84PXxsxJ0Q6dF5uBWoP4o51Z6X/WOxqLd+xbQLPVRr0HBH9FUe1i9QiF2A68kI1KLSaqhAkGSFIowUYXDuJF4zsoZOjgPdmAmJRECUsgT/vP+r8BNidNuB5TNa33dYTUfamhMeillwor5noJqgZcJgkVLcP55gqI9BEuoYDphawJMlj75GNX7evq1eZXtphKDtmfZ/lPLqFkDC44TGeGyQmhD/rRVC1rTq4fIpktrkpQWQStF7yHspapve3KAhflAnPv63MQDfEid6nzaqZiUCiGwZeJcp3vsoFzmEQsuY7pEDjTvrX2/f4suJnnjlHScq92hX0nEqCZtSfejnH7nIDAlga6f8J6NxTwb4Lpey33n0WGdJSQf81+G1sP07HWWThG3fxRDUjSvCJWeo7ZeuRbQDG9d1JAblb+mW5xfjCPzg6XsxVPJLFJrj5Ls560OgOmNtYSQPJDaoU/zTkMqQwf3X1hzSBuD7M/sqqu0Y7pawg== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ed8dd0464841..7eb562909b2c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2903,12 +2903,12 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(pmd_ptdesc(pmd)); } -static inline bool pmd_ptlock_init(struct page *page) +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - page->pmd_huge_pte = NULL; + ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(page); + return ptlock_init(ptdesc_page(ptdesc)); } static inline void pmd_ptlock_free(struct page *page) @@ -2928,7 +2928,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } -static inline bool pmd_ptlock_init(struct page *page) { return true; } +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void pmd_ptlock_free(struct page *page) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -2944,7 +2944,7 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) static inline bool pgtable_pmd_page_ctor(struct page *page) { - if (!pmd_ptlock_init(page)) + if (!pmd_ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); From patchwork Mon Apr 17 20:50:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214568 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 88C52C7EE45 for ; Mon, 17 Apr 2023 20:53:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 736A7900008; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BD0F900004; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55EBC900008; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 43D73900004 for ; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0072F80595 for ; Mon, 17 Apr 2023 20:53:00 +0000 (UTC) X-FDA: 80692082562.14.6920354 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 372DD40018 for ; Mon, 17 Apr 2023 20:52:58 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/h1pnbY"; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764779; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=3SZzDsisBsqZcB6I39s5UTa0mvKMPaEppBkojD+QqFz5+iW5avy2agDX1+lYxaRYdyqx+Q VHvjC3vCSbn0QTDPZxqM9mgRmyWQEfTNG5Gorjt14C/H2CqfP1/rMSGlQ/a+qSdAgUNNYL Z0/WjnjWhSotmha9vMCqXiNnAWUwz14= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/h1pnbY"; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764779; a=rsa-sha256; cv=none; b=od4BklSLviqMzevu6PHlayMbfGvbJMy83ZkwuHsitvzVkmyrxxWlg+i6ohNT3Miso6hPGx ZXF/GXuBQ40LMk3nftVs5WZdg5EmpZzZvfqPjS+rjwe7WtaLAlDGa4Ff3rj+G2rXzKbyY/ ywcV1ING4mtR/gujX0SVrZOlCT12GmM= Received: by mail-pl1-f179.google.com with SMTP id w1so4513451plg.6 for ; Mon, 17 Apr 2023 13:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764778; x=1684356778; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=I/h1pnbYM2DwgRZCSJteD0jcjPogajwYvoNTWu05FIt8Dug2P9e0wRrWLPxc4zYyi2 bF+AVTemVcp3diPO+7OSxLM72RxW/MppC8vSDXDjD8liqzM1pBLkxoUoebzionO/oxsa qHKGIp7d97W6jlem/3yxXQy6r/jNX2Q0ie6VB85Wwsz/8JpbJnzPVNlM6MFS7XC7iPJr OFMLKNx0UPHxfGtNqDckarA/92oBRif46FzIncuYkpkQ+fhRc09HfBoH8I7mBRTJiPxj c4VsiDutZTNuFgmpjh8q1KLiugVszPA4Gaz711F805EB6LUcut5gmvOb7RYuzrO1w3sO Wqsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764778; x=1684356778; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=iuSHQetBQDwLjFD9uYc8xhatDl/rpjnjL6ECY3wdASHr4OuPcsvTqPoq0+FLMroIjf E5JSEATT2CT1nswvTr08lD0wX8K2gKZvkdeCBCVkZvabFJxhU2RcRlsA4G32hbV379GS 7T+TeslR+x9VrHC/QtwJbw9cIMulCqAKVOnLSND1DmleM1H4IR4sNZGRnbQNIOa5J/qF l1r3Xr0ddAk5ZFf0R93SgrQlvVVarnnjo8+qWSix/atoQXBCYIYzu7JAsnVLrgx0UuY1 cS2tX7AvfOL73iMGA3DMA2IFK0yicLzqB/CpuxiHEy0Q8QnXK4fIwg2R5v27ASocF5li CDJQ== X-Gm-Message-State: AAQBX9dMZf90cJ2SjreFkKmHGF6lZB2XZG9admpPHhE/nluwPjmDh5xT 8SY+ASPCXKU1bZ6TeSurlQY= X-Google-Smtp-Source: AKy350a6Xakm9Y4oYLvOvIWfyGM8BNUM3uv3d+WixCRDkQ1rcDDo2rZhVhsbndThyou7yfhT1XyHRg== X-Received: by 2002:a17:90a:8a04:b0:247:14ac:4d3a with SMTP id w4-20020a17090a8a0400b0024714ac4d3amr17877854pjn.20.1681764778063; Mon, 17 Apr 2023 13:52:58 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:57 -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, "Vishal Moola (Oracle)" Subject: [PATCH 09/33] mm: Convert ptlock_init() to use ptdescs Date: Mon, 17 Apr 2023 13:50:24 -0700 Message-Id: <20230417205048.15870-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: u8ak93a13r7hxxeg8dekdtb7977jyuce X-Rspamd-Queue-Id: 372DD40018 X-HE-Tag: 1681764778-183561 X-HE-Meta: U2FsdGVkX18Xl8R72Z5Vv323DZUp1fIZizTypCpi8QLfuHJLQQBE8wR+KnC0Q6L/cpKQEoo4DtxJnfnDfd2M0KtoFMk3LsdjWmDxR9RQosqclZelKeGr+4fteyjVm2BKrMwNT76asoMsIOcQ2FAST4U05n9OEO5on0sljeN87ormfqJPpLgxocpXG/npXX7GvjFAvftdRmcFCUTSlY/CZGyb0Mh4E64cI7p+l0nDNULlrcwvZlW1VQvofaIM8mrVg3+13oJjTbouW5hiBKOqOC1NCpT+DvfJB0VV+8GGGy5VHbyVo+kz7tVbCs/T/lu4FneLLXEyISkSGrpZts/difVN8t6rCOxar477sxk3AU6ub5qMY5Wcci28w5rtwo2/OO3knlKyZlzUnVHQKO3qRh9eXfVhdYj96cNWhKiMfiQEEA1Xd2zCatf897g37XiCZ7SezkQ1WJbysz8HQ730Fkt7n++n+3hG4q27VNsBzapLwGCVb60ZgkT8GMKipQ7Dtc1T5itIqTzE1gtRBhJ5nUt2hhF89b+2mT0y11z1oyK1VklQSigNH0M1XW9bwB9gJQ0jvGaT9hzbpyQaKW2E5mKsVBjt+2ygGEre/JNisVv8ko26i41tyYK/a0HfjWDbFb4w+QZFcq2/Zvex3OPEakU2S58vTSQJtH8nOPn2dmmoLmuIw2QuSA3ucyXP7wULKgpBe70nTiKYu9tXpMxMCByHyNn8cXAMlIG6CkrHoBH7Xoy3zaH8AlLggP5GlMYSvAv6pmU+85b2uV+4dUpp3OPSF3IKdBTKxciT+K7uxXNfsOXtNFfquu+dy/kOfQCyNT5G3sxrak8I7y3F0QvaisCf0xpiHp20Ldkr/Di9AW9aNVJ87LM+z+JcQROQtDJmMImTOaI1rbJuamitlGm0b8cYhXSrq7i1oXhUnq+pyVuwpOjKhMpu8nJjhkNfTfagYiz9phNYDLFiyv/xyJo Zd53Wft0 FPMBX3Kdlc527r4pHpWWnnP//L9EMEcqTGsQbbKcoToPe2N8GgCKffDP6xa+5tj/OsbStxBb5/ikPpj5EybRtCoxLUxe+J7GGgWV5+vX6WIFOuepFoceEIgJ/+N7pHLX0xaGREjICKbhAedQr1sLogudo+ZZi/+14mQFBJz+BAzT2O4o2UFvO4cUi3tYctfUf67x/S4Ydvt0in4WkyjjYGofq6pw+obLGZlwVoQUNgCCsA6TnTUDaIVQSFHQdZdyuRgc3fPoTgdNdmDC4DjeJc1d4ZDbDtUyQpxxTYUx2ByDyp46yq6ZnP4X5CT9kDXr+c16xyJfhlSAO9qqJXOFWMd8wZ70xxrQvOlzdIU/3W3EgckDDMUdZL/JlrY6yTdUR/m59n7h7fqQayRRFYgMZP4WtnVmnqPzOvAWGqSPUotH5OuSvI7YGe6dFvaoX5DLr8IfLNPLOJeBWBqBWGak/So62rURtC28ggpO22Fg/ucNUu+g1YjNXaC98+8IdSnsIfkDd0R5Q6J+ocLrRkO09E2FkuHgUwEWAb6wIXHPKoe+OYgnkGMsimtC0iLXYUq7wMwg0a767XT0nYAj5dRFMvijCDg== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7eb562909b2c..d2485a110936 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2818,7 +2818,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } -static inline bool ptlock_init(struct page *page) +static inline bool ptlock_init(struct ptdesc *ptdesc) { /* * prep_new_page() initialize page->private (and therefore page->ptl) @@ -2827,10 +2827,10 @@ static inline bool ptlock_init(struct page *page) * It can happen if arch try to use slab for page table allocation: * slab code uses page->slab_cache, which share storage with page->ptl. */ - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page_ptdesc(page))) + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); + if (!ptlock_alloc(ptdesc)) return false; - spin_lock_init(ptlock_ptr(page_ptdesc(page))); + spin_lock_init(ptlock_ptr(ptdesc)); return true; } @@ -2843,13 +2843,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } static inline void ptlock_cache_init(void) {} -static inline bool ptlock_init(struct page *page) { return true; } +static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct page *page) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) { - if (!ptlock_init(page)) + if (!ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); @@ -2908,7 +2908,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(ptdesc_page(ptdesc)); + return ptlock_init(ptdesc); } static inline void pmd_ptlock_free(struct page *page) From patchwork Mon Apr 17 20:50:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214569 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 529BCC77B72 for ; Mon, 17 Apr 2023 20:53:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E360900009; Mon, 17 Apr 2023 16:53:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8929F900004; Mon, 17 Apr 2023 16:53:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E57D900009; Mon, 17 Apr 2023 16:53:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5F725900004 for ; Mon, 17 Apr 2023 16:53:02 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2FFB7406A3 for ; Mon, 17 Apr 2023 20:53:02 +0000 (UTC) X-FDA: 80692082604.05.533F156 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf03.hostedemail.com (Postfix) with ESMTP id 57E282000C for ; Mon, 17 Apr 2023 20:53:00 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sICUrUNh; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.46 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=1681764780; 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=X3zVXX/N6SOzga9RDJq+tPAqPrrx50X9RMNZ27hRgPo=; b=OmGAblXUlqBjfxmKH+tsVGyCLtkgThY5/FmCCKAnVUPJ8aPNpERxLSDJTyERh01+4/Xs5s ioBTck7i8GUT/OlzyqfYMc8hcAwhy5L1EO5/6VsRhjAWMrvZJxU9Pgp0tAaGPOSEyDGyot cxda3p1uo1PgnXGbRC/EaBJiMK9zWKo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sICUrUNh; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.46 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=1681764780; a=rsa-sha256; cv=none; b=y0PBdhalLna/ovM5bSb+69aDWP70R8wkEKZ0iJ5YGrO7SLmhkdPGCgNNQDtt9YLHIfwPvU papKiRBsqGafwY4zi4bsXMvUu08tN9CP5SL/Z96KZXaqzei9KoSklnHwScQhVmGY7TgfEw uq08fMcw1EaZopK820MlLFULABZ/5FE= Received: by mail-pj1-f46.google.com with SMTP id hg12so12713016pjb.2 for ; Mon, 17 Apr 2023 13:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764779; x=1684356779; 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=X3zVXX/N6SOzga9RDJq+tPAqPrrx50X9RMNZ27hRgPo=; b=sICUrUNhKpAOA4VRjrqbzI2X/H4tUjO6T2SdOnpuj4Iy+PajhE1DrUSbcJznfffRrX L+wg0APu+UnJsiMWo07D8eesoEiJoCPkIf7iFkO3frlAWKtnOneztwNYCGmhOQpiZeuy AXohiTFVSZ6j/QYK9dyhVhIaufaLIPexDAAJXmf6qW3dNeCDEUq++V0vxfiKc0g0e7Ab Ewxv8L1qYPD4uyzx9cQ6CGY815b+pAM3zpWc0XUF8sLnRhkHRA/O3qjcuWg0cKvRpE4M YyoU6OpnuIHEQ4e7n1BxpYaP+3T9kR2hf6Oim0PIubi0gprGsuCOvZCKtVwS9TGYF6kY TvEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764779; x=1684356779; 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=X3zVXX/N6SOzga9RDJq+tPAqPrrx50X9RMNZ27hRgPo=; b=Tb6bpYbM/UUZwh25AE42jUTuNr8JnUobbaaSBmeTL1DNZ6BCxercVu3IZpyt1oHsIp b3YP58xoOjXRwmHmPesyg3osmXgGnTUx/uKnxaQRjJvTT+fV2Fx8kNb7T2xO7yclXUKX G8nxVHTPukKMioo1nuCZD2RmB2c5pdR163aXKEF+/AwFtBxM+C0+a2wGlVFmSFVB+kwj zB/Nw1j99PLITygKk5oRisOXlSPHVcEetHhF5M0Z5F0lVhy1EnC/p751YCSY/qB5BMk2 KdOz1mIwvWq8A8lBf1khbRlgZzQB0f0+HCB5+gvz1IKyDjFRHyCbqKzs5sPoqgGw/KIV 5/cg== X-Gm-Message-State: AAQBX9cgJqISPJraGfnl0uzgx5Z3QTqKGeey139+5N8/Dz62tsDMwUx8 zo635KUYil0SPkBlMLIfafE= X-Google-Smtp-Source: AKy350aL1Q/BuQU4b/coHWha7jodau934g5ZfPpWwX1i7O384OcXkkUs5sEaNrPzHDYpgrYCEKrWgg== X-Received: by 2002:a17:90a:cb8c:b0:233:f393:f6cd with SMTP id a12-20020a17090acb8c00b00233f393f6cdmr15121483pju.5.1681764779380; Mon, 17 Apr 2023 13:52:59 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:59 -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, "Vishal Moola (Oracle)" Subject: [PATCH 10/33] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 17 Apr 2023 13:50:25 -0700 Message-Id: <20230417205048.15870-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: q7eszfsk3ahxob51hf3mw6sgdfjp1fp3 X-Rspamd-Queue-Id: 57E282000C X-HE-Tag: 1681764780-360476 X-HE-Meta: U2FsdGVkX18J7C7i6G6sUnLP8ObuicC90+ByCSXITZENPvrjfRx0TSy30vpR3LJlQDvIpLcpShDk5dyvKpPpKwABI6vjTqZnsT28kmgEDa+lfQcFQPTgp1U68WWE1gJFdLyG6bc2CJV2yLEDIwPf8dYDTtmon9NXV4zgH5N+ZY+1Xaaha4I0kRU8mqnaVN4W6feveT8Ld6GWY+SdKHhZ2dCkgHvngFtXPrZKWubzBXG0aaGozOLlxNXCgs9NJJDyQKLTqIsXWiSnke4f3G3ovwsybctjvMF0aU6+vSocSVXiffVFpmLwoOVRsFQ9oAc6s3WDeFZAUEpJSNUtcnFUGDOt7PDyiDFXk6myKEceA2QPDm9aatj+Rl7Egph1hv3AF9hsnT5kdRF/PBdxoXG6HivC0GcPCQl+hNZ0fO+cSegvN986ezBK+SU6dJx8I/QLjqBVW181MKID+gWKI5UK8D0Ik8jixMzc5wW8M+BHB9qfnAAt9GJkKdS8TkUArUuCZ1L5wvu6HrIzepzIELAuadqxc2C7JhfUY9TUyGc57SQtHFCLId6j9Y1jKNVYbt8kUxgZmMo46Frgb5QCmi2wFWGR2a5gguZe1tYYegqbLY0bjWrCGmBUxh5ZCc4mLG2PyhNGAHcZTL6XYJB8/Bn/QqqYYCdplON586HV90VMHMRyrAIQ2sBLrq6P87GDHno49Dk806uNyiT4BPHe12cgXKNCht51FdmcozLrPhglk75wS9kcRYaCm5Q2rW9C/MauclVnES8+kArwSEyBn+T/eSbSRVLeUSnQ60dGA08rvkBp8j383IRaEPPfp6Biyrqw70xUDaNiSI6wuwQ5wAER2Xq5JgdkAJP3hVl0COpvxVBO4RVXfQ9lXBe0wNAaSs3f2dxwB/zSHMUpISO4TB5T2NNDArbHmRoI+N7o1hAOIjyhTrFkR3ic8quEaGzZeEwgVrof/OQCQlSSr/uQlLd yAFbIpo/ k57bWmNP56IeiXWgzM8Zz5cccTl92pLRWgvdfg3TYfocSlJMzshX4F/D+0Ny6jYcsDGygPUORQklU4MptJ4TYDaaL/Fv4ib1qMNQVxtYg0m3Pfk6yPqhdkBaJ64YbDE1R/SetnRw77Ml91O9TMyZMI922G1YouJrR8jw3FfKK3IC2W3NWX3Sff0osFqAgxa3YE2t6XiXzOmLBXHx+LzZWWkbFX+fxo7eJCLAYwLGyTUM22HzhY23aHGSrXPgaqVP4X9VHEiuPE81OHYvQFtjT5eg4ZAxgPQrDVurhE+KmmF/nc1LgoeCsBDsT3EXEVY9mvjLm29sdMeGKBnPahN7YkzHS2RSnalKSXyWDMOhQW8rmWFQdO7YPTSo2xB3kJSQxNMvfbOHRr9lYyckbiAdpKb2qCDTWr0EItE8rCTmw6YeJWcEWJO1hFFIKcP60qkqTw/yBYGlzUoD2CnhnZrf5ZHJE4bLUWV6WIUrtt3UFAknWJ1ETCMk2xS7XT8Xc+kEtl/3MgP/oubKHbvOYSPyeDTK0Ke5ipVjfZp0nKJdPlnArTF/NbDHzo4jI9B0oHecDeKCiJg7NSgsCmJLQDRfxzz3VLw== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index d2485a110936..2390fc2542aa 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2911,12 +2911,12 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) return ptlock_init(ptdesc); } -static inline void pmd_ptlock_free(struct page *page) +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - VM_BUG_ON_PAGE(page->pmd_huge_pte, page); + VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(page); + ptlock_free(ptdesc_page(ptdesc)); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) @@ -2929,7 +2929,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void pmd_ptlock_free(struct page *page) {} +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -2953,7 +2953,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page) static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page); + pmd_ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } From patchwork Mon Apr 17 20:50:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214570 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 CE732C77B7A for ; Mon, 17 Apr 2023 20:53:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B55E790000A; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB490900004; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9564E90000A; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 86920900004 for ; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 47C151206DC for ; Mon, 17 Apr 2023 20:53:03 +0000 (UTC) X-FDA: 80692082646.25.E289C4B Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf30.hostedemail.com (Postfix) with ESMTP id 7B1F28000B for ; Mon, 17 Apr 2023 20:53:01 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FTIIrhTe; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=CbBw8SweAqsaScsQrS6e71PMkuULXEgn5W3S902B1HAEMna9TU4Ku5CRyZv1fAx88mzsoM YXh7sOlDe4OIK5Lj7kx0iwk1PHpPBuZtUBhqUOMcMq5OMth5SQc7QA/c70g1CGL9/EoZ9Q UOvJeAyqb7nDehHZUQuWwQlq0CuC6m0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FTIIrhTe; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764781; a=rsa-sha256; cv=none; b=MJq8ctvc8tm9FNoZN4IkZoR7YGqhpmuLESi8Ir65yq5o41GJ7gMbnVUy5wRQO4yJeva2G6 z96W00LnF+pCKLgdgzTvyYlVFvaLvgYI8u4G6Qo+X2Vcl1xo27g3H0NLtHyf0DBzXUcY95 iIJguDmMbe4XL4uOC5kqONPTjMvOfK0= Received: by mail-pj1-f49.google.com with SMTP id kx14so7222701pjb.1 for ; Mon, 17 Apr 2023 13:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764781; x=1684356781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=FTIIrhTe8vfWt4jgLQ0zryZ+NfsJ/OFhYpHyrwEJjHtN6fYrjayv1wmbuEiWrZWNBG Ab6oC0JEVFKaVtr5ERs/HGyia4m0cuJPp54Y6qKJvGxwoWwnKA3jL+mq6GAMCgFGvFWn bEbIp/iuCRzaSQasJ9iYfHsEIZ8C5L6UBjIsqJjVLRNCdj3wFA0VCJaoyvqsQShlPxAr nn14k2m42+J6xR2hfl2ffw8tFItkZsF+DKNsuBC18vZWoMB4mE4FcDOZiJ4pqP0DqYky PjLPxBMY5gAsTXZg/iGvnD4lxFGHfkuFymQLt7EWHTlIBpCDY+iSj33ZpMo6EFdNFztz HYrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764781; x=1684356781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=HFgR0OfLf1Er0VcyeO9+loDBs/dogp4NOEcNc/GUvW35lVGZf9bsblvyTzkl741MAy nrSj9beNeHyfIGm2yydwy8TrMl+YJJR05tcCn8L3T5CazTs9r6eISlwb/YzZ2Ry/8UPB /hMG7KZtHVTHoXOCNUX9nsHIW7Jm6INArlLRDWfwTvVnCmUpL3U70D41J92+Wa6VqFOL TFQL3Sc4qXklSx2A6pLgn+g410nNN1ZUaIkwDZy6oKYEKm0uoL8u/Zp0n2EgGYmREcsr vSQ/+HQAKIEdEN/H7HinSb73u9zOLyJunlvzYTZOK8Z+coni8DipLl38zx0NctQt6hK+ 2NlQ== X-Gm-Message-State: AAQBX9fnYXS81IBNlMJun+/4H74CgDJdvs2IbfZLyojxXhdstu2QLRpW RIhkNKiRBKyDfwk63t3Q7wE= X-Google-Smtp-Source: AKy350ZMofF2taT9lCtSfGwXj3mTLikp6R4dNTLL/p579XSegIqzslR/71TUEAWTkG6EWBZpLey91g== X-Received: by 2002:a17:90a:d143:b0:23b:2c51:6e7 with SMTP id t3-20020a17090ad14300b0023b2c5106e7mr16554327pjw.21.1681764780697; Mon, 17 Apr 2023 13:53:00 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:00 -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, "Vishal Moola (Oracle)" Subject: [PATCH 11/33] mm: Convert ptlock_free() to use ptdescs Date: Mon, 17 Apr 2023 13:50:26 -0700 Message-Id: <20230417205048.15870-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ria6wfar4zftc3e6xh44714ebw6qtdz9 X-Rspamd-Queue-Id: 7B1F28000B X-HE-Tag: 1681764781-89734 X-HE-Meta: U2FsdGVkX18CCruIihucx4u2Pop/xyg1UlSkfhpSyxgrUzQYdIjnWE+9S8p803YS08G4wMcVxi9RA7LclBGHpZ5MUctluejZ29BC0AlofZMb9WLkf8TnCjP9jzOw40nlKakq0zlYtKPqxUrVOt82qI1AO0WdvySFF2yw4v6L9SR8C1J4yAshlp3CmIfS5BUPojHI1Lx7arElU+YWA+px3OC8xIakttxcauaRW6LDR/SxAXb5jAjeQfdXgfx01Ds104brW53pj2J3dmtF3qgu2dKedKc+c0NVTy3PDaLK4JxNF67UtQnoEGkxawmGFbWQCO7WW03jSk1lLN+FIw14UuRq122wIv+Qi4PISkbqSKfHHw1CYbmmk+qtSfC9pjqP5G/bhV7bT/NN4+TBNeT4ZvQT12iDzIuP9NSE7pX6TCTuNsuAiT7NJwk6KDQGM7RVMdq789mZwHFO8C5NLblCt4FpXtwir0RAwFqvYM9WSx6tPsmTsHFNBGoPN702y9n9lIS2yERqK6HYjGb9g3IO3uJGVmdoWtWPdt6LHla6rlyyQTUK8aMfdwyBtnW4LAKu03vL4sED9xMH1e0Lfciq/j1f3VAAMoJr7XaTWaadYfehJMuF+oRLqsk/mquX+J0+k0Pqq4MXqOiaQTQOOojA2a4MreNuA0vBk29N3+pswXqtbJcmVQFnQNIe8MkF7iIaH2byfsBMj3lcX0QO05ySNe09xfj7o6lVwqLEG1gjksfUJhKHUS/FyyLRuDUmzPXMTxzm+yTfatHIORm1acHX5Xht4jxrh4AdFNcx2QZCoTTLJ7pL0eVNk/UflE06S24SYvHKnTbGaYG59CfjjGL/RH6iGbD58qWKhm57ESoisvkDr2XjD46WzM2fd2qiKi+MDPYyEVtq0uyjzpl5KyFczhh6bLdfPTyjZNko7BxMjNzfmY3jPLcbzvBAW6duQwDp7e+CGOW+I6hvQ/TOVC8 sVbCyTrb Ug1sXdTjYsRyu4btdsuoMoUGLsVIZ7sW6kOvwEH2Cugolo3G8+rS/67N63HbzuA5MKTZtln+63YbW6rr+wiH6XT7G7x2FQTBcE673xRi9oqNyIFCddP3STjjZwijRJ0YlSwDkcIme/+muSot6+ZUkyje5YvrTJp84My4H8K/dBIkDIUoV7Q8sIIPMu42uF3CVPhloDV7J73QA3UDWqwo1ryk4MbIyJbkRh30qwQIe+NuKx+7C8TPe16BPFdEU7+2rhRZJPeVOffzzzoBVhIeDRNr+MDXTKjM4qY6ZhLEzW3dMOIDns8vLT33hIOou1GFuYRi8/3H8eFoYlqIWT8mReJQ6/TE/TjEGL4Na9ie8juJLfkTkwIt5dDDnBfLZ2fMTmHL1vsLxhcn2jWWUOwy3uU/EyidcJkJEOpGiugUqwshFJaLPIBL6guXWtW2XGYfDXXyag+G1osSIzyux4PJFspWAdrDuIla87zDGGSK9R6KcIyWvMR3mIamchbCsboEMMJssOgi00+vwmpzXJY4mcczP4z0EDDuH8dxiqZyp7Df0DLGR21VD6Hjs7kxBme16GFxSzIbdfvHKPplBunaKuJLIog== 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 2390fc2542aa..17a64cfd1430 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,7 +2787,7 @@ static inline void ptdesc_clear(void *x) #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2803,7 +2803,7 @@ static inline bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2844,7 +2844,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2858,7 +2858,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page) static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -2916,7 +2916,7 @@ static inline void pmd_ptlock_free(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) diff --git a/mm/memory.c b/mm/memory.c index 37d408ac1b8d..ca74425c9405 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5937,8 +5937,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif From patchwork Mon Apr 17 20:50:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214571 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 45D24C77B7C for ; Mon, 17 Apr 2023 20:53:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4ECC5280001; Mon, 17 Apr 2023 16:53:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 473E1900004; Mon, 17 Apr 2023 16:53:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25167280001; Mon, 17 Apr 2023 16:53:05 -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 1679F900004 for ; Mon, 17 Apr 2023 16:53:05 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E56F716055E for ; Mon, 17 Apr 2023 20:53:04 +0000 (UTC) X-FDA: 80692082688.13.011E9EA Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf18.hostedemail.com (Postfix) with ESMTP id 22B991C0005 for ; Mon, 17 Apr 2023 20:53:02 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Fq/GP8pc"; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764783; 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=WrZX7kBoYSlYOsS+wVtDQN8RsK5AFCnoOOzdjwi5Mms=; b=lQfCWXRSMubwFB6VdEvYqheLZzPS1UNWXDksWHmGVkKC9iH44rG1zy0nIINvKavJ8KdvNZ r+QLK6cj/UA+20Zirv148LgTW8mlIK5TjJwhsUCW5A2DLpHsfNFf5E6A6P5aiPtJJ7dA10 DEW/m4fdyWDskpBm3phNRI4vtox8YUA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Fq/GP8pc"; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764783; a=rsa-sha256; cv=none; b=FqFjgoMB2S6oGaTz3otVCHnnkxD5wP99x0m+WiHOy/e/CAt2xcm5E5aYdZy2sBN/M8k/jj f+C9G7y5uQgjCG2u+Z3M97RYF2E9lnuhGyw9egVbbnxr4pv/Oo9gmefIp30aKuj21ekQ2/ GVDAlvsjraS5J9VLw61q1QLXZ0EDJoI= Received: by mail-pl1-f176.google.com with SMTP id l21so9393475pla.5 for ; Mon, 17 Apr 2023 13:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764782; x=1684356782; 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=WrZX7kBoYSlYOsS+wVtDQN8RsK5AFCnoOOzdjwi5Mms=; b=Fq/GP8pcdLi4I5bPiFEsvLaXpxmzLee60TMK8PZJIeuQRzzOkEw4LNRxem1TjMHkl4 hpoJjh3mkwkBNIc+7ZgY54HKylkrI6wgo3KFZgMqWIFkgvOs6SvSJyDnyNXKU57Vfgni F3o9PaXHz7p6eZRgp/mKtHM6HxVxSp+JnGgjpmMtA2nsWbkEb7dNgfcs3WzKBla+e/KK mEc/vn9ckYnWIktc03O3OhGV7y0sYxPsn1QEH3DBGZVQjs25sE8N0p2VjcijmIU6liuv XPjI1oYrX0OJGyw0BE4l6r4tCUbdIF44UY/L4uGFZKlEP+7PRKuryCCDJJcwRQi8c96H TYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764782; x=1684356782; 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=WrZX7kBoYSlYOsS+wVtDQN8RsK5AFCnoOOzdjwi5Mms=; b=VtP2zFhJ52EzAFod8U0HXHJHiYOsBxzBTul7BzfzWZtJlLH+nRHke0OerjXJ83X9rJ GbqZajUOm0CjSihLqp3LXJzk/7jZbyKSVudOmaWC5smaP7RmItOhZNDi9V6JE9bND0cy 7NxLjUezbeOjFzNBdtfEH0q/wOr6Xj7nzepIBHqbPh2qXr52N/uQZAojACpDT79JlAn2 xs9NZXS7x5+rlXwgeMsNZJKvZsYtXeZ/mKMHXxe+NiCP2nCPpTrxY/JNMEUgBSM8xq1Z 7K9WluOuGlA2cuLUJqioJMY7QjVYLaqNFYuyRcixv7tgSdhtLGoK/DgvzWJvhBdwvxaB H23Q== X-Gm-Message-State: AAQBX9fmc66gXrICgxCKYAqw0YmdC9IWRAnATn03eyeY5Gmn7PgIE473 xO9XaclW4b+OekCuNHlYTSI= X-Google-Smtp-Source: AKy350ZKSmY2j825YUr7PKp4UY4ecmOCun/8MK3oszIbqT0tc1tYYx3cO7v8JESnTYGwYaXHIhiESg== X-Received: by 2002:a17:902:ecd2:b0:1a6:9671:253e with SMTP id a18-20020a170902ecd200b001a69671253emr219179plh.47.1681764781984; Mon, 17 Apr 2023 13:53:01 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:01 -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, "Vishal Moola (Oracle)" Subject: [PATCH 12/33] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 17 Apr 2023 13:50:27 -0700 Message-Id: <20230417205048.15870-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 22B991C0005 X-Stat-Signature: zy87h38uc9uu3sqab5tr3qagqqjei8ae X-Rspam-User: X-HE-Tag: 1681764782-945206 X-HE-Meta: U2FsdGVkX1/XDxunHW3/frISaOYlhrvz4zlOZACzuHAErGq5+8bknxtYZC4F+d+xrf9cO1stDcJhVNQfGYdZFBWfLh3Pm/nUv8sfiPH1ADfr+8mjGOpooGjK+MdwWumUoCvsI+4Au8sACsi2bbq4ExYhDu6m/f6aYjrJKrKSFnD8EV49/NE36TW0NpgeCsHSChYgXDM7mjrMTNbzDU2F3Xo2ydcgrGyUu8rEr/nHjUO9/tuKwOle5UAJKgNFAiEjIE2Tkhb7b5uwi/gbnVqrjXuWYfFdCjDwlqVEmnbvsThO+amCXzpgy4cKUGnJxNjIzVoOtrhn92fBaEL6Nol94fMpH2H3ziCE6pqJeu0sYYN7KSxHgCnbttCXtrXZCXbit0t5/dtY3N8FPZ7eOfymm4p6d92y80fWetEHH1EG1j0NeXuqE2R3/BzCCUwIXLz0J03h8xfwVCbrk9Az9ow2iHpWuaILBZgQbhJdiMuNAPXfozdFze4SGzZu24Qm0U7Zo6rl9lxiqDajTsd/i1fhWnWNf2CyiAgC9QJFThOUuKzW/YuenoaLZPFGf7QBzbob2wHWYnGOjLzzhMFFtz+ciQ2KTIZA1OK+wecE1q2GdKlAl8RLp+V+0OT2mYYKYfr2eD2ZHCXsjGrh/+viBrxdp0s9XGpXA9zBZXriyjEahi4dOgNQ8GYw1T12+qEot7McapowyBeHqdNgeQfKG+2w5sFVsZgHkQwvCxL0JsfUGH8FVB4DODCX77cFSv4c6iX+FtMudnOc0alKfqFOnbHcTJHlzeIbtfEtbmiEgHutAXUD1J6KNVlm2OSB52P5OGvofSgQ1BcWdS/0gfgJrWhc/o3XGSxW2XJXNLHdBmVIZoG0y3G3hw+OVK+w5RgoNsBINsDR+qhS+dh8ekGOueEwQGXW/0R4rCsvUE8LffxqPra850DVduhBGSLxap4+DQdE6PiqFdtHjihr0XsseL1 43Dlq+9d dungdrP1ogGiwiE2Um5Z/+u4aRBGj7LtBvYwhoAcXmbZyqCigTCgC/3+lOWQkV6xodrFqH2WP9/CV457EQYSZGkzH/Ec9j/+2Me1RkWzZIc9vttk513dDY9muJ3opWtDnb4SOOHNuABUNS8QSvVW/IV89/bthmhh++UvGuEDS2A9fU257lxbTbjxnsiDBfjK6FvyZtE2Q93ZL8+zwPylpYt6lSxjzWbfE51abW+Fut+uLm/ZzjSGup/0YZ+He6q+R6fqznxLfM3KwqvvIbgjXrC+tQAqnS7gkZ1hfOFLdAjKsFQ4h9IIGmGzY0SYuNz/UADV7UhsHnAo3SV1I0YXqX94E/bqVXEjlqxll8ZrvTvn2row67ZbsHfSYNOScd8CalCk8FqMkxA7deKR3dkc2v893vSXlUp1ugC9SMW5bUF+Kmfpe5Ur/yE+Y4SBVoDQX15thXuKI/TcVGus3DvtKPHPdanmbOXHKDUyRzFLp9egJW5l/3zGs+d6qKu8fI2TbyEguol4RNveM8soySkHGHXstvJ/nFZuY4EAeZp1549UKhWNY+wml0WV3KbrBubuMH8y/zQUcybzSaEOBFmjcsma9o5jK1uPOEGbO 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: Creates ptdesc_pte_ctor(), ptdesc_pmd_ctor(), ptdesc_pte_dtor(), and ptdesc_pmd_dtor() and make the original pgtable constructor/destructors wrappers. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 56 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 17a64cfd1430..cb136d2fdf74 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2847,20 +2847,34 @@ static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ -static inline bool pgtable_pte_page_ctor(struct page *page) +static inline bool ptdesc_pte_ctor(struct ptdesc *ptdesc) { - if (!ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __SetPageTable(&folio->page); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pte_page_ctor(struct page *page) +{ + return ptdesc_pte_ctor(page_ptdesc(page)); +} + +static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + ptlock_free(ptdesc); + __ClearPageTable(&folio->page); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + ptdesc_pte_dtor(page_ptdesc(page)); } #define pte_offset_map_lock(mm, pmd, address, ptlp) \ @@ -2942,20 +2956,34 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) return ptl; } -static inline bool pgtable_pmd_page_ctor(struct page *page) +static inline bool ptdesc_pmd_ctor(struct ptdesc *ptdesc) { - if (!pmd_ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!pmd_ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __SetPageTable(&folio->page); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pmd_page_ctor(struct page *page) +{ + return ptdesc_pmd_ctor(page_ptdesc(page)); +} + +static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + pmd_ptlock_free(ptdesc); + __ClearPageTable(&folio->page); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + ptdesc_pmd_dtor(page_ptdesc(page)); } /* From patchwork Mon Apr 17 20:50:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214572 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 07736C77B78 for ; Mon, 17 Apr 2023 20:53:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64F99280002; Mon, 17 Apr 2023 16:53:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FCDC900004; Mon, 17 Apr 2023 16:53:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 425BB280002; Mon, 17 Apr 2023 16:53:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 30C06900004 for ; Mon, 17 Apr 2023 16:53:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E9775140754 for ; Mon, 17 Apr 2023 20:53:05 +0000 (UTC) X-FDA: 80692082730.04.C7FA614 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 257EE180021 for ; Mon, 17 Apr 2023 20:53:04 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=i+wzmC4T; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 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=1681764784; 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=WiO1HawkIhn5Pxy3bGXHIBKOPwk6qSqlLgZYbsR783I=; b=i2hyVxV977idLue0sdwRTqy3Yv1UHTQ7dNsCBbso/Oo2bxnokUg+W5TMRbDnEZQT5cOU5b zOkm2SfA2aj5oIMTTazOiP4A3U3n4kW89GGpy1DuL/ViikTumMPI/ezD/P2PSxcaRm/g69 FAKpn4+y00twJc2YTw5AN8S/LwlTUQg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=i+wzmC4T; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681764784; a=rsa-sha256; cv=none; b=SNFtyp4bTEraMW8qk2JGDzdYbiHH3+Z+zv/SEkH2d808UrPurjhpA6YpQpw2GKdkxr+cfi m5FbV3si3Ssmq3XWFv22J1VfD7KxEblR4ob4ATzVGdGFdJRlrIEs/DR2WqI70glr21yTlN ChlhD9TQYWe70T5/voztiST5Jo6+Tk4= Received: by mail-pl1-f172.google.com with SMTP id w11so27335965plp.13 for ; Mon, 17 Apr 2023 13:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764783; x=1684356783; 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=WiO1HawkIhn5Pxy3bGXHIBKOPwk6qSqlLgZYbsR783I=; b=i+wzmC4THa/GsSihCeauBzLBRwN2BkRSUDfwFHkQgHnG3pkWReRH8MPN+shfgDqHTj IeqmXv7VhbjU+1u0UCoy1GJsHdeP9LwybB0OHvKEyW1YIxBwbDPSb41pvZGpSpOpMkiQ WphjKneGpmymAtIBRE8JTRbqkCrOvlbdVWpBDf/QtnTqQmVA9yQNunQ+rFi4omAX2wkV RN+R+ZBLGm6OPOimIfvRu38tdAQhoIVp1Mn1HnU9Gwaf7SKiulzeceUhW9g6F763mHYB xGmH5zofQsKiypu290WAifFetv+03PwrQODgzNDZ7SB6mx5PwXcbwgLkn67IOgTYLm5f HyhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764783; x=1684356783; 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=WiO1HawkIhn5Pxy3bGXHIBKOPwk6qSqlLgZYbsR783I=; b=TZZkW0uY9Xiyj/Egms3LKlzyToBVHhZHoe1T2LZJ6TJpjsd3Om1V/iRQkScN90Yb6A sw4k3y465yH1Iedr29d4tzaoEzw2kGsyZ5GN6UNcANwmgHfTXI5RNJdpOkR6dox2kTtZ Gqo2kanVaHQ1aEb4UXunk88Nkelz9iAaGVcNRJqBfYRdgPrRgPMY1H87tISV5Mgt3Ot+ 1ujHBySDbT9KGrtJAP00r6cIQLijKiFuLOquarHCfj03BJx+WejHnDLKrWqogPM7S5b7 EySHcgQfVvtY+OLDqzds5noHUxaD3aoGxRkOfJB95KrRvmb9H3xVBf06JJY+hjR6zuY8 4s+Q== X-Gm-Message-State: AAQBX9e1R5cHe+TbfPK3aogVGCOpsGDrvE/2XKHIuL+kPlGIhZBFPm2e JNT03Oct0l6NN2E5nrJEjPq/Xoj4a9LtXQ== X-Google-Smtp-Source: AKy350ZsayM5AzK3U9g9Pm56Yxkj5Ek92aNaeMW1rTxdVse4fOpzec7lc2oZYj+3ilv2TEF1mDgQ5A== X-Received: by 2002:a17:90b:4f8f:b0:23f:58d6:b532 with SMTP id qe15-20020a17090b4f8f00b0023f58d6b532mr15289201pjb.5.1681764783502; Mon, 17 Apr 2023 13:53:03 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:03 -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, "Vishal Moola (Oracle)" Subject: [PATCH 13/33] powerpc: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:28 -0700 Message-Id: <20230417205048.15870-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 257EE180021 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: xs36bk9m1ru3tqafmarkn5rfrcact7ja X-HE-Tag: 1681764783-651143 X-HE-Meta: U2FsdGVkX18GsHyN1eUJtenjO3vJFwVj27EYT70D3NDyGhaFDpQpNBIk0pon51g1fWbRtQVXoFP7D8HR9pl1MeC9lC0O+6FwqH3sG7SjhgPhGrG5YKau2NDKwGCpnAjVBm+aa2m7MezccXLAwy7QpZO+yfsuay+F3QqFglAjWEhGrUV+7tkrOGkG0UMb6tMn0WGYRVvMuDFpayxb4z1ThjAmFlUzaRfaCmlAE39J63lkajof0Mo6CN0PZeKpJYpvZnSZZB3jcVlu3kx5Fkli8RyQyrVJJp001d4rLmwsXDJgIeCBY+JQNgDZoclS9BzIO0VBwY308A+VDTClroYrGjXDSCS7+Edc7yHB1Ea87HitZrq6dmaseEH/3XDkH7r0Dtum21OY+Mu7k8pSDx/NQEalVtdMfpIH4rqPZcHsJYMqHfG+4vXkvrwO0N+Hxx5lAOWASYhDZ+DbCc1wmCbpZ+Grx+cpOEG0hgnjAnJaT+VO2mnfSu9zUDBwOOgyORWuz4cS+WdhMXQsflscryHoBqm2a/igW8x6lzwzTf6X5D9d8X+R54ufcfCL6Y7ER9crf2aUwD7KDDrqUPj2Ng5Etl53Tl993GU887F/r46wxdb2zlPzEQqzsaHZlnYILZnSYSwOELqmkzWL58HWO+zVfexLlcmNCQ5WsBTd2O3IIdfJx3fP4gWEZMYWbhlVZ7D193ARwvVb3v9IzJt3e1oRLiNCDDNyh02e1lGBT6r1iLrTCWaEYjrSpxhocCtK6TI3BoWWjDrkodclT7Bxp/QYpWZUw1tYb6tp0KLvN2I+CQCEZRV3K7cMhpbNwxcPtsYIJOrtAgdCKDb9CGHQcAfzBj9hrvV20NlPkO+wtTsbK0aKTaCmf8s5TrYEA/Z2Ap1CtJmPdUXoUu+jyH2XfdkNNvthDhS7bq0GohutYvj3uZUZ1r5Xe88VjO6s+7URdG4Z6aSmJh8n2j7eFfcoaFQ vawc70F9 6hEphcd9QGwls5Ih5a7PuX7TPpTdae+ilZnJrSLsXXpZS4poZ7yXiKlZkyk5pC0Z37vwVb8cNNaU3z0H1q5x+mCEkJSHEvXuCB+Mcidok1ww45mwvqJWMTrXBqPZZb+b8nBKis503ZFxnTXXamQ2iWr46Nv7dmfArVqKBRHlZFvkQ7cayDgbdfEkPkRn6IpVkUgfE2Oq7Zunmnmm2zwhiiFDQEkjYvSkjY5stjuKTKmxxIapgh83lDpo1Fpw+Z7xtwjBrwgV9QLKtAv2gzEs+sfyqHaYuXFdgOoLvdypoLlZeJ1iJiJE1D54oNCtNSHAlTMRyHDT85aDq1Wh/Yhy0ILquYUpjPLxJNN51FweosTu0SUljQNTo/HwwGdNtSzZMp37TD6OeA+5ac0AJaBRKMoKhuv4+KPQK6OEq49WjZgkcmlPkzSJ2PS/1CC26abyORQxFqRw2mRxBDNfGDm9Oim81ZoBEHmP7mlL9mJq9GiwB3fmtgZW61Dg8GJYviirc2B99csC+r9a/rYFmHDkNKObeWh3Q0mOxppvP5F7lKqtc3kH3o9ON1HHq4o2Q+tqS/HbV+7UhFRKIDg+ZPeGhrd047A== 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: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) --- arch/powerpc/mm/book3s64/mmu_context.c | 10 +++--- arch/powerpc/mm/book3s64/pgtable.c | 32 +++++++++--------- arch/powerpc/mm/pgtable-frag.c | 46 +++++++++++++------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/mm/book3s64/mmu_context.c b/arch/powerpc/mm/book3s64/mmu_context.c index c766e4c26e42..b22ad2839897 100644 --- a/arch/powerpc/mm/book3s64/mmu_context.c +++ b/arch/powerpc/mm/book3s64/mmu_context.c @@ -246,15 +246,15 @@ static void destroy_contexts(mm_context_t *ctx) static void pmd_frag_destroy(void *pmd_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pmd_frag); + ptdesc = virt_to_ptdesc(pmd_frag); /* drop all the pending references */ count = ((unsigned long)pmd_frag & ~PAGE_MASK) >> PMD_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PMD_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PMD_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } } diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 85c84e89e3ea..7693be80c0f9 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -306,22 +306,22 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm) static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO; if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; - page = alloc_page(gfp); - if (!page) + ptdesc = ptdesc_alloc(gfp); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_pages(page, 0); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -331,12 +331,12 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!mm->context.pmd_frag)) { - atomic_set(&page->pt_frag_refcount, PMD_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PMD_FRAG_NR); mm->context.pmd_frag = ret + PMD_FRAG_SIZE; } spin_unlock(&mm->page_table_lock); @@ -357,15 +357,15 @@ pmd_t *pmd_fragment_alloc(struct mm_struct *mm, unsigned long vmaddr) void pmd_fragment_free(unsigned long *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); - if (PageReserved(page)) - return free_reserved_page(page); + if (ptdesc_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } } diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 20652daa1d7e..cf08831fa7c3 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -18,15 +18,15 @@ void pte_frag_destroy(void *pte_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pte_frag); + ptdesc = virt_to_ptdesc(pte_frag); /* drop all the pending references */ count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pte_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PTE_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } } @@ -55,25 +55,25 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm) static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; if (!kernel) { - page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT); - if (!page) + ptdesc = ptdesc_alloc(PGALLOC_GFP | __GFP_ACCOUNT); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } } else { - page = alloc_page(PGALLOC_GFP); - if (!page) + ptdesc = ptdesc_alloc(PGALLOC_GFP); + if (!ptdesc) return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -82,12 +82,12 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) return ret; spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { - atomic_set(&page->pt_frag_refcount, PTE_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PTE_FRAG_NR); pte_frag_set(&mm->context, ret + PTE_FRAG_SIZE); } spin_unlock(&mm->page_table_lock); @@ -108,15 +108,15 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) void pte_fragment_free(unsigned long *table, int kernel) { - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); - if (PageReserved(page)) - return free_reserved_page(page); + if (ptdesc_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (!kernel) - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } } From patchwork Mon Apr 17 20:50:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214573 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 14266C77B72 for ; Mon, 17 Apr 2023 20:53:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55FDC280003; Mon, 17 Apr 2023 16:53:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E9C2900004; Mon, 17 Apr 2023 16:53:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38C6F280003; Mon, 17 Apr 2023 16:53:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 24BEB900004 for ; Mon, 17 Apr 2023 16:53:08 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EC2A680670 for ; Mon, 17 Apr 2023 20:53:07 +0000 (UTC) X-FDA: 80692082814.19.61C6AC4 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf16.hostedemail.com (Postfix) with ESMTP id 26B88180021 for ; Mon, 17 Apr 2023 20:53:05 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oN3WN3Fa; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764786; a=rsa-sha256; cv=none; b=HvCC8wWTdnFs7As905tl+7oXRgyNh4z9ZU2TzhNsmHAIScF03igBngI47P4KtCORBP5pyl WXPwQODQU6E23cXaJHBGC8xlsYt8QdHlbtz71l65FIjZmyWSjbHT+l7veK7sJO+C65tXUp cO29LyG/PekDM/VLBcM1D/1U24Kcgrg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oN3WN3Fa; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764786; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=q3l25Vxu7MH98t0SzTmoQQcnttg70lhxrgqaKeMqF575UtBwDRW5XQyAYDI+XEL5QypIlo 0Sw13cA++opJ7jIL8mXK8bQ9QklVYtJF/+SEPQfieuwANaUmCNiKoiW9kSr9iO+HQR4rvw npH5Wc2BeysN6vPhyhvWbvPuXNaUdNk= Received: by mail-pj1-f49.google.com with SMTP id sj1-20020a17090b2d8100b00247bd1a66d4so1717233pjb.5 for ; Mon, 17 Apr 2023 13:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764785; x=1684356785; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=oN3WN3FaawXE5CF6Cg/W/uIlOgFpp+g16jZXog0VNnI/qtOkBdWsDVehFGMED7dn5+ e56tIJJLtydkdncbDj6EgMfHci5dsJ/ubCUoN7HG1abvk1Sxq0PSQWiGjWfSNWnYoCUZ iexosl+123qGqL0uhQqkt6/lQEj+ZZbGmt11o31Lgc0lv69E3YkAOFWPJgHBPxqW6Hcs AY1JBassDB9z9gn7HCEtsHeuw7WKOVmcQJj/XwZLajgpzdXqkSttOF9JB8ZOKpdhpqCp KcapkWtUG6onUSGsHkpFKHhWq2wTFC19ykRFpbUoVueZkn9rzc97nSY2du8bEMz2qr3M LcZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764785; x=1684356785; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=Hd3tBZrTul1zT+0UMbbVgII+hehbEju8JVZuReASmiv5jibqpOUVSEuw/94paHPqZg i5HBUO75aU9TLvLSlh5AZLsM5uF49J6lnwG7yzb42A76C4aRNUxCxIi5urQJ69zTymBh ppkRzyWXiU3uSmEIQmbrf41RiEhoB/E7t3GO1c+s2PS+dhY+v0sLlLAEbneAIFS7pS2O N402pydMFmWL/3Dw8N1ihH0mn7eUFRw482Q87VAuiDMkOBjoCqhB5S0YptyHCTA6TOPN iwI6PA1xqChhsPZ6e5BYUGPIUa9PN+A50dAax68G0UDgl6wE3+5yBQjey7/EH3jhz7Jv mmPQ== X-Gm-Message-State: AAQBX9e01TMzbmhEqE1H5ble0/ucD2L6CHsxkRIfj1gwbS/egFtd6p+G dclcQBTsilu5KwBKCCbUtU0= X-Google-Smtp-Source: AKy350bQu6z/qcpmnOWvPCYz19t9kGfi+ogJbAChD8E648rYRlxNxJTxaR2oZuddVpCSFFn5irXClA== X-Received: by 2002:a17:90b:4d81:b0:240:7f0d:9232 with SMTP id oj1-20020a17090b4d8100b002407f0d9232mr16482647pjb.3.1681764785136; Mon, 17 Apr 2023 13:53:05 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:04 -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, "Vishal Moola (Oracle)" Subject: [PATCH 14/33] x86: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:29 -0700 Message-Id: <20230417205048.15870-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 26B88180021 X-Rspamd-Server: rspam01 X-Stat-Signature: 8mjr8qdfgshcfbxw3gyfggs7hzzwpbdu X-HE-Tag: 1681764785-776115 X-HE-Meta: U2FsdGVkX18sxD1FKJEOTxMYMgJpraMvhdjPOrLGrR/cr0+dtfKc7NmqQZlf2DmM4c5wyB9Iov7k66vq2qoOw7lUHjF83ZuQFYl9B9ANnm8Zla38hxZkACGozmYNmM8Gj/It9O5Esp0Qch+T+OU3yOncHZ63dQMNrlQ77twAqzLcw/hTMy/9dv+MJc2Np9piVyYySQgiH6VwkzseH5OBkYEKc5KMN+1rIpIAfCHuKef3HN2LdzYHMAgBVh3PQscLfyilmgFmwjf5DCkv+EDVkU3Oron1hVBHaeeJHouIE0R107OOKYJ8wgYAAiqo8aBBr8sZGHbm9NEYKxhkbUKFh+9t/lLYTok0AzCHFD5erh3vm89b19e5lxTDleheEw/OJr1xzWA39mczabxd+YoQ8VVtlxhpAyydBgfKKR1l8OYoxJfE10W36nAM/mskjfOUgvC45WwpI7gQrsmPGGkxDzCeSXHjeSKcl1WuhXH+hUXlNS1mTtqYhwPHn3B/jPRi/8N8tsVHlWi7gu0eAdWKjhDtWr64cZ0lclCJ+NgWWTeORt3aAMHqoCBqt++7tvg8MTCWfpZmTZ0rE2areAiVeuizG8sn+kwAxdB+hFC1qIXOsP6jbglp4FYzrw3AtOnwAIcbhg8IHmCoyw5ReAKqDMXGRyw1jBQgWWYiKxnOdRJXKIcd03x7sRtJ8IKgwfyAeZsONrlrdYdNgd4hrIQF9P+b3ldZIzC8Qp0dGga/GMCnqDKmrKDSHHcjbSfZRos31puErKaCjBoyxBOakKOyfsvCm0KpZ7Q64dxmd/SrY4naCSx+r8YKvGi02GThGsP+vXUPI4IqIGDM56e6LbM6AxO1tmH2FNIdx2tZ48aqwsfEj16EhjuhckzsUdYtkHSVjb6aW1xfujeWbOyoLw/nzHTVw5DT2LnGAF+E7ocVTD2LhtBv29TD3nK9KlE+L0w4Ba5uTxYaZn2/9vPMO25 OB7AWI37 pxd+O0qPqxxUiOdjFQCgr1XXKjGPnVfmdfntI0Dvle23vYrfONfnK2lYsrQgaRAjfSHHyKsN3Cvz3Rguqb0pTIkrJ5gEik7tIBEFu25jAMCJVwrIK0CaOTR6z6UO94rTX4TwMWp4tKX6S6G438hCHYEl9YBcb8fdocVX955vJ7ndbQfQAvaBJv2U/aO5oVRqqTXfLqst7t/Zn4bdf9F2rSNq+zU7XKx5BQ6hpo/MIkjqyTZPetRZfBHwyAlf9RfGBhl4/ikNTSKS5JjN5JHK4bGD+YyjVaefx9J2OG7JnvoJFkLTPUgvVEMYltF+dp5S84pRN0/N/wmMuVxXrUq5fvTLePx5SVp3/bkrk2EPoNfGBuuCQ6rVpCXDG7QQxCrrJJzX9FlkiDln+4FdJSgNFHo+QNrkIPuxJjIJDpm5F3D2xbIj3PrH9pZ43SsIeTb/eWPzHILMUZr07LPPlv8IdKXpGUxrqRNdBbkzFpHwCRRvRDa/pMr1hNnVSrQ/FQYI0jB8NMQ6930ymz8x78igpdVzptMAJbqQHKJw5/7mpYqCmqlw= 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: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/mm/pgtable.c | 46 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index afab0bc7862b..9b6f81c8eb32 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -52,7 +52,7 @@ early_param("userpte", setup_userpte); void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) { - pgtable_pte_page_dtor(pte); + ptdesc_pte_dtor(page_ptdesc(pte)); paravirt_release_pte(page_to_pfn(pte)); paravirt_tlb_remove_table(tlb, pte); } @@ -60,7 +60,7 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) #if CONFIG_PGTABLE_LEVELS > 2 void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); /* * NOTE! For PAE, any changes to the top page-directory-pointer-table @@ -69,8 +69,8 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) #ifdef CONFIG_X86_PAE tlb->need_flush_all = 1; #endif - pgtable_pmd_page_dtor(page); - paravirt_tlb_remove_table(tlb, page); + ptdesc_pmd_dtor(ptdesc); + paravirt_tlb_remove_table(tlb, ptdesc_page(ptdesc)); } #if CONFIG_PGTABLE_LEVELS > 3 @@ -92,16 +92,16 @@ void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d) static inline void pgd_list_add(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_add(&page->lru, &pgd_list); + list_add(&ptdesc->pt_list, &pgd_list); } static inline void pgd_list_del(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_del(&page->lru); + list_del(&ptdesc->pt_list); } #define UNSHARED_PTRS_PER_PGD \ @@ -112,12 +112,12 @@ static inline void pgd_list_del(pgd_t *pgd) static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm) { - virt_to_page(pgd)->pt_mm = mm; + virt_to_ptdesc(pgd)->pt_mm = mm; } struct mm_struct *pgd_page_get_mm(struct page *page) { - return page->pt_mm; + return page_ptdesc(page)->pt_mm; } static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) @@ -213,11 +213,14 @@ void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) static void free_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) { int i; + struct ptdesc *ptdesc; for (i = 0; i < count; i++) if (pmds[i]) { - pgtable_pmd_page_dtor(virt_to_page(pmds[i])); - free_page((unsigned long)pmds[i]); + ptdesc = virt_to_ptdesc(pmds[i]); + + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); mm_dec_nr_pmds(mm); } } @@ -232,16 +235,21 @@ static int preallocate_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) gfp &= ~__GFP_ACCOUNT; for (i = 0; i < count; i++) { - pmd_t *pmd = (pmd_t *)__get_free_page(gfp); - if (!pmd) + pmd_t *pmd = NULL; + struct ptdesc *ptdesc = ptdesc_alloc(gfp, 0); + + if (!ptdesc) failed = true; - if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) { - free_page((unsigned long)pmd); - pmd = NULL; + if (ptdesc && !ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); + ptdesc = NULL; failed = true; } - if (pmd) + if (ptdesc) { mm_inc_nr_pmds(mm); + pmd = (pmd_t *)ptdesc_address(ptdesc); + } + pmds[i] = pmd; } @@ -838,7 +846,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr) free_page((unsigned long)pmd_sv); - pgtable_pmd_page_dtor(virt_to_page(pmd)); + ptdesc_pmd_dtor(virt_to_ptdesc(pmd)); free_page((unsigned long)pmd); return 1; From patchwork Mon Apr 17 20:50:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214574 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 627DBC77B78 for ; Mon, 17 Apr 2023 20:53:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 168AA900004; Mon, 17 Apr 2023 16:53:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A4AD900003; Mon, 17 Apr 2023 16:53:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9B3B900004; Mon, 17 Apr 2023 16:53:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C3490900003 for ; Mon, 17 Apr 2023 16:53:09 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9C4FEA066B for ; Mon, 17 Apr 2023 20:53:09 +0000 (UTC) X-FDA: 80692082898.13.5C720F0 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf29.hostedemail.com (Postfix) with ESMTP id CCA1D120010 for ; Mon, 17 Apr 2023 20:53:07 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doNd2TAU; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764787; 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=oL7THI6COKAZs945t/ufo2xvJ6u97lYjYyNIJW1c0dQ=; b=na4byq5eQcsY6aw236x/ZRCl0S4AJ+OZYX8AsMAMf3w5FW8G8xZOsqiKUP7PgrNY8vTZEk L1H/RsxPvPw8m856Zo2czDUC+L0Cb69Owqc5ctE0e/eDQxPcZTUO0/iiFMCkQydBLTtb3d qlOlMtqWSNgVIQncbPD1xiBxqq6Hxc8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doNd2TAU; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764787; a=rsa-sha256; cv=none; b=FcpK0/MqPhZyMD343YjdU7/8N5nHHLZGttm8zMWdeUflSKGXKtSmoueFFgcwnITiBHHP6p rCgaK0jMfNqsoO3QlM0pY2R+noy5Aw8kn/noIyoGjyWfzjFZ35AQUdMCE8lbvx9JFNLHYo bAZbdsI59TYsHUfxzBMzeFE7QrAEuQI= Received: by mail-pl1-f176.google.com with SMTP id q2so32217059pll.7 for ; Mon, 17 Apr 2023 13:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764786; x=1684356786; 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=oL7THI6COKAZs945t/ufo2xvJ6u97lYjYyNIJW1c0dQ=; b=doNd2TAUyyyVhrEHrHJgS8adO/z3uWhCb50/lQYlJdk5oqIjZwFvTJlGFJ89/QBcif 8imrD8TFaRte2p5w0KyYL2OFgHoMnHEPcvjiPP5MaiHba2amKVAMgresLNg9DoMmTCzS PUuzaVsdF5ThP0OKEtKVPgORmoth5LctgfKQpFi3NQhv2sSntUA0rqVkNtUltdbMYKjo vztqHLhdDPahrz8LgoZyQMd0QcyNEvkeUbtOTxQhJimZ8P9c4sf1Y5B8mePYpgeVVI0l u553/In38aRZGgvsmj1RZFHLxXeA0/2uAaIsm3kC5sKW6TY7wXshXxHWLV3FZoGUXIIW 7irQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764786; x=1684356786; 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=oL7THI6COKAZs945t/ufo2xvJ6u97lYjYyNIJW1c0dQ=; b=JcZ2BHSQFkAVaKkw5X6vR+UYk3Tcal05lujEk94ovQQYd+BQGjfXtUBkoIYE3V8heI xxY5wJVuYuOgOtUFsyG27p33P4dvqf2toO7CEF9NsHkQbglgQMtgU32eC5iBSf2fq0Zs L/WFcKU/qXcFoy730j15TEQc5GDVM1H2EQeuQny51nf/9PjbTcIDvEO5TwsLN0BVmJ0y AIEEb/gkYct1xXbZrrXqXJ3dEbpczUqEjeJc8erEFvyARcAt7CRNl/iezZ27ZfCEIPYB AjyNO2/5mQW5AbSpI5RLYIEjJnGiV9t1APhIVSkJFXBuf1C7YmmGe2fyxNWZwcYWdfM4 noWw== X-Gm-Message-State: AAQBX9f1Nt1Xlx/JCBNI/kuYxleX6Zod8Lp11QOThg2rRKGXyYYrovsr Yh5EzW+QDkeEPdGKhg500eQ= X-Google-Smtp-Source: AKy350a3sfSYyKQBZCHGHLi0XTtVBj1S8oso+4y2+ULnoZrU3jXoGaDkpnKpDVzrixRlynGGGLFh9Q== X-Received: by 2002:a05:6a20:7d9b:b0:f0:6d71:5f58 with SMTP id v27-20020a056a207d9b00b000f06d715f58mr1513174pzj.50.1681764786395; Mon, 17 Apr 2023 13:53:06 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:06 -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, "Vishal Moola (Oracle)" Subject: [PATCH 15/33] s390: Convert various gmap functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:30 -0700 Message-Id: <20230417205048.15870-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CCA1D120010 X-Stat-Signature: rxwt3rizsbkkox7numiorgjb539zw8su X-HE-Tag: 1681764787-972260 X-HE-Meta: U2FsdGVkX1+0SaQ7TpWeXQu1RKquuzZeMXDdzH1kf0MlsypVvrYkuojP91xFYZ2Ng4QbLuwCs8E8WurvlHbrEpAyJ69U/pZ43r7fXNFMvn9ecfFXdamuPgyaRJkAv1SSBF8Bx4p2UI2jLONry0p7KZfdqZrJ1b3lAxXH21KUCfv2rnLRqTVWaXJDeDzEbx8JoZaHMP36lCViHAFS4DhvV6Ni1mhTMtuDSGJpeYThUrMZF9IUOW3K4pmLEDhhjynEM5DjjNsjDSzL7j8YqbOseT8F7SJQU0sejnSZHtxEgkUaZn+nnVe+D6QDc2U5Y4l5cIHJq4dhKqk1+fP2++BaTQbf9/1VEhJZ9X2M2GbPidXkZJPi0B1AEF+j3HWKlyKdgaL+afawGaR3mhZXYuiSpouhFTmWITf8TUlcPbg1+3hh+V1tM5HAEOJ6asKGIy+pddoItjLgglHWgWZa7nFwwBxmGW9zH/WhgpQMGrN//Hx/aSKd2UAr5JyzSVm/bI5Zn0YVPFa2M5NVnYfALlKgjkeKoUrpXOE/k3YWKRULJ1qOi37xq6ytz3WUmMIF5awtuGUmhBa9M4I090Di9JHbYitt79ShJ8bpaYrVT2Phs8rWyXw86+ZnumdAzhCuXmNBGlmaN7NfqaR055kI9NJDAcxrcXwpq0UNhahrSwR1DSqijyQEacH/e/zSiU5qu5zPJ6fjlV3oQQP68yRavep+gUJgoH6owmosSyZUigeaTABeAPrataU4TLJYT2MNF27HwnpgjPyA4E4ZhqdYJyXxLgvkVJ9YcuK+HIpSgPPstHCMzPhil7hdSnmGndgO5eSZEpydhl6dM1aFb5MRw2NI5+H2+BkFrB+KWWblB0geagi7NRRjBkc6DLGsRACwAi+c1zyl+Jr8i0rOKvfXqdkUiz3ttS8uVZ7pFjEpf/K1xuhO/91zreP+0sLtHFXK+R2quxbKmH0v+n09G/937sY 6HppNUoB gN0cpgzMSOJ7or0ZJ25IvCs1Wt1jngEDU68oiTmdL3D9P0Im3Y93n7O2yN922ZCmvq6WL/1n69tPTxUcLXMxgfvGYfBu5amGBbFWfr4QZWqw/YqaYaH2nhfcyIvuHbuKZJhnbSpD8wxJQ43hlKt3+IFbH8H2JO1cPRKyGijoh76vyzxYUor0egyrZAfwN8IeKLPd2XLWO40DlJ73O9ryDcawu4UeYm5lUtZqOPTxqV54pjMiazBHLNxO+4VN2PDF3dGT8pic8yu9ZSVVdx9kgMQc3vBHRw3fmWdQIOPiGvc8m+NO9gMEKp6ue2ibOpyiqfN1wLnOz2X/VPXItqwb6ZYnIzx5jbn8y91wltoucx9AkwZ9O34kXFP9XZrSw7XphT/RnR2jOhOe0uDrSbMeaMup5OYPPntGxbm5hWr5bEkW7Jm0e4EB5U3+COMBHfLHfYTcHXmDdhhW5pgcnuOWmtgL3kWZMfXtaIyOu25NALtH4ExmGqignefTy2T+nnid5rIeuCXw0CilU4X3X19qiql4kugM2eT/twFHJ6OK7XfKbXcHUteomCc7+9rSMotZGW1BucM4IZsvSo80= 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: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/gmap.c | 230 ++++++++++++++++++++++++-------------------- 1 file changed, 128 insertions(+), 102 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index a61ea1a491dc..9c6ea1d16e09 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -34,7 +34,7 @@ static struct gmap *gmap_alloc(unsigned long limit) { struct gmap *gmap; - struct page *page; + struct ptdesc *ptdesc; unsigned long *table; unsigned long etype, atype; @@ -67,12 +67,12 @@ static struct gmap *gmap_alloc(unsigned long limit) spin_lock_init(&gmap->guest_table_lock); spin_lock_init(&gmap->shadow_lock); refcount_set(&gmap->ref_count, 1); - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) goto out_free; - page->_pt_s390_gaddr = 0; - list_add(&page->lru, &gmap->crst_list); - table = page_to_virt(page); + ptdesc->_pt_s390_gaddr = 0; + list_add(&ptdesc->pt_list, &gmap->crst_list); + table = ptdesc_to_virt(ptdesc); crst_table_init(table, etype); gmap->table = table; gmap->asce = atype | _ASCE_TABLE_LENGTH | @@ -181,25 +181,25 @@ static void gmap_rmap_radix_tree_free(struct radix_tree_root *root) */ static void gmap_free(struct gmap *gmap) { - struct page *page, *next; + struct ptdesc *ptdesc, *next; /* Flush tlb of all gmaps (if not already done for shadows) */ if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + list_for_each_entry_safe(ptdesc, next, &gmap->crst_list, pt_list) { + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { - /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + /* Free all ptdesc tables. */ + list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list) { + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ @@ -308,27 +308,27 @@ EXPORT_SYMBOL_GPL(gmap_get_enabled); static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, unsigned long init, unsigned long gaddr) { - struct page *page; + struct ptdesc *ptdesc; unsigned long *new; /* since we dont free the gmap table until gmap_free we can unlock */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - new = page_to_virt(page); + new = ptdesc_to_virt(ptdesc); crst_table_init(new, init); spin_lock(&gmap->guest_table_lock); if (*table & _REGION_ENTRY_INVALID) { - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->_pt_s390_gaddr = gaddr; - page = NULL; + ptdesc->_pt_s390_gaddr = gaddr; + ptdesc = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + if (ptdesc) { + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } return 0; } @@ -341,13 +341,13 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, */ static unsigned long __gmap_segment_gaddr(unsigned long *entry) { - struct page *page; + struct ptdesc *ptdesc; unsigned long offset; offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; - page = pmd_pgtable_page((pmd_t *) entry); - return page->_pt_s390_gaddr + offset; + ptdesc = pmd_ptdesc((pmd_t *) entry); + return ptdesc->_pt_s390_gaddr + offset; } /** @@ -1343,6 +1343,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) unsigned long *ste; phys_addr_t sto, pgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); ste = gmap_table_walk(sg, raddr, 1); /* get segment pointer */ @@ -1356,9 +1357,11 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } /** @@ -1372,9 +1375,10 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, unsigned long *sgt) { - struct page *page; phys_addr_t pgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _SEGMENT_SIZE) { @@ -1385,9 +1389,11 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } } @@ -1403,6 +1409,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) unsigned long r3o, *r3e; phys_addr_t sgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r3e = gmap_table_walk(sg, raddr, 2); /* get region-3 pointer */ @@ -1416,9 +1423,11 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1432,9 +1441,10 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, unsigned long *r3t) { - struct page *page; phys_addr_t sgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION3_SIZE) { @@ -1445,9 +1455,11 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1463,6 +1475,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) unsigned long r2o, *r2e; phys_addr_t r3t; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r2e = gmap_table_walk(sg, raddr, 3); /* get region-2 pointer */ @@ -1476,9 +1489,11 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1493,8 +1508,9 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, unsigned long *r2t) { phys_addr_t r3t; - struct page *page; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION2_SIZE) { @@ -1505,9 +1521,11 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1523,6 +1541,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) unsigned long r1o, *r1e; struct page *page; phys_addr_t r2t; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r1e = gmap_table_walk(sg, raddr, 4); /* get region-1 pointer */ @@ -1536,9 +1555,11 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r2t(sg, raddr, __va(r2t)); /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1556,6 +1577,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, struct page *page; phys_addr_t r2t; int i; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); asce = __pa(r1t) | _ASCE_TYPE_REGION1; @@ -1569,9 +1591,11 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, r1t[i] = _REGION1_ENTRY_EMPTY; /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1768,18 +1792,18 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r2t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r2t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r2t = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 4); /* get region-1 pointer */ @@ -1800,7 +1824,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, _REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r2t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1828,8 +1852,8 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r2t); @@ -1853,18 +1877,18 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r3t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r3t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r3t = page_to_phys(ptdesc); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 3); /* get region-2 pointer */ @@ -1885,7 +1909,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, _REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r3t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1913,8 +1937,8 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r3t); @@ -1938,18 +1962,18 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_sgt; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg) || (sgt & _REGION3_ENTRY_LARGE)); /* Allocate a shadow segment table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_sgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_sgt = page_to_phys(ptdesc); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 2); /* get region-3 pointer */ @@ -1970,7 +1994,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, _REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= sgt & _REGION_ENTRY_PROTECT; - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1998,8 +2022,8 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_sgt); @@ -2022,8 +2046,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, int *fake) { unsigned long *table; - struct page *page; int rc; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); spin_lock(&sg->guest_table_lock); @@ -2031,9 +2056,10 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; + ptdesc = page_ptdesc(page); + *pgt = ptdesc->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(ptdesc->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2062,19 +2088,19 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, { unsigned long raddr, origin; unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; phys_addr_t s_pgt; int rc; BUG_ON(!gmap_is_shadow(sg) || (pgt & _SEGMENT_ENTRY_LARGE)); /* Allocate a shadow page table */ - page = page_table_alloc_pgste(sg->mm); - if (!page) + ptdesc = page_ptdesc(page_table_alloc_pgste(sg->mm)); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_pgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_pgt = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 1); /* get segment pointer */ @@ -2092,7 +2118,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, /* mark as invalid as long as the parent table is not protected */ *table = (unsigned long) s_pgt | _SEGMENT_ENTRY | (pgt & _SEGMENT_ENTRY_PROTECT) | _SEGMENT_ENTRY_INVALID; - list_add(&page->lru, &sg->pt_list); + list_add(&ptdesc->pt_list, &sg->pt_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_SEGMENT_ENTRY_INVALID; @@ -2118,8 +2144,8 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); return rc; } @@ -2823,11 +2849,11 @@ EXPORT_SYMBOL_GPL(__s390_uv_destroy_range); */ void s390_unlist_old_asce(struct gmap *gmap) { - struct page *old; + struct ptdesc *old; - old = virt_to_page(gmap->table); + old = virt_to_ptdesc(gmap->table); spin_lock(&gmap->guest_table_lock); - list_del(&old->lru); + list_del(&old->pt_list); /* * Sometimes the topmost page might need to be "removed" multiple * times, for example if the VM is rebooted into secure mode several @@ -2842,7 +2868,7 @@ void s390_unlist_old_asce(struct gmap *gmap) * pointers, so list_del can work (and do nothing) without * dereferencing stale or invalid pointers. */ - INIT_LIST_HEAD(&old->lru); + INIT_LIST_HEAD(&old->pt_list); spin_unlock(&gmap->guest_table_lock); } EXPORT_SYMBOL_GPL(s390_unlist_old_asce); @@ -2860,15 +2886,15 @@ EXPORT_SYMBOL_GPL(s390_unlist_old_asce); int s390_replace_asce(struct gmap *gmap) { unsigned long asce; - struct page *page; + struct ptdesc *ptdesc; void *table; s390_unlist_old_asce(gmap); - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - table = page_to_virt(page); + table = ptdesc_to_virt(ptdesc); memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT)); /* @@ -2877,7 +2903,7 @@ int s390_replace_asce(struct gmap *gmap) * it will be freed when the VM is torn down. */ spin_lock(&gmap->guest_table_lock); - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); spin_unlock(&gmap->guest_table_lock); /* Set new table origin while preserving existing ASCE control bits */ From patchwork Mon Apr 17 20:50:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214576 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 88764C77B72 for ; Mon, 17 Apr 2023 20:53:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C173D90000B; Mon, 17 Apr 2023 16:53:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA18A900003; Mon, 17 Apr 2023 16:53:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92E4690000B; Mon, 17 Apr 2023 16:53:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 81DE5900003 for ; Mon, 17 Apr 2023 16:53:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5320FC06AA for ; Mon, 17 Apr 2023 20:53:10 +0000 (UTC) X-FDA: 80692082940.07.B75FC08 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 6415F18001D for ; Mon, 17 Apr 2023 20:53:08 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bg9zrwHm; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 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=1681764788; 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=cDm5QDDKVVs67sujhxqGF1xdxDwJ7Cf+86boh2cHUEk=; b=1dL6bqM2SBsykIUgDaTFe8zkVUUOJBL1pAKEv/+kbuqXBwmhVBvvYCfaiYSAacEwlP82mg mDdLDadMGhPdjIR6VQt/PqTzXJL2ONI5/aPzi/GgsCvO80qzpAO7xTMuciVQrIUxOEE2cZ tiVmzPpWKSUNyeviu77veo7n1TIObhU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bg9zrwHm; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681764788; a=rsa-sha256; cv=none; b=q8JRoHNKct0fHFIy33Wx719rwgNoMxHL1NcLxmpVGNHBwpAei7zRmcaasWZa9Ig/q7Mlfw j5G9dj5MwctpL3GQC5JhsUxmNi+QnXUGqeWMW2M59F3rdQJYHtD0qIYsppQGz4LEtVU6DQ kvvk47PpAsBxYoOwShebn3BaChAOZfQ= Received: by mail-pl1-f172.google.com with SMTP id w11so27336277plp.13 for ; Mon, 17 Apr 2023 13:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764788; x=1684356788; 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=cDm5QDDKVVs67sujhxqGF1xdxDwJ7Cf+86boh2cHUEk=; b=Bg9zrwHmz+zWpBrO553L6xcdY/9UqoWF+7JCbvFGdP25XqpLPTgtgzoeSaxtZoExE9 /hfw60KOOdzfPF4LPrgT1cUNcQCYvvrOjqBV5EeXW1oBY3+U5yLq/ZcoGhd2glQtHjSd E1SNfE4qG9orNxm4nPGVLtj0ZQ+EoD5+Of2kyr0VxZlAahOe3asPxpa5GldaOSiEcuod A/YatVmT6GM0jfgVRuBueRMwbH+1Zmb4szBdOpsRslV8e0A8Jy37baDQLXTR/uZAq8Io SplJDGW4RHssNwF9j3bgci8G5WEKKtAuNGcD0sy8PlvNVq51dUIvBHLo/SQen5NnMvRt jmoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764788; x=1684356788; 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=cDm5QDDKVVs67sujhxqGF1xdxDwJ7Cf+86boh2cHUEk=; b=FFs52LWERB75b7oCddjcz4JkKs2dV8gjQRh0M+IInKptN1U/qU+Klk+jDydfq21b2h DjfigE80TpF1nMfPg/zYp/ryIR/Mn9eJvm/RNWI3VOcnSmZ3LNayIpqBQw9xgXMnXtMn OLpA+DSseIG5LfaViidFqhSQsXW4YBhS44teJ/mlpzrf8OM7yp/PCm1kKdK2iceE1Qz8 kMVu6SMbUD6YVo3KXQgUcKDsvZLRy0iyA7VmGg5RA+G2FWTPPqVsVJS/US9lsvSAWaVZ syGN+emc3geqDHSmyUCtsODVID9G1M1OkNfdJykYoG0Om7kPA70ChEdraPY83qSLteS9 KjIA== X-Gm-Message-State: AAQBX9f13dNGLRMIxw05Tn7Rw+9jLMZsad9X95q5ZjSTu7ZSsfXTQAJn a5ybVmw6g59n+HTPsBsarDE= X-Google-Smtp-Source: AKy350Z9i6yPCDN1KgNRMsqi9oENFCLbYvx/eJwTeNJWe0OuxQ2o4hV6w1fDsy15hPJg9C6OAHihoA== X-Received: by 2002:a17:90a:6aca:b0:246:82ac:b6b2 with SMTP id b10-20020a17090a6aca00b0024682acb6b2mr15576120pjm.9.1681764787792; Mon, 17 Apr 2023 13:53:07 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:07 -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, "Vishal Moola (Oracle)" Subject: [PATCH 16/33] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:31 -0700 Message-Id: <20230417205048.15870-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6415F18001D X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: cbxcsqjkqyhmfmiykke67mxc9sjoziky X-HE-Tag: 1681764788-63166 X-HE-Meta: U2FsdGVkX1/C2U/qFGeWGQvX86nYNSEyHeHxdYEYqaz+V7oxo8gEwLPFWR9SbYqyGZNWYuuOPsxpTS01IMMPD9q/dEW1bYqtk9rsh8m7a9FhS3EzXOWnNaK3aqH+EUXry9efyQ2rSsGB6GRRtwWX6cQpeihLjhYJjmWr2YT9QMt9FenNyy57OsxPJOwTfEg07Hyt3ssgZI3iQncrTZjfSFWSI57+JaJAls0o1zeCiLMD24OprzjymOF6CJgS/dZaTV8t+eWTu4AhegFcT3KF7XgpE/WO1vSx+JEs4TRmX/QgzI1GJmjKzDD3Z7IfwPhSm6Gx9aCsVFgvgb/8Jfy4tEkdDdkY8qDdHDr75flAqiY5Oo2Y5Ji1vBz6MgHe87Q88U2oW0B+VcXIKkv9beK5O1sEm/1ibdCii6bGLgbroXYPCurdW6NP0+HR+8ELfjN21j6g4rAX4StFBLsYGqRyfD3UoP33rb0fxC4tiPduRqcYcIaxdDjkmdmPiMB0KvRCwrKV7WF8vyNHpuHK6WFanqjxCEFpFSR3GulIiY9KUOs+3ThFvQFLMKRN2hEjc/uvOp5qTwm2RojEJ6DMB/4BxVq33MQlPQFvCxvusuC9jqrROd1w9b2ZOG+ePgbh6Gs3jMeNa3gzp7HI/TwDsz812ptiW1sPb6y/1qSfH7VvUyLDtvP2R32PFpfQ/dgucpSA5glapQY/Jza9+ztoqKZ3PeBAzL/HUPxVaxzQB42uSkeFm9ebD8M0aa+rtPk5EZEsjbenWBjNARj1kMKPlfwB5bHt5Ov95WTfTOpv2CHoACZ8vWKMv9Vo0QoWiVhdT4XuOBwhzHDUttAXVqlAs9Qpsdi5DjJkFbmHQc8l3Utp9szsgFIzxIk9Iv0ozMv2At+FMDy//Pd7E9ybZP74+fkafFkZd+eN8KHMdVqtajlXAwEYKTJXNbooZWcmKvAEypEIv3e3Q55hdvEpgoGklP/ ZXn0FdVi T4Chw0r8XxjTgYq96aFU+cTMO9fEWw3edYyZOW2lvt0oOu3AKa9VYr3zcyXrHyhGMYvPQ0oRsO31rWg63AlD8im79Qdi0sAIXZEqGdik2cOWnE8k4bH6xwzKao8UvP7GrHBgHgFDR97eO8r5TlmneaBU2dvQgopEYO89hVoYSCJodQl5sri4QiyDAwlWOVGq09Ar2Fxte3c9D9QAWzXK/I+4ToKc5z+kRIYh1558zM+uaVZV/5coYww/Jjc8nQzwlP4wzAIuqKnYglr+h2hHObsg9YseW5d9xGpGs/Brm2OqISEu4p1XPmLacCooxWpbpDSXmoUwLUmqDjQys7kfpTQUH00HLHTgrocIDUGXSOm+Ij3hg5kt5RnXH41daA0lVEZNebnk6GUXUUilI17W3b0wLLPulhixDsew62bpEZTYz9GZbn23emY9V5Q7qNyka9hjUFOEpsTxVLlddKCJAvjwYFL9/Mm2B9CoKXQDOU/plnRPjVyrHllVshcIs80cvC8g7S6WFmVmj/EPsmApn/6ISeCsE+iigPYWa1K3Ceyr+xaA= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- 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..9841481560ae 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 (!ptdesc_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)); + ptdesc_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..1388c819b467 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)); + ptdesc_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..16a29d2cfe85 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 = ptdesc(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); + ptdesc_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 page *ptdesc; u64 *table; - page = alloc_page(GFP_KERNEL); - if (page) { - table = (u64 *)page_to_virt(page); + ptdesc = ptdesc_alloc(GFP_KERNEL, 0); + if (ptdesc) { + table = (u64 *)ptdesc_to_virt(page); 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); + ptdesc_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 = ptdesc_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_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); + ptdesc_pte_dtor(ptdesc); + ptdesc_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); + ptdesc_pte_dtor(ptdesc); + ptdesc_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 = ptdesc_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); + ptdesc_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \ From patchwork Mon Apr 17 20:50:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214575 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 B8838C77B7A for ; Mon, 17 Apr 2023 20:53:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B07C590000C; Mon, 17 Apr 2023 16:53:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A688F900003; Mon, 17 Apr 2023 16:53:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75B3590000C; Mon, 17 Apr 2023 16:53:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5C0D2900003 for ; Mon, 17 Apr 2023 16:53:12 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1AD4B160149 for ; Mon, 17 Apr 2023 20:53:12 +0000 (UTC) X-FDA: 80692083024.23.954F33A Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf27.hostedemail.com (Postfix) with ESMTP id 3193840018 for ; Mon, 17 Apr 2023 20:53:10 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="r15/y1KD"; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 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=1681764790; 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=ySUR2NhNYIi45iieMc0XGAHKG7J++HPTQWlVu2Tasao=; b=zVEkvX/nM0zZ7Vd8hAr/iQZQMenzO7KBCYQNpunBgtBxOc+kQOQf6XvMGNotr301+lNLAT B4xDsvoTuajWhokqA41g6kKHqEka9X92G5ICew0iA1uC8J36S5CTLKBBKHH0zjJfXmZ0Pp +pghpOO9qsXGdkIC2ZJ6SWqdunoyCkA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="r15/y1KD"; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 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=1681764790; a=rsa-sha256; cv=none; b=Dt44rj1imT48/P1UDIVsiUijSx4IMnnFzf2NNutQSx2dRbtg1iCDFk0iLlpuYlBzgj2Wvy V93l6A/N5aNkbxA9UFFN+VhU9p988dDFmoy2J/3ZBoNBPPSr8Gc5/jCmFZbi3KJcq7crYw UlyyjnQ0+HRKDAzUXl1fLHGkGqw1sUo= Received: by mail-pl1-f177.google.com with SMTP id d15so10119575pll.12 for ; Mon, 17 Apr 2023 13:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764789; x=1684356789; 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=ySUR2NhNYIi45iieMc0XGAHKG7J++HPTQWlVu2Tasao=; b=r15/y1KDif+Drf/4AN1jpq4aAvcL2g0C6yBlVejRZjViwAKdx4tN5lVxRrilW72t8W lxYrwwZ1V+6OuCBWGNjnVnFHs9fxA0+y+Hq/T2Xun9HaX6uevRtPhFT+6Fyn6rL6cuxl Z3/9OHOOCrjsch5rq9oWYEod7RCMO4fFtyd7gUBrmXZG32pCnlsISiWWId2b7LrGrhST kpDrkb186Ifgo7UoD/Ti/tLM6Mv74UfKgE7j3u4BhSVZUj1yrtlCsZDlhuTy+CmGW1TT t+a+qaRd0Bf5+Wl/CDmlKFz2wUcV2Pe9TbKsnSy3YV2N+zpAWDFA5l3JzNu+kIHHm1Jf 2puA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764789; x=1684356789; 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=ySUR2NhNYIi45iieMc0XGAHKG7J++HPTQWlVu2Tasao=; b=bhS3ZQ+wTKMS0UNQktk6tPoBVDKjpa9OtCtv4lwDIYsuga2/kIBMARfQjQEIU+AmKL r20YgxQr1b2sKG7LC4MuMWJ0aBf+hlzbPcguSjff+HJqnGq/zqmQRImjTT2K/7qceHZv wm4dnqWuoGqpPyVR2fAsnSnN/JJnolF9WQaduuip6VquSZppQRdavmltVUlJPqsx1xcK M/p3d+jqjN308XAWoQ0lBXxddFtihAakGSJW0B/LC81HApjd2Panh6+YThs5K9OOokb6 V0VMBHfGKeymyTd0bFpSIU5FTfRYbGBDP4Az/KHCSbn2ikxFm91/XkS3EcE21oaoDXLS 4xdg== X-Gm-Message-State: AAQBX9cOkrjDhQWdGXliYj5C+Joq7IgxBYksYwnMv6vAG9R+xccPPiT9 4yDXF+EYTyjD11upC2610IA= X-Google-Smtp-Source: AKy350ZVl3PNdJ0+nN/Rb9LpMw5+uyjbe8u9t4N4aIteNFpQkEwBCpgg7+YRGDc+SZWH4x4d964lpw== X-Received: by 2002:a17:90a:d205:b0:234:409:9752 with SMTP id o5-20020a17090ad20500b0023404099752mr15223725pju.25.1681764789129; Mon, 17 Apr 2023 13:53:09 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:08 -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, "Vishal Moola (Oracle)" Subject: [PATCH 17/33] mm: Remove page table members from struct page Date: Mon, 17 Apr 2023 13:50:32 -0700 Message-Id: <20230417205048.15870-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3193840018 X-Stat-Signature: dmi39fkxhy7bwdueg1wc4bj4cpesmyh7 X-HE-Tag: 1681764790-963572 X-HE-Meta: U2FsdGVkX18VRsAuChWLPP42etUviWr1Wo3byWm4VPOCOSfeGvz0mOJz7c5K+I+1Obo0Lwc8m4m1D6mhsjL7gh7NQGjn1IsR7a9TfG9yL/bt9r1WspnfFB5IBNWZa8qS5quunrILOg+Sy9LxrAIN9D005It3EPTa4o2YNGnoHj5gfYlH/gpZc0CngU8Ty80wNdSmLGGZvxw2rzTGFLARL4lMKalfBfr1Llgd73f8M/WqLnidxchHz8I3I73LWoTjNzU83WrevbJRy3gn2HdT9oR5H7WpW2GY6JUnAoBQJKn0Fgf8kZG+RIckY4n4v7pvb78lvNMRpAZswCGoDZcDf+200TMZMt09ze61rCZxKY7e2oKTKlUSJaTxXsttAUaon11EhGhqqOwwBfXMzJjKGneZ02pyq+CQM26MlVGjrPihbo9L6/RvqrUZB2cV0t/LQThy/Wa6BdtTL6LYs2zeQ/1SXHclhYsb8hZcYtyXJxdfTfYqIbCNYPruoXMZ50zD8eqlH2rCsLCc/8u+mtnaSOvfY6lI5rrFswx+IoHFnIICLQUlZ8e9YSMRfA6GNSBflIGEl1X3fRORjYa6bcWVPULwJXnqZy5J3CbwFlwv3WJP2peeaiE9Rpr+9xgUlaWvKYHw2GcxnM7OPVpclet+CbkeyyWR2TTFayAQoM+iM+Oe4t0fdOytaiSiDTwXkkkF5U0Fd/w76WnLKeCcxl6Nyk5xKowmAgsHtgOictUyOO+znSTSioRYA6x+16bjHMGdcrsjhzQt01PRhAMgMwRKaFINVZTxv80DPM7rLwgf3YPa/PuNZzNJuupSlNNUK5Fij/NxqvsQ9hHZRTETFVW9QQVuXWOLEbzGQyqTai7T+HEUp9IINT+7RpilIKdFGdSrLDZJ0ciAi0HGXCrljHbizOUlxaUgqnAV9hGxqmUX+260XWpWXdXj1y0iFPIh5zuGGeb7TDiXe6xfyUJPeNW pZljmGaz 48wLLmF38C6rpOw981PDV5R7ggxCkmKcTJHV4ZUqULulV5iYbX2qJTrligcWym3MJBgQ5ITddKjB9vJTSPBNNQHaqy4UXThHd00+ihon3f+XKcb0/iDf/z6rwjK+xH16pokfRS2oZiHh0gr3AuRyMkJPzrSVIFdABaP06CfV4sQrtatiq7hcD8f9MTG227pVB+uBxB5r9gfZSmmN203jf+P1dUUWc/iiDmP0lN79Q+0JDly5uL9nWFWbuwQ5vpJPLJYRsAGPyNJfKifFj12kwY4xeteG7E/sMW63CGiqhDopiG/S3TbiDzcGKmfPcX8DoGBMTNjVmLeXOMXPAjIy8WJTYA0Ups+7jZEWs0v/xlLBCN8CUEWQjX4rWEwdqeWQAnZUIi9A/qfPRMLy8M49yqng9/dJYG1RYQbugJiJ/Y8LgHp7dLJuVHn81D9hFWVcW6srgUikSIaQQ2cZEinrjl1qMUUltvRMQO918fKHK6TknbImznpRv7UAGPtmdL4UI/Bz9SjvUFZR8fzA341fxW7oQWIK+dxB6lg2Q0mteImET37g= 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: The page table members are now split out into their own ptdesc struct. Remove them from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm_types.h | 14 -------------- include/linux/pgtable.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2616d64c0e8c..4355f95abc5a 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,20 +141,6 @@ struct page { struct { /* Tail pages of compound page */ unsigned long compound_head; /* Bit zero is set */ }; - struct { /* Page table pages */ - unsigned long _pt_pad_1; /* compound_head */ - pgtable_t pmd_huge_pte; /* protected by page->ptl */ - unsigned long _pt_s390_gaddr; /* mapping */ - union { - struct mm_struct *pt_mm; /* x86 pgds only */ - atomic_t pt_frag_refcount; /* powerpc */ - }; -#if ALLOC_SPLIT_PTLOCKS - spinlock_t *ptl; -#else - spinlock_t ptl; -#endif - }; struct { /* ZONE_DEVICE pages */ /** @pgmap: Points to the hosting device page map. */ struct dev_pagemap *pgmap; diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 7cd803aa38eb..8cacdf1fc411 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -91,9 +91,6 @@ TABLE_MATCH(flags, __page_flags); TABLE_MATCH(compound_head, pt_list); TABLE_MATCH(compound_head, _pt_pad_1); TABLE_MATCH(mapping, _pt_s390_gaddr); -TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); From patchwork Mon Apr 17 20:50:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214577 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 04017C77B78 for ; Mon, 17 Apr 2023 20:53:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8754900003; Mon, 17 Apr 2023 16:53:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC2EC280004; Mon, 17 Apr 2023 16:53:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC83890000D; Mon, 17 Apr 2023 16:53:13 -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 8EA4E900003 for ; Mon, 17 Apr 2023 16:53:13 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 67D0A1A0756 for ; Mon, 17 Apr 2023 20:53:13 +0000 (UTC) X-FDA: 80692083066.10.6DC089A Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf22.hostedemail.com (Postfix) with ESMTP id 9BB09C000A for ; Mon, 17 Apr 2023 20:53:11 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rtRu53vc; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.173 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=1681764791; a=rsa-sha256; cv=none; b=SJQ4Xmzgo68T1Pwo2uziN06ztdirqp7U/C3xT9ynQrppqHA+3zrf+FNRk8pUlp1Goqv72C tH6tRqthTC9bqf7Naan1VN7zJsWsuqszEWrKu2qUSPGEpcKS4gITO9eesEmx648JLSyDAd 3SZeHfS/jZ5uXpNvYW5FcealU9I/HrY= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rtRu53vc; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.173 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=1681764791; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=hWhrazXdcXetdsl19o+gvHwM/9SR2QRvBLNSv9oWtEklxw1kOS42a3HKWEcr00JFcaCt20 WB+28p5xBmEB8fIQTjUey4EnKH9HkV0gbC3elY5L996YW+RKtN44sIUBTb5rx7RDOGJ03r q1BvsiZmcYlIvd5vy0Lt7hBlFgokjwQ= Received: by mail-pl1-f173.google.com with SMTP id p17so16171036pla.3 for ; Mon, 17 Apr 2023 13:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764790; x=1684356790; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=rtRu53vchXs9D5cRJ3CetoIWLY2lh3C5JE3MRdQ44xVuQfskdtiHDLlzsBbYSofn7L e8lSzFUhD7A9hljeGTauQu8egrDhlG5YRZnhWotrw/49W7ZikJ5WwMzRyLlm7d1p91Fj tP9nyG9Dd28ZXF5MIPK2qlE+ewnSWVXYr1sMPo4LeXBmaVcfj1OQVCyd1BVW0WzbvUsd N8PJAsJH/tMmSy67sjwvjLZ5yO4kk3gDbHJjSYjg5iU+rvwTRrmDeUSPnhCF/kmv3N4w dd20d710X+Q7eq6GtdItIvNuKGeMwqGa7YpLc42c8kFJ7PC15/zIHwILDzQm/t8Xoxcw qHNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764790; x=1684356790; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=BRK7A12tdJmJ5F7rv23Y74bKVje3uk75CPvDAmL/Ep7FO7lFjAsfxIVEtbzueW1FOB sX6UoUoVOXiN1ufdsfw8HcYcdtaBxODEpEuZE9YiZapmQDjPg3f9J6Lnjgr5K7kj6fJd uzeK1mGeR7s0JYKpZoKghkSktJ1vFrTmd5IedYiuwoV1eHbXZMPKGNPrCbuXEDjdhFm4 oIZHlqTyt5IDkuu8slUgJxUpT3dT/5wPIt63BHzd+8m8OuOoSwk53pRdwQBc+YYcK9D4 xGrgWh+tReWYK+8z6ZTllEusPT61ZhgrvHaDMCbp+jvpY+TjbTgWZwwq0Qi1zaGEXP4h xwOw== X-Gm-Message-State: AAQBX9cLcaavJflP3yirUJemp9eRWCsEZtpGM6PpYfZKq5dewZAGP2fC ikrEhPDUSmD0psI60dyZGdo= X-Google-Smtp-Source: AKy350ZvnFjO+S7U7bV96piHTTfvEOv0mlMsOissXbg6oSWmd239xcTtUjPTO8K/viecYNaiDpXOfA== X-Received: by 2002:a17:90a:e997:b0:23f:9448:89c2 with SMTP id v23-20020a17090ae99700b0023f944889c2mr16622304pjy.7.1681764790439; Mon, 17 Apr 2023 13:53:10 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:10 -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, "Vishal Moola (Oracle)" Subject: [PATCH 18/33] pgalloc: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:33 -0700 Message-Id: <20230417205048.15870-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 9BB09C000A X-Rspamd-Server: rspam01 X-Stat-Signature: gnn4f5otmdb4hrd6nks59iknzn9ut9tu X-HE-Tag: 1681764791-826578 X-HE-Meta: U2FsdGVkX19TyvnrDlBOK8u8XHuLfCFrfqjYoKGzVxE+Mj0bCu1E/Df2qniXmGlBuHuqp3c//W02SSEUvm+rAI/dgScei3ZtMQ1dvJUWs2qaC2ka6YrWtk+rorjaBn0NCYrX97GKSqvbBLm+SRKrx2k2Xn+XEW40k0/nnPwnzKxlaekkaqqbEz/2S7vXWQL4Eeb2O8OiRZUVkd3OhGp3TOE+rIxjv/w/XUpmmSwPt9qJkZBVdi5Q94FzmOvXefIwNAYBsGzcsnqdViyrvEZVQORNaxyDPmSKzHusUx5dy5nJLhgbHH0Y530SzVm8fHM8eZu/mRb4nJthFeXz11bZr0VjbfNAXp43jnltZnazF4C7mPXkC54rmTVhmqcEdD5DggJyy7d3aFwizuqUw3oNn4HBNSszMCO4RcRgwaj77hKn2t3eorWL5R79m8z1ik1hY+SBkm/KdmKLmjY3kXlBIezt0qSj8RyMN5mJUoNgHpWxzwOQsQVnxofUB2s4i2heuQ3bFN9FAOWnjHWTF82z4Jd5fsPS3KHxClyZHG9LTWE9jpulQpvXua4ErL4FTNyEarnpruPwT+fm1fjjv+RU14/pyXTHJk1Z4zw9+y8VJdQT90uqKd9YqBNlj3pbqEtlSbbegNliJKOu2JYAUu3C6Bv/Xt6aYnDZXsXrdvpbUbzz3dGU8tHfTyKUsxSy2cPrmU1/AEbtxgxcnk0Y4XD4vHW67yQXtewsIwlKe5/O7HvvJHIgUg5iEH5f7unAc3/nAllPwOKj1nrGgawVH9FXeaQss/tFgchybC6jEHAR0oNpuuiOJzESXimxqDKfO16ema3oSS6aWXWU1bD+vWhAfYS7z59Mc3wBZRV729NAcLMgi96bJzfbAm3zTazul9RheQm98Gb8ncnYR5zuhpJOKBVtGhtNfG+Bo/v7wwtw9vAqV4fVi0Kxf4jRlSVvTx4yTCeZFrje+iNt1V72SW2 A3pJ0+XL BkHpyE1kOr0ITKuWzpi5r65J9owM7aeaZQ6MtxW0FTc7g86JbYqvuUQNjiBoHyezExNdTWWTjj+LqF+W3tXwuHXWnUqG4iIxOUMPF+AgbkU8yfecnx+n+gGthVa4/zVfHLeASigpTSPfWJpIJ6rQjCIbtKS6LoWOfuEXav5MI+6P5nqAptripN1b6zgYzLDrvL0BNhQJUzcQ40oC1FRHU5jbgnh7AhcluW+4mc/1xI54eT58yp6DBTo87AUELADwFEH4ooD5Z86820c/ycMBdoYQ27tHNL9rdqFOF4MXdDsDJkltf0pt8GBlkG1s5g8Kd5C2T5QE6UeLOFMrTypWcNUxOX/iDKbzaUuXCpMl8vQdwf1+ZtcGmO0n8bluz/X3OMIFYAUKDZUMr5TNAPJu/x85dmvq7HjN9YpogArllgrYMkej3ZZ8DYAAkrD46VWueGGICKpW7LzJkFpgOXtJ3yKzjrSwGLTNOtRWMhMV2UxZxlvkXmMcScltYjgOv05Se+W3gSkAnya4YLNC+nKJjSAzpw5A9w3O9DS6b0aU9AhhrsCE= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/pgalloc.h | 62 +++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index a7cf825befae..7d4a1f5d3c17 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -18,7 +18,11 @@ */ static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm) { - return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_PGTABLE_KERNEL, 0); + + if (!ptdesc) + return NULL; + return (pte_t *)ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL @@ -41,7 +45,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) */ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long)pte); + ptdesc_free(virt_to_ptdesc(pte)); } /** @@ -49,7 +53,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) * @mm: the mm_struct of the current context * @gfp: GFP flags to use for the allocation * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocates a ptdesc and runs the ptdesc_pte_ctor(). * * This function is intended for architectures that need * anything beyond simple page allocation or must have custom GFP flags. @@ -58,17 +62,17 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) */ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) { - struct page *pte; + struct ptdesc *ptdesc; - pte = alloc_page(gfp); - if (!pte) + ptdesc = ptdesc_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(pte)) { - __free_page(pte); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return pte; + return ptdesc_page(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE @@ -76,7 +80,7 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) * pte_alloc_one - allocate a page for PTE-level user page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocates a ptdesc and runs the ptdesc_pte_ctor(). * * Return: `struct page` initialized as page table or %NULL on error */ @@ -98,8 +102,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) */ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) { - pgtable_pte_page_dtor(pte_page); - __free_page(pte_page); + struct ptdesc *ptdesc = page_ptdesc(pte_page); + + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } @@ -110,7 +116,7 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) * pmd_alloc_one - allocate a page for PMD-level page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pmd_page_ctor(). + * Allocates a ptdesc and runs the ptdesc_pmd_ctor(). * Allocations use %GFP_PGTABLE_USER in user context and * %GFP_PGTABLE_KERNEL in kernel context. * @@ -118,28 +124,30 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) */ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_PGTABLE_USER; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - page = alloc_page(gfp); - if (!page) + ptdesc = ptdesc_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return (pmd_t *)page_address(page); + return (pmd_t *)ptdesc_address(ptdesc); } #endif #ifndef __HAVE_ARCH_PMD_FREE static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); + BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); - pgtable_pmd_page_dtor(virt_to_page(pmd)); - free_page((unsigned long)pmd); + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } #endif @@ -149,11 +157,15 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) static inline pud_t *__pud_alloc_one(struct mm_struct *mm, unsigned long addr) { - gfp_t gfp = GFP_PGTABLE_USER; + gfp_t gfp = GFP_PGTABLE_USER | __GFP_ZERO; + struct ptdesc *ptdesc; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - return (pud_t *)get_zeroed_page(gfp); + ptdesc = ptdesc_alloc(gfp, 0); + if (!ptdesc) + return NULL; + return (pud_t *)ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PUD_ALLOC_ONE @@ -175,7 +187,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) static inline void __pud_free(struct mm_struct *mm, pud_t *pud) { BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); - free_page((unsigned long)pud); + ptdesc_free(virt_to_ptdesc(pud)); } #ifndef __HAVE_ARCH_PUD_FREE @@ -190,7 +202,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) #ifndef __HAVE_ARCH_PGD_FREE static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long)pgd); + ptdesc_free(virt_to_ptdesc(pgd)); } #endif From patchwork Mon Apr 17 20:50:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214578 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 35965C77B7C for ; Mon, 17 Apr 2023 20:53:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 427CB6B0074; Mon, 17 Apr 2023 16:53:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38936280004; Mon, 17 Apr 2023 16:53:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A370280006; Mon, 17 Apr 2023 16:53:15 -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 E574F280004 for ; Mon, 17 Apr 2023 16:53:14 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8A48740676 for ; Mon, 17 Apr 2023 20:53:14 +0000 (UTC) X-FDA: 80692083108.01.D275E97 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf26.hostedemail.com (Postfix) with ESMTP id C02AF140014 for ; Mon, 17 Apr 2023 20:53:12 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gYiTGJsq; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764792; a=rsa-sha256; cv=none; b=wEQP5ZUV6e0WQcuPC8HOoSriRRQ5A1dHQJcZSdtE9xPb5QfHVJkkx7zjg0+8ymlZOxuoIX LrSibLVSMI2hA+PksCLRFU6MAI/dyW+85/yG9X8gK6rOoSYPyczIg/J7B+8P/GediLvqhJ FqSmbVxQ6uvLvRmCzQKfWFlZpJElPw8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gYiTGJsq; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764792; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=jXIEcIbL+sy7LgDFrqj9+tHsGx3zxXrZ6O/TPgmX4QDCy/wQ+DKNEVrzN9cPjuwLHu1B7M hNliW4tMeXUEuhFK2AWeJwP3L6gKZKoW23NpA+uA+bEC/GE+lEiMA+m5j2Fl4E3PC7lpoQ nVMQ+NmUbSuRzFuvtbYRy42jZCjxRL0= Received: by mail-pj1-f49.google.com with SMTP id h24-20020a17090a9c1800b002404be7920aso27917777pjp.5 for ; Mon, 17 Apr 2023 13:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764791; x=1684356791; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=gYiTGJsq3tS0FDSy3/Ogj5YUQaoNGj6XWEQGKGQUuQuqn1egVSKA3seChXbxd6ie6X KVLVgtxbt+Gl9lkEwLQ+F+iG9Kz1ErH6Jdv2PrLPdPwp/UgBJZIaGw67YMksWIwKnmyC 7jVlh7AKx280dtpirqSUFhv9Pyd2cc0T8yO2lBO5mVRpibO3YWd6y8PCZ2jFDrnw2dOM qIyvjKI6SfUletTh72Za02rULTtpxgw/RsbeOg0p8ic4ZkVJUUvnJu+rLoRN8U3nnoDL 0yuCtQCJj2oWJ5XTJVsuTcfyXkKiXbSXxA+TapEEDARVJ5R07j+Rkpo9klzzaVdh3pXw NvCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764791; x=1684356791; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=gVuLAHrfxIwr6a/OAuMmZ7Ar010JD/FpWR+GscRDlXyj73jH8Cr+aqcrWZvxud94cp iD+F7rSkj9CKP6hbrgaeorvCAxSEDFp9rbmCAx+VKGJIX/dxWllnmknt7cbUWi4cmB13 8cFjl22b+H8i5T6pUidVp2s/Kqh+Cg0HmmNlyWU45um6Rrz+osse7falBA0Ikeex/He3 9RsJ3zsfgoPwt5MjH75HR5Pc2yt5GTScqL2kZGRwnnJpUyRp4l/9U0zD8eJXC5gEXVy0 7GPeOOwLdl3Ezp6//VmxBINgm9PfrsRe7DoK6mYImpbMz6jHrdESh7Wq8kQVPJZczhKU MMDQ== X-Gm-Message-State: AAQBX9fNCuy/D8ZDefgVXIZKCiZRRVmILpBYoihcdpJR65Oe6cgQuBU/ U6gFajB8k8t/2JGBymgTTlE= X-Google-Smtp-Source: AKy350bvWV8yzhiozqrrwWcRpctJK00ZbC2YeKZYOK2IgaSQcSotd8fWuCQxrW1E1m+ogfO6p1yZ/Q== X-Received: by 2002:a17:902:b789:b0:1a6:8024:321e with SMTP id e9-20020a170902b78900b001a68024321emr189655pls.34.1681764791672; Mon, 17 Apr 2023 13:53:11 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53: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, "Vishal Moola (Oracle)" Subject: [PATCH 19/33] arm: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:34 -0700 Message-Id: <20230417205048.15870-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: C02AF140014 X-Rspamd-Server: rspam01 X-Stat-Signature: gzdwp9qtq4j84fifys8sqq45n8juzji9 X-HE-Tag: 1681764792-97516 X-HE-Meta: U2FsdGVkX19E5kMBDDBqsZe7W04C73ChZGtIR4TyWI37TwGvv6lxh7LNsSJfEbqP+rFiEPvR9l4zfUtaXD8SK9iLZLqwS+M5f2IW8/4MZl3YAT/5DUUvGJImwQZDj1GqCw2mn5NaUgkeirfJ+zJTuq7ydWbvM79LvsGLSsptZ5iWHwqdec5DOkZN4Fu0vpZVO+Iw4579HKH+knYtVHMMVRDHfmMW1M70neY0KtpyeSKN/ZIqZ2xCo90VEzGWf4NmFmqsTL/YvyYDl6U7WN3oSTRPLhAj/XrQBrsxWXm+z/CiTkgAECBRpMSYih4Zpnkylmojl0Y2jLS3cD9P9MUBYyijoiMkJOgKGoC2F6yv36ZiW1MGqqOK9jCWdHpP96oz6apw6vzKZPfbbd50r9WuWSlvgf0C3VkeJdeBwXQYGOwe7edZKrZ9QNGQ3lgH0KMwW9z3jFsA1AVvYw/R4OhbPAPr02AJdI5elfP2rbcuPscHExKlHX3UIW8jCMNO64/mY9oqLAaKlz6ViY/hwbaCcoxDYb8OFv+kZEe4hhl1KW9xS2m9exlnsjrE8Dn8JGe5AHeq8eyR+Rsv8NL9UvWdM6083ykSBkWaWzcM1EKq6LQEk5IjRJoWCXE6qKY5fZZi4TgDeE5f8/5jEGXYdGdMyDKshuH1Jsiq4MJLCDdvTz1XTuJR3ZUY83c0/M0SVKyBD8GH0b2hVEZJoUz1GT1qZdpK/qo6RTQ73mZ43eLwsZvGRvs6ET8nA07xXg5MFfXNffVZ54y749TOY7DBWhxXRwOsAsOUgl94fuEhO3VmnWh5wv6QZZJga5ZWgx88Xo4fVgJPgPCjSHPtNA6lpygKliqRZNPMqAucCMBbx7p6cwu4GZGZrMFmkwQ6NR6Qmr6rtinp2c5JLQzVkitSyz0acZK855KNqczaigidNnXNRWNTenjFyiv/TMGq8afOrERBQfj9j1QsfkWdeQpZXIv R/Dr5yfM QRpcPIR1PmyMCSN+qp5CsP8n1X0hURA+MA/jR6FlRT/F7H4HlcxxTqKZsZrXrL0Er/vBkeVLgMiV5fiGaLPcUPi9XTyPklmxSo415qIzs/3Kl7isxwX+tKth2JxECAx52s4k0OYOhWwFp5n6WY2+jGMaAZA1GcGTkVkAz8Ckyi2W0EVUjr1/A7O7zqGpVrnpjbowxCGeD++Bz8g7iMJC2Oo9I1dxCLdKe44of1Cp4aaYiZjp59kPEvNmwvb+8Bt2/AAssGZn/Ay7WLSq/Ng5og44fvrDNszmNHJXZZAtvIKOhSqZYjvePEgPJj/diSedW/C6ZAZI2Exoy9rN0ylt5AHkoV0yUHDVXE8aXXaPSDOgB4QqKFBRM9CYyp18dcODMaWNZ8fjWX24DTAshpgduuysxxnPucwsjS9jAHR9O9KLT4s+fqgab7b/YV+8pZ/RbrQt9giRnBFeOpB1P+nCYOlExK4U1MxJXrYYjpZpe+fySV4fgAN6O0umHQ77AVe0f3m6AhBlSmKsvPjYdTIxWQbmzm3bN8yvIOYmn52BEf2K2SRI= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- 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..9ab8a6929d35 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); + + ptdesc_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); + ptdesc_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..7add505bd797 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 = ptdesc_alloc(GFP_PGTABLE_KERNEL, get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !ptdesc_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc; } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr, From patchwork Mon Apr 17 20:50:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214579 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 0D1FFC7EE22 for ; Mon, 17 Apr 2023 20:53:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44E216B0075; Mon, 17 Apr 2023 16:53:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D790280005; Mon, 17 Apr 2023 16:53:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DFE2280004; Mon, 17 Apr 2023 16:53:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 01DE56B0075 for ; Mon, 17 Apr 2023 16:53:16 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CB4D41C67DF for ; Mon, 17 Apr 2023 20:53:15 +0000 (UTC) X-FDA: 80692083150.23.3135756 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf23.hostedemail.com (Postfix) with ESMTP id 13B30140018 for ; Mon, 17 Apr 2023 20:53:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VrQ0lWqr; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.46 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=1681764794; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=S1tO4UDR0BqbrH4ubbH5Sf+bJynbp0jT8PGEJSmJU1a0CMRbvk6pSLHMnPd6i8vRBYoySz rG+y9pUcQeOWXEWssP7pFwbP5hqvBPIvUbIW2OqekH9ChqEAXAAYEyrk6PExwu+V6kBjJr XbabI8s3CjxI4hnOQ5FmYowlCVtusb4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VrQ0lWqr; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.46 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=1681764794; a=rsa-sha256; cv=none; b=CZD8o98eUwuMfvmH1ztaeZtZYV0aUdzHEx3eP/ax1xulhSyJyx09eQcQJtUXFsY8WqmBL9 T7VYTG429j6ANx+BJjRgRuIOoAbJGpU7n7rE+bxnLedV9IMqS20YP7anBw4bIunETzWYOy Erw7TJlW4VaCq+7TylrQ5LX+wA4AFS8= Received: by mail-pj1-f46.google.com with SMTP id k36-20020a17090a4ca700b0024770df9897so6599530pjh.4 for ; Mon, 17 Apr 2023 13:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764793; x=1684356793; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=VrQ0lWqrs/ZeVvxhrMkEnri25zysQvP6rvUVlziuAvcyoO7aiCs2Ip8nrZdL+4djlt EalUxXukap5u9TcR0Ypqd1nj4oCE7Zy1crkVgOFcBvFvQfkcdrgLVV5yu4aZ8sXiNQzS MzbdyHaLybqiTpdHLCapkJdM135ufCzQfSX7LCwPasNWotwzcPJsMf59UKAQgZOOczBx ZYZuB1ddeu/80rtF2gv16gY+bwHM4NdL4pbXt10qFjUxYFen/hCDj/7OzFab+Hq/fc/w UWRA/d9TiIVFZRkxxpOQPugklzg3SfxU/z6fpq4Q2x5DyNF+cvnkXmPJMDWg2KdcBHj4 X1Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764793; x=1684356793; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=VRGBJkzYGm+b1gTNFqbd8rxHSwGsb8Hs3GEIp+ktkR0byJ+bUhWz9vRe0zKJMMG2ag aeRvbV57wlkavt05NOvb+E/Cigt65vAjEKnA3RUhnVl+dwV2F+6LsoKswnq8lg9eXYDE aF12PrTiUTlWQDXFClYNiCbPHs1FtdEHyYFZBqwDVTaXz1qqRJl3N9F7aJ4amPVK/7km Rjps/b/VhVhBxG5UU+2DxMX62ItNDBrRrnORrdanCrK7tk2xi5v4ebXe3Cz19WZhZoss tWyUoJ8pwKTVUooj/MzWm17hrKUWyqZm2BsBeif42p2wBb+gXSFf4Znr7XvlGzifJVVf zU8A== X-Gm-Message-State: AAQBX9eicL6HEMjJt81b0iJLvvz1VYeYV1YELWZkhU1PE1NZ4F9KcBHL 054GDvgOiSYjbhYWZgL6F+0kU5k9NT9QqA== X-Google-Smtp-Source: AKy350Y2w7IaE9PrAymAnxztuomQd4Ga7koe4Zw+ByQfv97VTbICRP51vtaSBBH4u41LkAvC07UcrA== X-Received: by 2002:a17:902:bd86:b0:1a6:c6d4:5586 with SMTP id q6-20020a170902bd8600b001a6c6d45586mr227041pls.13.1681764792942; Mon, 17 Apr 2023 13:53:12 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:12 -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, "Vishal Moola (Oracle)" Subject: [PATCH 20/33] arm64: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:35 -0700 Message-Id: <20230417205048.15870-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 13B30140018 X-Stat-Signature: 4amsxqg4d7h1i9unn6jpu6d3oqk5wy1j X-Rspam-User: X-HE-Tag: 1681764793-569360 X-HE-Meta: U2FsdGVkX18luDHcgvlyiNw9PFFvLjCbFEbv+nC4B8ixS3BxVXRIELQ0RjvOBsD+/TBWgnPYEh0xY/VIj5+vOnEHFTCZQ+Mp1FwIYByQRsIH2jRgh9B5M1X2BQ+dE66MuXlLTBuOuWv/+lid7yyzanAzCsTRHMmiCqyWev51p7VzAD3W+/VHk6lFBc8HqbvA+kVNHg7H6VDqeMNAolKTW5a9RiqwxNbTidGZNgUzl5xjBHbtG2UZnaMp5+m+e1oJaFyRvKBVkDSivXsvufGMwuECQLmj2esJIXoQM5DKgEcNyx4LtBLCQWRFp3EgtCuGAfGiazrh9NuL3YgsXwutJ3idyH7kPU9YOuRoWbXw24jvHuHada6NH7GUyFtRG9ziA4dsNdpDiccPIsdpjKWSBpe0dCF9SGRdwApeMIp0jeKlsvZQgpRtWR8Tz8Kt1Zw3ZqYZO7p6aHNCn/P/63DofVfe22yiUDJj1JbIib1uN+AXA+6YIdRgu+HOSC1iEw2GZ5lva0zX9IaW5cfjCWixh25Lwd25jtgsIDvTkKXMtMkqL/DnJUCRQUcjN78oX81eb73wmy4swXfVfgFeI5w8as/41HhjEnPYkweXaMgN7ESk/amPB5Dqi8lwhaEhbpsZOhvwMu52wE0jwp6+XbQTR8QH6abIUAqEbnmmqAXMzjM8b492Xo4JS5VYe7akUv5KWxYG5q4HE62BNV3Ga7s1OJGqfCDz/DzjKijej6hbayldv6KU4vSp6Bj2OPTvRd5scjEc3IL86r7vTjtWEaS/uKAL2vpOpiaVV6fBbQG16qFF2ttdRiBg3DlMg9c0kl6C+N63xaZvS/s+PTbXh5qsdp+pAON1KDyvGxcJvzZZkRjqL1jwZ/TJqRLb1a8QpTVqHzD8iApdhNH8u+/RWfwgphAdPH9ffo53IdYj5+gDoN4bdsx3z38NY4yKjLEnNXU7I2rPZylhVUie4F4Llto OGfjTqHU TNPjl4JhmopQdtvSjiFKiU2eQZ1g4OGTzU/x52q5CW8duEsQlR+1sltrYwGlux6sGZAUlsSUWKecDTGOtGp8fTDzHaduGQ77nghLiiFlzTL+f63sMYAUoSWTS9EJ4X2vSYbJGVMFXjy9kaJDH8tJUjDdZeQT2FelIhF2c/qMuV3dYZgZe68Zr0pm/W+IDdeGwEQxSBxviPORxN3NPDwTgGEpFycqEN+CRxltgTukERvViKpjUdm4HVfYoBfpsZXnGnIN4oofZ9YoVzru+PFfEbIsFgFJhJr5lb0nG4vJpOVgnVSz4B5bqdNwjAzwEL/GrNYtgqEuAHKt93THUbXRAAeEgVaJFWOri/gqVT1UwwJ4DjkSdSxEpa8CvhioPA1rh+PjPZvudThq4MN9o0IwlVGXl8wN/hV0BRtxWKJYrOydBrT+/KIWfsTF9/EaBvsnNa+V4kjnzW1KMMaK4s7IubqqAU9UGW7XzjNtBGRCleyEVd19H27bGN6Ix3u5nEZ7e+zfnMVl9SKRh0x1NwuKv3GV9ZRe218O/W6NbxZCjAEMIL4k= 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. Signed-off-by: Vishal Moola (Oracle) --- arch/arm64/include/asm/tlb.h | 14 ++++++++------ arch/arm64/mm/mmu.c | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index c995d1f4594f..6cb70c247e30 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -75,18 +75,20 @@ static inline void tlb_flush(struct mmu_gather *tlb) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); - tlb_remove_table(tlb, pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + ptdesc_pte_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #if CONFIG_PGTABLE_LEVELS > 2 static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + ptdesc_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #endif @@ -94,7 +96,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, unsigned long addr) { - tlb_remove_table(tlb, virt_to_page(pudp)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pudp)); } #endif diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index af6bc8403ee4..5ba005fd607e 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -426,6 +426,7 @@ static phys_addr_t __pgd_pgtable_alloc(int shift) static phys_addr_t pgd_pgtable_alloc(int shift) { phys_addr_t pa = __pgd_pgtable_alloc(shift); + struct ptdesc *ptdesc = page_ptdesc(phys_to_page(pa)); /* * Call proper page table ctor in case later we need to @@ -433,12 +434,12 @@ static phys_addr_t pgd_pgtable_alloc(int shift) * this pre-allocated page table. * * We don't select ARCH_ENABLE_SPLIT_PMD_PTLOCK if pmd is - * folded, and if so pgtable_pmd_page_ctor() becomes nop. + * folded, and if so ptdesc_pte_dtor() becomes nop. */ if (shift == PAGE_SHIFT) - BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa))); + BUG_ON(!ptdesc_pte_dtor(ptdesc)); else if (shift == PMD_SHIFT) - BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); + BUG_ON(!ptdesc_pte_dtor(ptdesc)); return pa; } From patchwork Mon Apr 17 20:50:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214580 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 91878C77B72 for ; Mon, 17 Apr 2023 20:53:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D27E36B007B; Mon, 17 Apr 2023 16:53:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDA91280005; Mon, 17 Apr 2023 16:53:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 958FD280004; Mon, 17 Apr 2023 16:53:17 -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 732E86B007B for ; Mon, 17 Apr 2023 16:53:17 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 48D10AC273 for ; Mon, 17 Apr 2023 20:53:17 +0000 (UTC) X-FDA: 80692083234.11.C5DBFAF Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf16.hostedemail.com (Postfix) with ESMTP id 5CA3D180013 for ; Mon, 17 Apr 2023 20:53:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Xg6P0Upa; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1681764795; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=QZsCOA55cyzavdUtEc6NmxuNkgRYNXDbvJNrrooH6yyiyiWBPcya1ZRcBTjUs0d4TccsdV uYeAsGJdJ4oBqQaZY//0bTnz7CZ3F3uoYktlgA4RZWhrjkCJOZyq6KulwSJHY6Q7Nx5ml+ bAR0cS5ksryhfKMpL8TIwzEFFjTjj3M= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Xg6P0Upa; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1681764795; a=rsa-sha256; cv=none; b=QDwzYyPLW6nK5jlxFocXZ8Aiqv8daruNu2EKATiP4ZCP1wpFGQKjkKKWGe5YHzBPqjLKwj Iy+RVdGiEpGfDg4+mIt2Dzgh3QdQz7fdgQ2g2ccK66xig9KCczgdQyT5tfqWnFPeY1+UBu r+YV+GmdRyyTItyFUAeUfDBeCji/eh0= Received: by mail-pj1-f53.google.com with SMTP id hg12so12714009pjb.2 for ; Mon, 17 Apr 2023 13:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764794; x=1684356794; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=Xg6P0UpaqLjmTr9GC8q8FEqPaWuvWAOVoK//8dKOM2wu82xE/PCXSYeAATRXUJ/HKh 6EEKIr46u43LbmKVnfil2W4E6LUnTir89HhCdDllvASzF+yevHo7MjwPE9+XRv+3hhES OUUsnstcNrA0rLCFMYj7vWl5ZczSf3KPYpA7wTt20fxP/HKu0nYQRIzVhW6nrnGOA5jn ZX8zcSMK8Y+FlG/fX2gye51alnw5R0vQJIqmi3wnRTlMtqWonWHxJepWd7O0uYkErLAf nElaONPL6snfMupRjx7SgoPL0fo06TUuoxc3sYPVOppMWFUfAwgvDIOHO8Ugh+LFqXUj IYjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764794; x=1684356794; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=jKufrdlcmwmjc5FIUBChsd884m831wZ1MMq9Bcx3CWIM5huz4T7KsWsMZ4k+7kzPMB 6r+XonuNcru0kc5mBiKXl++XjtFOvksPr7j0LGHdNn3WdW6SgoohFHBqSQgtWoD749/T i0mAwxvyjRFVi5NveWBPEpJh1uX79asguJJJdPgPRxipXslrT/i3Pp+emhZ9IcwcXBAa r9cWBF4jqq7nTQorlK1KR3AnnuvHmKMJfdBAwHo7fRXHjroh6CzP+tkI2wGZw0h0B6r0 R3OjivylRIF/NK0MyDzVl3ImhtMlbTpiJdDFpjSy2TjDqH1DKDc+2C4QOTMpPFVS+Wq9 mHDQ== X-Gm-Message-State: AAQBX9fqrd9Gj0HT5YHKSQN/PhC9FXiN8yJtrKaETMf3YHihxDVleKA6 9/5dHRpcmX7x0lO4GSa2+8U= X-Google-Smtp-Source: AKy350Ym3GSROxWd30N3vnOcQ+scJJk4j2bn57g6f2y/wdjBz5ko3J6EyTomKSlBO1Xk2XiBoSAe7w== X-Received: by 2002:a17:90a:5315:b0:23f:81c0:eadd with SMTP id x21-20020a17090a531500b0023f81c0eaddmr15717621pjh.47.1681764794292; Mon, 17 Apr 2023 13:53:14 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:14 -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, "Vishal Moola (Oracle)" Subject: [PATCH 21/33] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:36 -0700 Message-Id: <20230417205048.15870-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: uk33tco4rn4b34wiscgeyxjsh48npnpf X-Rspamd-Queue-Id: 5CA3D180013 X-HE-Tag: 1681764795-453075 X-HE-Meta: U2FsdGVkX19bA0DegoXL8p4sbzphH8oIE9+WJNMA5TIiDk+OA/lU33dN1UcdEagVlwNV4vntuGwWxyX+GDH5gVZUSuYRpAYaFJ2QeQdpXNFY6rX4EEMhTMAC0XQc1F7/5rinqbjb73lMzVEUazFZ+2vbUZ85JtC6yE/i3vt6e87S6l5dDLFscbPYlG4hxcBmvzZIwnrAr/Y2EdZqNeQQ0Sl53u9i5f6jbCikUFWYXy61oZzllcaFQJZajJ+0c6c6WxFeBTiDESsaHk3HIDOSLhNMfwcMR4sFigPOkEnyyzT/oNThuuqZdI6prLo9LcekQCoCXrpeZ+9WPEN8LoCuEUo+hFZZZ2ZRjE5aYTcLEW11ZrvnUIp4M3WLv+P7ySYQ0GSEO5APMIWZm5D+kUdKtSO/6NX4ZrqVx9O3qXPoWeY3Gw1bXZUArXCxxNaYEPchk5fnoRv2hfCjr/+jQmXcavOYQH/0z1lW/lbF2ZlhrifGQ9V4rv3ILBxShWpmHszP9M1hCwqKEq7fKdQ5DFDt0vpJGbiHv6TpUl7CGW29V4bdU3s9QoE+TkPBzLSWl8RqiSvpPiovYd+W40dtAkeaHYkTFVHJqVbosvAK4Ucst9F5pqt0vdtVUMM0UGITOg3AntP50QsAnO5Z9CZx3xTRiH5ipq3zrMCWa72CN1S5iEGMqWUe3K0kkAaoRsT4puFTTGBoJj/9+/cxYKCZhyEdNFFjWr82WHJFVGAN+s29GeW2O4YqjHwDC5psrMw61xjWczneK9Vd05Ng0jLqV1LUe4gy/qMhogbCGg5Il8v9DxnXbm2pw17C03jAME78OeLxKx6oB0OodYKYZD8tICvY2n2V70d4dLU5gd0GAJPVYMr/ql0YxAgAdf9aoQJ9Y0UVZWGy86HT3pztyz3nZE546EblegHcXo4vLWqMwqflMUm8Pia4WhhqMhYkMeStd0dtqRANnr9s45XnOJEpQRH fNbyYH53 w9W1DlrSVfFJqQBiIKQTstG+M3x8qKlei1kIL4C5ZGxkfN52IG3aftnrZFLw4QsmBQBzzQ/dhXCnmWUpngFQN8osW5tspRVBTicEOQl/sdAYHdKutjHtR3AmFnGPTyEaW/cTYFXGylHNDJY/NyRyGx/TnpNpWtGtRbR/nEHOOUhvzhkVtey6/5MYQE+naPU4ujmip+yfBANKEu/lK7upSnYu3EIDafiC5Gx/j8cKYmhzoorTMfONSokWt7yRe8UxHU6vBTpaPw27zEPd8bKD/0YFFzB24NuycfLysbdyruz7AKX58Uz4koG6hc7Zb/piOr4hxq0d1/oOaqDT66/kR/XqXFHRiAglipje/8PCNY3MuXCdHqC0GwVfbibwjioVf4xqlW4/knoaBhj8QWyasV4nmPB8n2tRl7OEsXXzjooTIkrU1NBVk44Zjub5gQPfReqSgC6S4zQiUklv1K5n4UGqhVXLkSJCjaeIx9+lwVWF9q3xXlP+bjlgjMpKG4UGhKzJ191Lnb42VCS5nINYrZs4cxvR0+ZSCwZVyGANR1YywpqeqNMt8/E9W+H2oE5orKderkFjFRHJsadlOJVfXX/QybA== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- arch/csky/include/asm/pgalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index 7d57e5da0914..af26f1191b43 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h @@ -63,8 +63,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #define __pte_free_tlb(tlb, pte, address) \ do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page(tlb, pte); \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ } while (0) extern void pagetable_init(void); From patchwork Mon Apr 17 20:50: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: 13214581 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 D4D3BC7EE33 for ; Mon, 17 Apr 2023 20:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D9E8280004; Mon, 17 Apr 2023 16:53:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2ECF76B0080; Mon, 17 Apr 2023 16:53:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CA70280004; Mon, 17 Apr 2023 16:53:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E5C2F6B007E for ; Mon, 17 Apr 2023 16:53:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C06F5C0634 for ; Mon, 17 Apr 2023 20:53:18 +0000 (UTC) X-FDA: 80692083276.27.9880F1F Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf03.hostedemail.com (Postfix) with ESMTP id F0C5F20019 for ; Mon, 17 Apr 2023 20:53:16 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DU+PC+Lb; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764797; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=50k4LBrsg9tKh76cSVjOI7CCYg5ldzOB4rmd3wrQsv+oGjqf8gw3ONCFDi6a9Ki+/yzFBU /AwHpyuo8uqWGiZpHJ/4+vr2LZWvi2R7WIisQsbhmhnVryiJaIet7TioFl320V+GqPp0UW KzVb08PFEZF6ovEWmTrmrPUBs84sWbY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DU+PC+Lb; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764797; a=rsa-sha256; cv=none; b=HMp5LAjDLQbdHWvrZVCp9yxON+hwlBR/XIgIf8vIy+IuKAIMs0CLDJPg04JoAWVUEUPbp6 UjPsE1yyjOq03/xuI7lh8Lo2Q/tJvwqhXw1hS17MrjhRo7klsuCaGVSAlAf7UBsIm7ma5v /X7Ghi08azckQGVPy9HiSGopycaRaow= Received: by mail-pj1-f49.google.com with SMTP id x8-20020a17090a6b4800b002474c5d3367so9750923pjl.2 for ; Mon, 17 Apr 2023 13:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764796; x=1684356796; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=DU+PC+Lb75+sxyzE8TFBhUq23MhtXNiuA1nw0c/GhsuV5IK3M7l/Hh4azDLq1DRa+j fu7HXiEzvV3T+N5Mt1is7DhkrUBl4PJsqFnRPYaX3oFVj8P6Qlk5ZLs6mljyu96mU+sv zpquQbUhbrKn4GUU7udC1O03s9ThOPwnMOZQlJkJdwRy8ikjPxI0naLAwtnZbb4WzEoy 3BNpuQVnvIHEKJKSenAtt9bKOamb6q7fxWlfz+PtLFjOTztncr7nNFnGXeF7WX7UQ2CN r/J7luQKDmaqSpU1aG4/YKRgzEf0E8SysEU40ARw1q6PEFiJTtJVgg7dYOEMGKOTGrN2 xyCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764796; x=1684356796; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=WzXoKl63UCqv1udV3DOTjBvSYmnntshRpY8JY43a2ljv6tysiMQItoBbRD2hmopSyz gFTEsi0MjcsMe3ODxZ2K7PAPuK6A3B5evkkSQ+kTNzReBBEPTfRF74fGADsNWQv9XtKx 2BU8Kzig7tv1I+GekAJk4kqazobSFUrlQ6RFLJDO+wfCAN/TwzP/sMxJIoowCYjCh7gg p5OPBcm3KrMbFrvTbOJcxTYnhLIrHJK+FCbuoBKFAfk/YW1uzN3QZx1vgyQBOm7eAzSd VbH3UmUUJMP3HjFhaNvxH2hjC7W02nWcwu/W9IsrG3l8+vfgGRz0YZQyu4zKsIrWVb2P 1PhA== X-Gm-Message-State: AAQBX9cF10B+Uc2KD1lIpeDB78N6+wYKi2QewnIFEk8D5aRY0WolsFRQ qsYASVzEbSnoiMVDghYjwRw= X-Google-Smtp-Source: AKy350ZcoHXe5N321oYs87Q7Ayd5DnxwU4W2BhAi27QaGMsyV7i9NrgOQAsujiVTD54cy1B75qhHjg== X-Received: by 2002:a17:90b:3b8c:b0:23f:9d83:ad76 with SMTP id pc12-20020a17090b3b8c00b0023f9d83ad76mr12727299pjb.23.1681764795745; Mon, 17 Apr 2023 13:53:15 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:15 -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, "Vishal Moola (Oracle)" Subject: [PATCH 22/33] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:37 -0700 Message-Id: <20230417205048.15870-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: cqgfzga5du9xz3fwgaky4ptce55m6jt5 X-Rspamd-Queue-Id: F0C5F20019 X-HE-Tag: 1681764796-567460 X-HE-Meta: U2FsdGVkX1+YPVWOyT40A1UEhg8xgF3GRWZR4r0esj9pUQ7XYd8QkMqSwGMwIrUcT5G1u/jNAK5oQWRnRrrXyxqbRg1OsPRN2uyohEwFgIuvDmgd5l2LSRV5EJpZI2GqwApZHWKV9aLwBotuS1X6tpA/Qh0v4K8Jb4iCh3YybBcZvFe0LfX5g+2OGnsogz3nhG7tEf3jI/ti0i7aB10INGw7NxslFysePc4WkKaDA1ane3CcB8i/Ap8r/zmcnIA1rc6MT46Oj6BW+qTFf2uUciHumWapyV4+fHmtsN3Fl+hjOkAo5BQOKOOQZpsB7j8yvyzm6WFKMtEwrMMwVBJqkTI3f8z4mxY3ALX3TO/o1BBT/Qu70ekqbNFjgWAqSK9WcIXwF+Dekryj2CCRwZEnQt6VYQwqi4oSYz3WKWcxYgztG3ztR1CfDF+cdFwQ2xjbrdEYyQZXKSdETbQH0Km3CJ4v16VespS10E5IQqyBPzz2aF+SaVJ1RlDaHlf8m1myBFgAMEx2UkShLBL6s2IwX7yujSRz8wc6Tjf+mi5eTY/U5P4b6BZSFksdNvXR3Yhec9hOMjb6gYvkrQwxjEZfVc98cmJxtqnRdjMcS5aHpo3uU4VP2uG6J3EtSNANOUevuqdWTUZg4FUoLZPgTJ6vzbXBQja6KYHi1gRV/nq/V2W0rd2XgfH4MJ+Xf+o4mChJP8ES6ZIO1GJ8GENCZCgwHMO5k9hTLCxEWfMjQ/0b0jyyIwBK0LRGwnBCRKGxVUhqBQ8aR3n5lp9lFNXuDNIYakPTEVmwSAVB0sjscjaS3HPp6uqflbuyIs+fP62szMJ7L27rDLeEW30QHp2wZIfdUfPQJPFM8evtGhOREH1uv/3N/fD0jarQakbDs2l48gqOv1WpxS7oE/ALpz+DZ+REC6+SsiLeAqnwKw2IxfeJCvC4wrmqecyLFL4CesNQiJgM0lxGXfbCSzQ0P5J9yV0 kSdo3DkC kwi3FMybA/OhpLcMjO5dkqj96psG450SI89Ry1ijZRi/WWMHMHF1xZYOaTHqlTZFUVPBNBSJY4nmQKDNryCzmYrNgAw0hGENrf/U2znKdwRguccqdpTr2OBbC/AhIfZbcIMgb/6s5IzI3M6k53AI+BiGLPzBze6asYRXGkkSd2EjlVlY7OuxPLnc33CpRfBwsq4BOj6crozcE9yMyO3/x12DywNbIOW04aQ9Xc2Gme72f041ozNGQNAkEfUPZW8rjzLH+Td26ZqRbVkCWnm4IqS+QvWBKPCiOxye83wdmWB9IT90djTY0zhgtSdw1tP2sMdBMe+lLqRRhqWpRolqhCgdl4irh6oU7Jdbj3gnSJt0azwE9gnygmWvyrZIKcn6JYrmt51ofeK86+tmbF0fBfHlwaiBRhrOnS7DBEDL7Q4SH3ySCMhdM9K32F2ud3G4/eQpuYL2VwZCH924PcaenrlvR4HBLSzy32LGOHw0L6WJN0vOG+H2veUcXmCIWDByNJp4y7OTa6llDN+OGrYTC8HMYTRtKP29fQ0mPa24qKciMtPir9VnxpFMrmKqmdwHFYyYXTYt//DekkXhe2hsXO61iZg== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- arch/hexagon/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h index f0c47e6a7427..0f8432430e68 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h @@ -87,10 +87,10 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, max_kernel_seg = pmdindex; } -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor((pte)); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + ptdesc_pte_dtor((page_ptdesc(pte))); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon Apr 17 20:50:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214582 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 D1ABBC7EE3A for ; Mon, 17 Apr 2023 20:53:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 782596B007E; Mon, 17 Apr 2023 16:53:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70B32280005; Mon, 17 Apr 2023 16:53:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 536606B0081; Mon, 17 Apr 2023 16:53:20 -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 3AFA86B007E for ; Mon, 17 Apr 2023 16:53:20 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1B2B21A074F for ; Mon, 17 Apr 2023 20:53:20 +0000 (UTC) X-FDA: 80692083360.16.F9BD4A7 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf06.hostedemail.com (Postfix) with ESMTP id 5326D18000F for ; Mon, 17 Apr 2023 20:53:18 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bwk4ooUg; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764798; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=mtM7qSI3+1TkM1A/qhl3KnyiIz7ZIXSYsEwBd5jZTLfHzg/P30PsWEZL86v00byqysbvTn OJdg7toasKnaz5UDJ2aAezUT3GEC6rh3PGN2hLiyIRGwDV8lVd07wvuhKPIBEePJhKghk8 2K4U2i450by+PEEIUOv91VzPJz4UoRI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bwk4ooUg; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 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=1681764798; a=rsa-sha256; cv=none; b=ol6s71jpNmZtnV9cqw+smqQF1n85egZqIQOESkV1pXD6rfmL0bhpU7Pefrfd7+jxnDbar7 k1Rj/iIZGdyAOV+ZU7v/hRHG9qt85r36UstsoeiIvEfL7IPxhxgSv4DyICxmr7ZUHqINws /uia53+5ANDk3m9C4rZi8W9Wd6W/CM8= Received: by mail-pl1-f176.google.com with SMTP id w1so4515004plg.6 for ; Mon, 17 Apr 2023 13:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764797; x=1684356797; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=Bwk4ooUgupEoGCPug2H2Eo/HpnuuhxU7x81C/Qk6PZMSk1B54ZJ/T95wzfLs2bHmOL EoIfThp59UctKku6w1OEzm9Tx1+NGxZtvh5x5EZcL/GqxrGONyvWeZgGKJ7IB/ueJlyr 3shywEfhQgNVSuay+LMKRYZJ2fcroNukWPhJ2nbiEAP2p1v1zQae9MOASciSz7iDNPe8 PaaHFDAGtzWOJsB/jrA0V4yjZJzVFkj1D7lHE74htYvR1G0N63C9Bb92oSk5fpPTqJrg y20llT4kvkmAZ0rau94Yl1KLiffp2Awm3htmoO0PKOmikRHdd7NJITZhSry9QyqyhUwZ 8Oiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764797; x=1684356797; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=YvlEmwYH5nLYX2Zblo/vdzVLxAm2plea9Kinqw9h7f4a1ck9La3qOlYD0nbQWkaAzK Ub+3eq8veyI+/mv7xt+ClpKmNjaFzedD0PJTycP/SaP/mwK3LtMznKUn+NXFvPZla7YV 3w5vy/LchrVeca7DsV1bbfwsxaLysgSeBFE8sUlVM63s4iF+k9DkJxByooCnpmt8yjet K6cC7kdM2ZciobfVu/HGTPbs53tDzw6yvW2iLpRnl6rSmutHoq7LneYEvNP3LMuKt/A7 WpxHti944wefJclwIPzgSzRjOWLHMALiymvHkvtP/yrtjq2t5cpbNlVKuxZEsE9fNAqz 586g== X-Gm-Message-State: AAQBX9cHY4Bi6FMfm3/IXds/J6ah7IYV85NF8zSVmYNWazhjkZH5i2/D 5tcTzIE+h+uUyBoqnR8hdk8= X-Google-Smtp-Source: AKy350YGLzUMfl8U7k4p6Sd9nO3FUwkbMa1TWeVYLUOOgANIZAClkJJEoJzR0+dt425gFfwmjH24tg== X-Received: by 2002:a17:90a:ab12:b0:246:8b47:3d5b with SMTP id m18-20020a17090aab1200b002468b473d5bmr16661185pjq.18.1681764797279; Mon, 17 Apr 2023 13:53:17 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:17 -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, "Vishal Moola (Oracle)" Subject: [PATCH 23/33] loongarch: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:38 -0700 Message-Id: <20230417205048.15870-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: q7wrc1emww6tow7b5an7bemgwnnqogs3 X-Rspamd-Queue-Id: 5326D18000F X-HE-Tag: 1681764798-586742 X-HE-Meta: U2FsdGVkX19KyJT2pmZi+VKIwpl6r5qkT2Mc7AYDUU+JDsKHltg7uUDndGVr1J3TbCwCWK2vfkhGe9g1pf62mWRRl2AqLtsXAIBXIl479FGcJ9hI8KgbCG7cHPLVX/zJqjBw5UKAKSWBr3wk1p5jIP5TZUnoORSaDqR3W0MKIK0G/Nsz8e59mAUeMOvZBatotdyDZM79KspCJrNqty4rm78l5OoTka8QcwabX3wLhgPzZrP1nQH0myhV93BtaaCqq4+DBw24HHBkQaIERkt4/tZHh75ScWJrj4tZX1CZehCEK6cyQmUUwZjp2za+Qcj2L2dSTgHagn+1t2FlfxP0FlcXjQB/43GdLcPeSwoY/2I8jBuhhRM1dsbSxiRMFddjVhQa5iDjZFHaMHF7AYehOIs+T4UvyoWICra96A9/VTSjyZ4hYA7h/cLqdfMz2W29ndwsHiarYDF5diyhg5FqZTKxfWWsY4KljV+NMq2q3JJNj/I31WhV2MMBwNuOOda6+Pc5t8PqM20xSABYFsa8uophU6fs12BG8XwA7KzTRWuT2NeWJskH0zJOgPNMq7o/dbyyStzkhGURIP8flAiTmHvG6gneMjtmh5H77LfNN93p5w2dFVN2sUztmJlVcPmDk+B7ngpj1o4pbL4tTvKnl0Qp9mIPq3SzHtSp+UJI8GLgOvMg5/7kE75GUJJ2L+egruc1qdFJ0EAsPTsfWzeNigzZ0fH5OH9DgLsE4zu1kLdN4B2Y0oLxUYfHTq8md+w8uXFWEdc3gUDLpwZEuVj1/UV3Q0SCdxxjkwOydeZE5s/tHX48NH8skIgEybUImks5gkl9R0UzDzkUzfaScG/HoBo8vAvHUEdS+/IBS2j/saw+aFfrtfFtAoAwpsyfcnCuwo0VH48/V0h6dObjRKQS5JAjDWeGCxqa4B1PsXG2MZtN7hx6zuXBv6Y9KkYqwHZxGW4kMQmA8DJhwW0F4RX eggVE27R lCOUmJY69/xKs8h0XT3yL35Soyc6tCrCRWjh1lUaIJG+Ae0Z2ObagpnlEU/xqdg36za6Ioxu4epsygZFixTQqA73RyBXVV2sm+A+O3VQc6Zoi6plnjefWhAjaTJH2xWIFU7MCe5g3TQhALCwfnshs5/ntT8OOIYGA2nFjV0O/XYDjb8nYVSEJm/X9ajHNZXR7h9YHqnnlt6xldOUSieTz2WFhNKZkY8aBVG24oainEVhCBjz5AIRuwjgIqR+RRpKtOP5xJUGIHnxHjWfAunt4YjpVuFH54PCtRoRAlg1TOAfJRVCbB5d0AiVq1K307EH2UYzrSFt8GYExNLj+IRNYI+Dt8UcnL5ue9rEhwq8jTfFktOcJQlXW1YntWm3/zAb85wEVeHv3v4bq0cNtp/nF5UGBDRe1/Y8l0NGv940sZezfMfuf/rtvH/m+YeNCufvoTdQAZGUq+0S+jJT0afMWi1Gmec6jMlvnzT8jLM4AA1gIIN1++Wk/xVwA4qYMEqtFkO386AjiHzA24Ywu8zcXq8SRAblZb39pt9lSXSX2VTiYkoI= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/loongarch/include/asm/pgalloc.h | 27 +++++++++++++++------------ arch/loongarch/mm/pgtable.c | 7 ++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h index af1d1e4a6965..1fe074f85b6b 100644 --- a/arch/loongarch/include/asm/pgalloc.h +++ b/arch/loongarch/include/asm/pgalloc.h @@ -45,9 +45,9 @@ extern void pagetable_init(void); extern pgd_t *pgd_alloc(struct mm_struct *mm); #define __pte_free_tlb(tlb, pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -55,18 +55,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_page(GFP_KERNEL_ACCOUNT); - if (!pg) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_page(pg); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = (pmd_t *)ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -80,10 +80,13 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - pud = (pud_t *) __get_free_page(GFP_KERNEL); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = (pud_t *)ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/loongarch/mm/pgtable.c b/arch/loongarch/mm/pgtable.c index 36a6dc0148ae..ff07b8f1ef30 100644 --- a/arch/loongarch/mm/pgtable.c +++ b/arch/loongarch/mm/pgtable.c @@ -11,10 +11,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - ret = (pgd_t *) __get_free_page(GFP_KERNEL); - if (ret) { + if (ptdesc) { + ret = (pgd_t *)ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Mon Apr 17 20:50:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214583 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 AFE09C7EE20 for ; Mon, 17 Apr 2023 20:53:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A5B9280006; Mon, 17 Apr 2023 16:53:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02F13280005; Mon, 17 Apr 2023 16:53:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4D95280006; Mon, 17 Apr 2023 16:53:21 -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 BF67F280005 for ; Mon, 17 Apr 2023 16:53:21 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7C5E9160149 for ; Mon, 17 Apr 2023 20:53:21 +0000 (UTC) X-FDA: 80692083402.05.C76A725 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf08.hostedemail.com (Postfix) with ESMTP id B468E160003 for ; Mon, 17 Apr 2023 20:53:19 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MO1PC1xt; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1681764799; 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=nlmIG8UgshEYTOBASKXa1dMTltHF5q5LujwV+qMeaTE=; b=Cn5M/F1LPORB1eUPkhCLvaIM5wd2kbPq1tK30MbO0YSotOPYRUI/bNL5M3sCc8syRcV6Aj 9C3c+W2x4ZNW51x3oWRSSKe6vEo2BMgnlvQbwlrJHM/B69zFEB6bddAC70p5u3RRmnt5EY sLxVSs/srQSKrDSwE5Tr9ezdkKh0h7w= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MO1PC1xt; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1681764799; a=rsa-sha256; cv=none; b=GKes8rl9hyX9IIMxQKL3jIeF2Nhn1At69EfjTz6VU9xF4KbCZx4sXJFSyjeAy9BEm+BNj+ TvhWxofL6UcsQRI2w8OWEyPZIRBUjnjbvwTAHqmEVeRBhcvDIhMy52JJ6w9h41UnClyN/E f065mKEhOKSjOlu9O7e7VC+1BnvpBwo= Received: by mail-pl1-f170.google.com with SMTP id l21so9394788pla.5 for ; Mon, 17 Apr 2023 13:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764798; x=1684356798; 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=nlmIG8UgshEYTOBASKXa1dMTltHF5q5LujwV+qMeaTE=; b=MO1PC1xt/KvuZ3BR0uFzYFvll2jFuloCAIP6GEEELaZGVsUuayg4+lNKAol0RlX2+3 Iz38d0dC9QwTB6d/mc2DYTZXN+iAw+HkmmeqA37ilN3ijvqPuJYcJPAfuZ5NSiq7Oy0y 5tk6CT5Flw0tO/XZTIWPNors/JAYwfVMvyqbu0GP1qyv9cYfy3iQHS4IKEIm4tGX0nuK r/0iigtw61JwQ8Pxh0uDlXeUn+URgKqdZ4DDg0uzUbspXwSfQOQ/MuFlx/Zb5Bn9cIh/ DsllyX0j/egvd/MrVX7PxBJ0K/+L/v/BhuCd1hvi1MmWpxA5K0b5kps6s+vigGrLYnHf Yhaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764798; x=1684356798; 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=nlmIG8UgshEYTOBASKXa1dMTltHF5q5LujwV+qMeaTE=; b=ZJlVIQ7v5HjQv8I1/W6L6H9zkx61lu8pMY+tnEuTyVKeBrTile5n7p67N1eL171Yab LLU7cqZin7JswtUNTNxZR/QW4UsiwRrdk3DyD/f7cQsng3GN2M1It7TASN3CpTnod7TV 7T2KQzVdjF9JMdoxcSOlX8SRI9+4rY6csK1g0dirCdJyMbLEsOykRnLfX5cYQ04wehL7 rYaOI+HCabuaHvnddh0f9JrS2rA14ujTzXT2ogr7W7Ygg4r9TpVBB1wt8O1RvRrxj02k N2pqmKZJ+zToP8ga5MrBcjXdphOSMMgrP3gMKxLNQzSFedsayj1DHo/tPP9Qo/3xSGG5 i8lg== X-Gm-Message-State: AAQBX9fNs31Bl98jKtvv2L+zHDXrDiAq+BXwZt7wvwaIwW42B9tKHm/C Y4XKK0//DQNHhb4GiTJPMMY= X-Google-Smtp-Source: AKy350aJaFntHhHbUG9MI8ooj+3D57RkURLGHHynthItQ5IDNnotpeWzZJLOOPG0rt2wtYTic7ZhtQ== X-Received: by 2002:a17:90a:7086:b0:247:83ed:7e5d with SMTP id g6-20020a17090a708600b0024783ed7e5dmr6464463pjk.18.1681764798565; Mon, 17 Apr 2023 13:53:18 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:18 -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, "Vishal Moola (Oracle)" Subject: [PATCH 24/33] m68k: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:39 -0700 Message-Id: <20230417205048.15870-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: qdixmikwp63waxgjmgdufg1g1r8hgi6g X-Rspam-User: X-Rspamd-Queue-Id: B468E160003 X-Rspamd-Server: rspam06 X-HE-Tag: 1681764799-11759 X-HE-Meta: U2FsdGVkX1+llGpy2/fN1vU8g2trUfSE08zQzMJc0A8+PavwP+lYHrHEMl3zaXAApC7TuAfc0WqAaMhgmMg1z+t9eK0impk7ghOpsm40VzfKrbtD0atlZv9kYYyXlyhKkYE6OFIzflHDlbKjCfpjtGjp1TzJQMW3QMpNg9LA53LawDW7sYL/Jwj00za3+95Y4cydzT5omVpLWf1gSV/geOqG3c0XkM8eLAw6vsw0Z7rYlEyuqKpCev3sx9952m6BX7M3NRJksmsl7KHOmc5l3fB393VIYXWHYPvlNHSYvXsSTYdweR0G8YNtNeVB1x9tgnAQpCs9t+BWF20K2UD1lHVuUrnjduek5z6UQm0A51dKuFqIbQuvqoc+froDTQvpl0933ENfQgXAvjybcN4KDKFmYsN4E5Pc3OqWcVq3SInwLmgZbmEiAImbtlhY/ERWGEvy2yFjBmdZ0qjVuoiuwADVBVZ+CiF/V+26IJbTT5koIMXv8cYjA6cCYUzLyjQMzco6FcqOq5oJWkVBmD2/7d0C2e2KVqaU/sRYQLQHMKW4lo2+Ilm0Zrl2bP2NmPawECxvF2/YvX+a7kiftGgwXPei8EHFFjmIUW70IpqgflqR8qxHeCG3IIOP+BXjO+92CY6URnDuc8kuHipN/yH8SdTaB6HwBptxb1mVD2ri+zmjpCtMw9+EgtDsI7U7ynVWLdqWhIdCNlUWl2pL6UWi9Wq8xwP8+LpUXnOFzF5LE1uWfNGJbkvTFyhBXVKJfMoFnFbts0ShAwTKL8wwov0UzDthfwbpVLrVfhfKHznVd4PCSJSgH71hPBaB2IDmyfz1q4l9DTwz0LYXgBdpDC2e7c6hROUaQElvvyv1u2WhS9ABY5X205gI+KO8CjXA0Zunj/8JakgNVb89ac2z935yCov03sExDJajABgI19//UGRzwDIm01hPFNICSJfI+AJVg+Zj+byJ1vIjxRt46Vs +AxOyB85 wrhqNf9VZX3dXX9hHZS06Q0LMBKELgh3e0GLBJArNhRhhF8qq3TjG2+rF6hWXRfG/0LYY0OywKGUAHp14ExzPlLUPJlWtCSxjfldMuEUINmAmOTbFvivMMrAb0ucQJ11JJdW7Is/xJW6TQ6Y5bGnegASxWyDvYqNQRXdD5tOwSlSensgyzMfx2BL67qeO6NtlyY1C+5yUQQpIMsZS/+o01ZGR1WKb83wb8BF8KM3wgus85p7We6hO1S9M8MgsSUwhDKK/RJjbljDFd+9iIImvw3Tv00O+SibOWIajio2kcLUu7d5ds8eax9Xfl5FkrGjc5X/OSFavDbhOeDWrqOtqCrEZQKLLxRY+Aljk2NObgd8ijUilq0WhobukplyeSSQUfyK51a8+n0VdXp+QOJj7j0asJ8LxacFUJrtovJGK2OOw1GgMFZTTUUIup+VKxO2DY/hMrRN1meNxXiuQ4K2emAON93gJycYiS40ULtHYZLsfHukVieQemzJNEhDXQh/BP4fajnhOgnDddpdjnoa6GLhTa6PIv4brhKP9t4WHj1cHUmg= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/m68k/include/asm/mcf_pgalloc.h | 41 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 +++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..b0e909e23e14 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -7,20 +7,19 @@ extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + ptdesc_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | __GFP_ZERO, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return (pte_t *) (ptdesc_address(ptdesc)); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +34,36 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, unsigned long address) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); + pte = ptdesc_address(ptdesc); + ptdesc_clear(pte); return pte; } static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(ptdesc); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } /* @@ -75,16 +74,18 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long) pgd); + ptdesc_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | GFP_NOWARN, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = (pgd_t *) ptdesc_address(ptdesc); + memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT); return new_pgd; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 198036aff519..013d375fc239 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -17,10 +17,10 @@ extern const char bad_pmd_string[]; -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 911301224078..1e47b977bcf1 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -161,7 +161,7 @@ void *get_pointer_table(int type) * m68k doesn't have SPLIT_PTE_PTLOCKS for not having * SMP. */ - pgtable_pte_page_ctor(virt_to_page(page)); + ptdesc_pte_ctor(virt_to_ptdesc(page)); } mmu_page_ctor(page); @@ -201,7 +201,7 @@ int free_pointer_table(void *table, int type) list_del(dp); mmu_page_dtor((void *)page); if (type == TABLE_PTE) - pgtable_pte_page_dtor(virt_to_page(page)); + ptdesc_pte_dtor(virt_to_ptdesc(page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) { From patchwork Mon Apr 17 20:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214584 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 DE372C88C83 for ; Mon, 17 Apr 2023 20:53:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB206280007; Mon, 17 Apr 2023 16:53:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3865280005; Mon, 17 Apr 2023 16:53:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6222280007; Mon, 17 Apr 2023 16:53:22 -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 AD74D280005 for ; Mon, 17 Apr 2023 16:53:22 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 848F280643 for ; Mon, 17 Apr 2023 20:53:22 +0000 (UTC) X-FDA: 80692083444.28.3FA2713 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf03.hostedemail.com (Postfix) with ESMTP id 9BF512001C for ; Mon, 17 Apr 2023 20:53:20 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DwA2KoT+; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764800; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=8RDnxhrD0YbWz9sewiHYQ6JgpctyaP3ZWdlz8SUbWsBHPYIvFUWfOhchZhUAIHgo+buXNb 0TRd/0YCDGQdFJ9m0wEN0JWaO/zV+7sphz7Pb64APBsXcQoU2mLxfTS9MJaB56W4mL+rc3 Z3uhI7/28zESGWg/d/GUU2jBYg1UZhk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DwA2KoT+; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764800; a=rsa-sha256; cv=none; b=HPsh7MvS9sLxvGIMpjLvRZl/Mt+2Hk8ZOMJqr9m9hDu+TqvD7/M194OEvsjaPRmafIG9R5 XyDtN6LwOPNWnwre6GCAOGC/AIe4b+7jpy3rs7hvUNuZyJora00k4QRjWlp7fMSM2wQwWQ yOW3OD8OVnBk5XEF9vez7OffHYVfx6Q= Received: by mail-pj1-f49.google.com with SMTP id x8-20020a17090a6b4800b002474c5d3367so9751314pjl.2 for ; Mon, 17 Apr 2023 13:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764800; x=1684356800; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=DwA2KoT+Gkb+TSG9gl3xh2UjcEOrukpYDh0FxXwVNpDTsL49sodGBFe/MxZJLiffh8 Okfe4RTRfpJn4SFFKcweRaXMogMu3aLJXW8S0ijOu/y8rquyNOCuhOYqIlMfHtHNwFXl 0RIVF9f99J773/WS0WxWYyLGFniLvieyUAz5torJ7RwCjhPN4iKRxNqBQLtPHzo1HkHq UDiYLsTcdIpx6G4pcrHTW0RLQiAILxALX6WF9BC1qxq+9QtqiExh0N2abkWgWZYyYNmB dTtZwe83/hP4XI3Q8dsRpB6pTlzqUQszpTQqyb8BBRRnRiGvSruO77w1spjFd7OVj31k rIHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764800; x=1684356800; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=AmAfdq/6ecMnrsSl1tkoGRmgB0siUAuKzkzea+B4pMf85LWOZcGqkRw129gQrtWIes Fzo0Xrrsg8B+O5zoWDY8Psga0EcARP2roaxXD1nKvdKVgPQbXFa8VzmFejAEA75veqV9 lZqeepmXSihckSw4xM5XwpfC+UH/IIc4ffgj3Tgqb7MoVV8xHoWKLIoTsokrkfpa4q+t FIr+Oj9cTX02yuby66GvbRPmvFf4rDFH4E9gHhzXXn+gGT9Xo117mDgVHNOUtMNEK0bH EPCUaRakQ/pDBsBbHGiZTcY+AwVI6Rp0xfFAgIc9WtLgzbujKZI7arSdRvw9V90eFo+p ULnw== X-Gm-Message-State: AAQBX9dyly9Q/twUl+5JDTtoMaF1knemgESdYqDJGLOueI67v1wvVRzl nzLGOlIxj0yF7bubmu4AD3w= X-Google-Smtp-Source: AKy350b8thcmecOoaOKiNwMZgeAazmiEiQ9V6nLrivAsLyOgVvPy05KEMe/JXWQl3cGgcJMZ1iU0KA== X-Received: by 2002:a17:90b:3848:b0:247:4ad1:f69b with SMTP id nl8-20020a17090b384800b002474ad1f69bmr11748993pjb.26.1681764800112; Mon, 17 Apr 2023 13:53:20 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:19 -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, "Vishal Moola (Oracle)" Subject: [PATCH 25/33] mips: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:40 -0700 Message-Id: <20230417205048.15870-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 6zteuztt8y9grx3egdeowxmo7toj8mfu X-Rspamd-Queue-Id: 9BF512001C X-HE-Tag: 1681764800-481828 X-HE-Meta: U2FsdGVkX18n0pdZ3R6jI958WQfiKf48ylydwi3aKVfFxKFqSE8kltXO5SL1w8f5SyDRA6CVoMrMDzUV0U824w+ZQi+xjeQHfWBE8NYfAb7NjTAnLQaiJFRJA+qfOsHBv8AQ6HVyk5sk/q+FNblJnPT4u1IYGvPgjkbzkH7t2Oj2Wwc7p4gbi0JtZNr4wo+CAhtxoVCppJKX3vOWWXNZtlagsNOjc6c4QfaASkv/1pvjR/jUzeswbA1wTv0NRGTNokGcFaRXshRy7lpsBORQY85psiBYq6uAOSGuv2GmfCqTh/cBGEoHpsPc1Ur25cYq++9JcGPsCexKC5hbtHa0QEM5pfJldAa6XxL+A7kr+k/D7W9Y7kzIAIkaV0f5X5nf+Z1WFCY8r1v62Tb4Bl9p4Ajo4OqGXMRMsXPj0C/Lub9hXZ4livUeK/1g2jA08r16YDuepEtckMTRsk99K5an2kBLd/54N8tCDnwU9iSZwE+gE47vDiHkpUptRHEGY8qMVemkHj+p8bkJCTz9sXOm7J7RQUgBwMh62cSvW7r+Il5Q/sSQ/T5kQfHfu/KpRz3bn7GILhI8l2QISU1RGn1rL6KVtGtwULlRfUwsXMGQQ1I7DBrgB6tye0m8Isp0XcoT4guK5jgDw6haWd+fnVbTLKkmXGmErMJ6FhHbdYvDldAxN4Ptv98mTN/on2qPEoKGjRX/QiwmXI31au728EBv7N6nxd3Rwok3lGOz16pz++HChOPJUbDpzjZaGZF3ADaWGODk1aIdbLZZettYIIjClYAQ6NlSsuHOGN8ru8gssr+WwFzFAYFwzRCVbn1P5RCW/ZjGJY7/a7BUbl/xVWFgopBS3RvLjHNXxbzTOMj8XowIoZW6dmUJVbXP1kNlmi3t0YGlZzj5YgsgEnyujznBEAgFaFJRN80Dg/9zrSKRRALUKKCKwEq09mjkEcyPpEttyA9r/AXl8ywJRjbDieN xUMzt8EK eUuJDksSoGd4VyFOEXOqofHGYIl+0pv17nKGuvlZmsp5VftJk7rrHmtS8/aCdRkamnLbcTHvK08td8bF2nWz+7hXiluqMyZyCMaixUEgQEindxgMqRudyR0YCrVgcAn6Emf7cuVfoX67noZSyLP3StNpCpso50gSXcDLv8rlQPtVSGiJqC+5R7HxTqj9sxerexRyDipEuiAAmP1QsUdvsSbUWMZMKusxdrHhJMJNGF5s4GyZmbh2hE3MC2wgeLhcHRzzAXlGEfwC3HyQJUpvBbYYBqdu7ShC9Jk56ytBhJcziecYbf6gL+x3O2ok3iDwco5GIZ6KGXkArRWLNirlitMQzhCzlYc6gkuCHVj9BWQB1QuJmHn6U2Gq+WzzFgh+FtLjG3obDafge1mwyTSvpAT2J4vac0FAnmi+J6+23cykN2uIz11801+0g+Jos/zMs6IHUQvr6QYEULTjP4LVHy5YZU6LAQBMdHWLHUvy8s1Y2AXp3S4vTjwueK+AzVNuUL67dZfnQI61BsB9S8lL93bLayMifP6tjdYHd2Pm1qlrs6vc= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/mips/include/asm/pgalloc.h | 31 +++++++++++++++++-------------- arch/mips/mm/pgtable.c | 7 ++++--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index f72e737dda21..7f7cc3140b27 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -51,13 +51,13 @@ extern pgd_t *pgd_alloc(struct mm_struct *mm); static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_pages((unsigned long)pgd, PGD_TABLE_ORDER); + ptdesc_free(virt_to_ptdesc(pgd)); } -#define __pte_free_tlb(tlb,pte,address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -65,18 +65,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); - if (!pg) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_pages(pg, PMD_TABLE_ORDER); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = (pmd_t *)ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -90,10 +90,13 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, PUD_TABLE_ORDER); - pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_TABLE_ORDER); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = (pud_t *)ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c index b13314be5d0e..d626db9ac224 100644 --- a/arch/mips/mm/pgtable.c +++ b/arch/mips/mm/pgtable.c @@ -10,10 +10,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, PGD_TABLE_ORDER); - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_TABLE_ORDER); - if (ret) { + if (ptdesc) { + ret = (pgd_t *) ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Mon Apr 17 20:50:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214585 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 090A6C7EE31 for ; Mon, 17 Apr 2023 20:53:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4EBF280008; Mon, 17 Apr 2023 16:53:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD81F280005; Mon, 17 Apr 2023 16:53:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B053E280008; Mon, 17 Apr 2023 16:53:24 -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 94756280005 for ; Mon, 17 Apr 2023 16:53:24 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 69063C05DD for ; Mon, 17 Apr 2023 20:53:24 +0000 (UTC) X-FDA: 80692083528.10.04FF1D6 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf05.hostedemail.com (Postfix) with ESMTP id A608E100014 for ; Mon, 17 Apr 2023 20:53:22 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="p/jfRaNP"; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1681764802; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=O7M3WaT6osmudBGnUw/sX/LnS/EUSq1qAkRfdpzjpOhKEpaZIe8WoWa5qZQ2ZIY9oJO9Ud J0E0Trc9fFB4+rhHUg5HvGrc7JDoQduAjIKnhd1jSu3J0RnmsS0uZ9EfAipdA96R30hxvN QGvjqgLu1Pl14V6W9Rnfag7D/7krTbE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="p/jfRaNP"; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1681764802; a=rsa-sha256; cv=none; b=X/JkiJwCwJyaX5943G5KFUOLwO3VNpXwCAv+sG9vHB3BtM4eAO8vjR29djEQ2Gtl0e/kC0 NxzamRgcnAut0i+o+qzmfatI8zBemZ8J5uuIrq8KQ9rhiw6i+kQtMrzfRSW5p5JQY2vULv hKfRAAM4gDpuZ5gQ8eqK1meXpzHNeHw= Received: by mail-pl1-f174.google.com with SMTP id kh6so25754434plb.0 for ; Mon, 17 Apr 2023 13:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764801; x=1684356801; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=p/jfRaNPQGaoJd3ujqaeLDuUP7t0WkHa2oZwiGdpehhESyVFAOdOmg0fusWkZ2XuJJ Yw6K8nYA6/5N6tLufuYh20gi7M7wxwYV1IodMymMAu3e2vjlzp/s4l9Vf7kZibjxovMR cghNEQkYGyGSVWGuIAzI28gyVhrT8GgnWs6YLc4dnuPB71AZU/a5qfpWgaMEJ0Qfl1S+ OG2NEJp7fE32TkPWsKahDfFv2MiE7qQWnDtWKvNsVMNbEDAHg0y2Zsbd1R1MkIpv2dly 3HDaLyPuLXfOS4PxJXenmM3XNPnXJ5LYctnHIHC9Ub4peO/zkx0GIKpeh+s1nuyRNP2C xoAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764801; x=1684356801; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=ioZXAOlQSyx4qqtsS/6AaTj8KJ0ok69qTixYrvQ40yaAi09/1IyZVbQ9YQuEBKwH9+ ewFA3wyg1fGssmp22TqiuEt4wtd3/5vc4JPjEDsS3O6nKifcnGFIuWTG6EztriNUeK1N oatC+OlgbCuon8/DB6sCYCjdnrSDoBZLQmgZlJC4WbqqoHj0Ud0C0JpZCLu8CYusymty I7SpN7bA9dRnRqgrcV96VwtYBl/wso2YFq4O4AA+RJmh/oO5y+MQY7Wif/j7sp1HH0RY +q7Jt4+6U7QnY5mTgrUJVhJJn35v8bMxxe5TpuxYZ3CZJwIR8HR28ujzD3zvoZA873cA aCAQ== X-Gm-Message-State: AAQBX9fN3wpoM8Tp8qEXAF+t6tPwTKJiYP/A6ySfHzn6PqUxb17XIaI0 DsA4GKPIGIuU2tUp+/OSq8s= X-Google-Smtp-Source: AKy350YG/84D/pba4O2jep64IWrC+mjA+ueyHqImP8NgwjI0qVBUMRNq8Z2uYJzIP+ywt0PW/sWA2w== X-Received: by 2002:a17:90a:8048:b0:247:78c0:125e with SMTP id e8-20020a17090a804800b0024778c0125emr8083390pjw.15.1681764801496; Mon, 17 Apr 2023 13:53:21 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:21 -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, "Vishal Moola (Oracle)" Subject: [PATCH 26/33] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:41 -0700 Message-Id: <20230417205048.15870-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A608E100014 X-Rspam-User: X-Stat-Signature: w9x9bmbumghdu567xkxk8qqs5kbo1smx X-HE-Tag: 1681764802-984961 X-HE-Meta: U2FsdGVkX19BB/MAEfjxj+okGK9BikighHZ/Uybf0oeejYykYgZeBpgEwWpFHJOJ5q0kPk/15Ytcjbu1/PoKS7+0XHlHvjFUikrTKyhgYEtzF4sElrxIvY4E4IDIU6fnEfgPc9oA9jRhchWs8GJzX/kne/mkFWl3GLsn39PS2CeE997UokVmF0DkIszoj3baES1CektQuK/882i4DWIiV+k+wZ1UYDxsOPGrsiEYsNJMzzzTj+7Jevdy/iGNbYXoxzkHKIdIeDiUsoX8SYRBCo6pDedJeD6ea1km6L/eCr/DucacU70gb3qo9g3Mn1ck7SUCEZbyrcsF7FOCzNJZwefRP5dB5afP5UTwL3mjI2lK7OtDrtciYVVEFTvFu8k5KrVR2kjF/qE9mJAsPWcAgI5pWHvKDVD/J6iWBTZ6vZd7VZZNzwGbuMx/PaFwoVAIBGKSgniG/qaTdu5QVyo2yYP9ILswFezIb0D3MheLzibdsgpcQI/EdnWJeTv10Fq42KwVMAgKhgegtjaqwb8+AJv00/2htRSEGsLB3UilgiIupLdDgyZap2Adu6MW2+C6naAWTglCY/D1vlRYAw9gpUcsuCYF+BFDfm3V+o6bpilpbUh5KikVGl64sy6hpY92ZHFnQTm7jQ5dDQxv0iflKwws8umD5RnRUh5lQR/JoaTgJgeoahTnLDnOr5vFbhKhcJ2+WS20vKSSdwoGE1V5Me/bSOyeEgPgDXPvGi+m9k6M8bHp8chGwpZBl4m4KYrJoVQFT3geRti0gfGN41CurAuxXZYZ/JgoMyA3BRNb/QC1drIFCfn2S5e91oC4DlrzZSUxNRgVfvrgR++4t5ipLNIXlHAyfe/aZoy5687/noPK7qKtJ80qKGyEmISx0jiWy3vIW48iD7DWkf/jDayiMSzhbFw58XPaSY33boVd8nttVBV2YnfUOafG/p/yzquGMsSZ1+w0A+9qBEkJtTt 6PY/dcON L6pEBdtXIHu37ph4pFQpLnNPZtYCIWoeaBRkwIM5UgYLcf7Dg6MC6Tnc4sxaqeT5rahyQLDv7VDwNNJPfLI252P6HHtllSOigRaqQgwma1yCZjqsyGQD9Cybvfb4QlSlq4W3lXRrCDZc8G9IzMywZEdVxQK5322JyTYI7ExfyUpxRwPEZGPCf4d+pBcPWctdhT6c8tRGHQ80c79LbRTGFhdVUoVMrmByc9Eif/3N1HZWwGhm3dstPvWe2Va8SFsbJ7md89boSb1YC15X3g21kFT6Isp9g7zcLHWOuKQbpvw0qCASDxqwcB/Cgi6v02ozDkYeAYR7eY7MCghlTcnGwSiAOD1/Q+eRpLB6oVSBRZzYam/0+Qhmc1HTH+PGiBQzzbnxX8bdvurtzeGtXozhiBynhrcsQc7AYjF8oigJmGAOBzCiPh7IkTBDWUwtS6Aw/aVf+DrUwMCn8ko5ZR0O9iXihpDxZHINllNOAMss/jkZeL96DHVsN1342inOrZOls/ZdeRiDOFiM+RClUFg4McBj1gYgOCXRZnUiwybDN/QY6KEbx02VfTRL9e5rpFx5Z3M5HAST/HfftUSHWAaJukZn88Q== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- arch/nios2/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h index ecd1657bb2ce..ed868f4c0ca9 100644 --- a/arch/nios2/include/asm/pgalloc.h +++ b/arch/nios2/include/asm/pgalloc.h @@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, extern pgd_t *pgd_alloc(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ - do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ + do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* _ASM_NIOS2_PGALLOC_H */ From patchwork Mon Apr 17 20:50:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214586 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 B474BC7EE26 for ; Mon, 17 Apr 2023 20:53:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38C37280009; Mon, 17 Apr 2023 16:53:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31408280005; Mon, 17 Apr 2023 16:53:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14053280009; Mon, 17 Apr 2023 16:53:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E418E280005 for ; Mon, 17 Apr 2023 16:53:25 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C42CC1A0759 for ; Mon, 17 Apr 2023 20:53:25 +0000 (UTC) X-FDA: 80692083570.26.E8DEE4E Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf30.hostedemail.com (Postfix) with ESMTP id ECDA080004 for ; Mon, 17 Apr 2023 20:53:23 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Sg9gXChN; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 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=1681764804; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=pJ7hhxp14un8aFvEV1t8DEt/pla1/nGPIykgVubaidGkZk9aAZ3KfisHX+p4DtMWfm9lWP /G/Jfs3m2mz0ucfDM6PB+9j/et7LRT3sKyqyIQPFu+PehlumBe6kK2myYTvBx4gLfo1hMg 7BdaE9tzfav84DgptbRg3EpYX2lX/o8= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Sg9gXChN; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 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=1681764804; a=rsa-sha256; cv=none; b=R3gNa4Vl40oskRRvBKCP/dv0CKEymw/150m9GMTUSVcM/v3osr7D8oduNm8zFjhTTlKRv4 u00E7CjuZ+fOMFkcAOdD0XzZXsOd79RZfIwrUAuM9cY6k6/4z+VKEzu3HQXLeqZFbKEzLb bcVy27VaWt55+PSL84Ioz/xsb4bWD4c= Received: by mail-pl1-f172.google.com with SMTP id o2so27331019plg.4 for ; Mon, 17 Apr 2023 13:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764803; x=1684356803; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=Sg9gXChNrNLShRRgfwOKl/OTTCvmKSrllpuIiui1MavGQQvyi4/hV9+QaVJ3t9hABY 7LNyY9zC8MZPe/8uyGF6BwZFFCebqKsRkCF7WD2/MczVElNAeTdXAZoU8m9zjTh6P7Zy 0Ui6eydpR2I1tZyrhRUO19d2JsU/fHL/oyFe81PNxO86Jxw/ya4bgHlBy023YgAYk0Ea ro6AAOx594UY8fA/m7D7bEpjpZMo/caINuRe5NJsUpyuSeut+/oOBeuT5hXbXmkAYI67 Pav/++zqcV0Pbp5FUcdmVoTNUO7tgK9EwNCc3eK51W0dnm+P+Og2+jgMY/+82hRUmWz8 imHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764803; x=1684356803; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=GWYNvUFWRD37H5+EsLsvOgWgch0t2V4L+ltGWtD1nn5bzHV4CUAMXckeWIHtDbCwcP ul+0RdJjPQJ3iiiiQqvv5z5Mn5i4+pBjyo9czKQwrmHNpoT0/mMTb7UKV5vAVoZOHP4l gVvUtwjxPrB30Bstg8+iby4UiiUIGbmoa3Qwj5GpBoSOxcGZWTJ5TAWSHVOjQVsjqX4E k7m8njpDIP4nkaEfWxu2t2Y+mn04tVboSriF+BarEoqiLB9xEzmyd7AtWcRLquMXRf+f 5rltJY8ZKNZLAnF6qcuqjErbG9I6G0aKbKVKgB16+WwAIuLkfDkP2KhGkRt5XeajNpIe 5D8w== X-Gm-Message-State: AAQBX9cehLzWy7BCuY74W586g6+xKK5KlwxpMmB7mMnjytPnUCc0mv3i upTAnSZI58dRAb0zS/WcEKo= X-Google-Smtp-Source: AKy350ZH2s2lfJdxSYj+T2S9Ef0UoYzkgLYY3eeGq1S7Q2hAbd0lFGX52BFTYQkOd2khPVGSck6LXA== X-Received: by 2002:a17:90a:e28f:b0:247:4200:7432 with SMTP id d15-20020a17090ae28f00b0024742007432mr11696070pjz.40.1681764802858; Mon, 17 Apr 2023 13:53:22 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:22 -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, "Vishal Moola (Oracle)" Subject: [PATCH 27/33] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:42 -0700 Message-Id: <20230417205048.15870-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: y6spnkgjy4fm9n9bww8smaih76xfsspz X-Rspam-User: X-Rspamd-Queue-Id: ECDA080004 X-Rspamd-Server: rspam06 X-HE-Tag: 1681764803-310132 X-HE-Meta: U2FsdGVkX1+a7HqZ0wSWo9QNInG9UJZ5Fo4nZAH9YAa/gomUPlJB1lPAS4KClYZnppwf/4h1KaP8gz/CYJOb6BHXwqaYsJuhQZzEsygEbY32cOQAZnSEjw6d4xkMMVg+6dORoGAUM1tweVadXHiaEgqgO+/BHT5uK3Ikqv6fH+YhMGuv5DNXx1xRaP9DIiA8KhEm36pg9WYl2c2fKIZxoC12qJzfhXtsztMoWEi5MZADUHYLEmMgqZv1pPMXHnmpgxH9qrkzxORv6JdNnnQKVHGEpUnM0meX0eX8YXSNYuhYjnv4SPt98GooBDImUQuJwz8mp6kixypdzMtFrTIU0hRnUOUCsztFaIFVC0TVzYzGbFmGxy0at6bF4XlOvIBz2YfKmmdP+Gky/iuOzu6WIOdIJTLhPN2GTnTS1CVImp/i+sL7gLKYHj45tTBunUzaXYI1w8odDF2Tfeh/8zs1PL533um5GyPwy7RFHfmD8X7g8QlTZDfn5N1XzGVHAQlVgFirDiwOLz5mK4N2LE5fZz91Joa7+lPmS9OAuPU/+BAIe3+b4DqdeVL5Fia6wBa0CPsJCj4MhDbsnsT1YdGr3rek/Dp7+h+1+wBLThq91kIg0xOYT8QaGh83uCfAmK8A29SNSXFLp5jflKkmrILDCA5zJQ0yH6rPUw6APzOw3uDEtVR58xIsJgcG4VK92LLxC/l5Dx4YKv4JSbxvYdXWJIxzfzcq+Cew3WXWAo23LF0TM9D8DtXw3QYkJNlzcxKBt+Q81G9sOJoR9JsnDwfX7bFXlDB53U91LKoj44l95rjTT+MgjcD3vpxcQ1VsYJsKJrxBiYc3hxF9WFGgGX7xrnQu50PsHEIS+gTxl41ZAxODpQ1g+XB5OatRj0TUMdSA04ufWUH9KO+f/LMyQkRwLKU4rskv81gwIkkKdrYjnz6N31q3klDoe73JtnIODfzg2aEm4F9x85C6lLt4Gux fLEYflS4 1KQfVk1wZctvQTGS46hwqGT8NNIoSQ4WTfGg4Hl4EWUy0Weuukfvsf1szeFtu6zDcYxCdDgakZieGBeJLzQ8e+RJZJQRcgkV1hldZZtZ85JJP1XmrciZCmpV+vMBsNRvxRO9lIYTU//o9yn9y6wZFnAq+Zyzn3I6Xwz5lijDk+WxHip3N82A+LQaxDPSYDhW5LXIQUY6jQzsATesdtjBANe+d5tiryfIUIEro6aFYklGR+hLH6ADk1QxlALSR09EuiJd/dju77x7E4NzYuKgY/gPnuwEi8kvCPmWJp1kyUs07Fst5Ngq9GKXacYqaq/Kjua1o5xUU0MXKNJhGkoi2e6tUJEpoJNkFqMozPa908LhiDSxmbYrYmPaUtEIITvijKEeQhZZj+NyUSfBZy9gygrDDsqh6QyZvqdHIe+1GGzV7dTW4V9l0pDkz3gc+vm6V9JMjHahCIDHZwzIKmKnTLFP0bLGXT9OfZ8CN67gh/lf6hPrgyiPhU98yfVBDFUScHHn85poNBLxBWkErr9U1Rh9e8Yk+SHhcrqL8niIGai674nxQY14AHPxQYJWwZpeRf4nQaHMb7I6EChxP0mqQFZ1doA== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- arch/openrisc/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h index b7b2b8d16fad..14e641686281 100644 --- a/arch/openrisc/include/asm/pgalloc.h +++ b/arch/openrisc/include/asm/pgalloc.h @@ -66,10 +66,10 @@ extern inline pgd_t *pgd_alloc(struct mm_struct *mm) extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon Apr 17 20:50:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214587 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 13777C88C95 for ; Mon, 17 Apr 2023 20:53:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B795C28000A; Mon, 17 Apr 2023 16:53:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0389280005; Mon, 17 Apr 2023 16:53:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E09A28000A; Mon, 17 Apr 2023 16:53:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 72FD8280005 for ; Mon, 17 Apr 2023 16:53:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 46D801C659A for ; Mon, 17 Apr 2023 20:53:27 +0000 (UTC) X-FDA: 80692083654.15.7046F0E Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf17.hostedemail.com (Postfix) with ESMTP id 5EB744000E for ; Mon, 17 Apr 2023 20:53:25 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=CQxyKkc2; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 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=1681764805; 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=uzUB7crKqn7Of69Iz0IiuKaVcaC8bpzNVtqjj02cJJs=; b=xEGrHsDJXEYZn5JgCIfAqaXQpW2ugVDYnba+SF4kTuWqj3CTBAGJVJGj/KDFZR72p9ZAL5 xjvPMbOtzS1s+sASzaZhC9coxTDaYup2MIraVrsoHTSCd2wN+97fJnRgJ5XIIbK2bxa3ug VHih6jcFUTtHkuIm31MATav2EwPcsNs= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=CQxyKkc2; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 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=1681764805; a=rsa-sha256; cv=none; b=Dr+/9k2w2ei/MbfL6sJGcGu2BZ+Mb2JUqYldfWdG7D5zR1gHxJj2Y5seldNFApYdkQXZ1a NQrZcDttv213AowKrAcAWbij/rkvXUaTPJVxbdenIqYiU22/BTLSWtAAGgq11lw5HDi/JM voTURwk+DIdXSpzRItqefagAs1lCCwk= Received: by mail-pl1-f181.google.com with SMTP id p8so27389183plk.9 for ; Mon, 17 Apr 2023 13:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764804; x=1684356804; 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=uzUB7crKqn7Of69Iz0IiuKaVcaC8bpzNVtqjj02cJJs=; b=CQxyKkc21JMWEGZgaxo+DzkT7hmUe/EPeRLNy9307TK3NRBVO8qYFVHUBh0a+wrrFK REDRofZ4pQ77HB/xKTTnWP/BT1cyKC/pHZN9NhEm5iKL1tflp83IUSNn/z3JIjWng98Y 6RfpzxV5XfPWxGKOX4DdYV/wLmmlXNt332CwEYLgb9fOwCusASfTkzDGq48OmDuUGGpq tIsA4gMM5D4jkK0NC3tYS5RarJ0ZWQtkI1tM39+DRuLci+gK44bt1F+fDRaPwS3T5T9g S4uLRylS37AnplaeXGFnk7T6Qzad8RMawrqwBO6UKOhHtptnemCZZZWNN4xJh7uqqhEQ vrGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764804; x=1684356804; 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=uzUB7crKqn7Of69Iz0IiuKaVcaC8bpzNVtqjj02cJJs=; b=HY+AdXPibTvqJigH0/utnhrTGfc4NglwTb5Z1DhyPmn4tGFDgeQ3O5m7GgeDbNwFqh 7AES1ViObBh3HGr/wi6AQmDmBrT53c7//N0EGq0beyMIw7iZWigFAHs4jAtpcxgdE8s2 icXM0OqPwHCq2Lj7igFOFE7L146hmEyMotvENBR4vFOpLFSy0Kmcjh6iGo2t2kI0H7Rr fRrxap2RxfBw/72O94XwzQ8ubpOwh8S1xIcE+oKeteiMzzUuEfyrVxxZIJpfeX6CA6QY a4bCbwmnfmKtP2hsdLI1yuzC2kIjd86zsGujonf/LJLvqZox1bP5o9Rk3Dazhr4ECdoG uz9A== X-Gm-Message-State: AAQBX9dSYf1J4JE96kfnxwfIm8PP0qGE8CuHA5OP+jctH5pzurpwbRcf GCX9jFIR4yRqpfHh6XRa+Btt0m42wXOabw== X-Google-Smtp-Source: AKy350avL9PdXaEjhmJuV1ybk5n54BLKq2822oDesoZKEo2GpNTKDMiGoy71eNPEPZjYfA/nM1qr3w== X-Received: by 2002:a17:90a:1286:b0:246:bb61:4a5b with SMTP id g6-20020a17090a128600b00246bb614a5bmr16053424pja.8.1681764804243; Mon, 17 Apr 2023 13:53:24 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:23 -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, "Vishal Moola (Oracle)" Subject: [PATCH 28/33] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 17 Apr 2023 13:50:43 -0700 Message-Id: <20230417205048.15870-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5EB744000E X-Stat-Signature: 4ftuqkf31hxepntts68fearqr8oqj59b X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1681764805-144710 X-HE-Meta: U2FsdGVkX18kroIy2aKfKwbSe24xWXm4/nmr3QltOHGRVWPCpU9T/Hl46vFvLHPrVqXKGjrs9kYuvvYaxOU9DtkIF94lV5aenePZ66kqRWpMQ0A+o3cWMtQngvowa35w5yd9IQyhkbhm6Dmzm/P3b2Wm4pZgJIPN/vuTaT3M7+MvwULjOKNSpHNNpOMwEZnO3ZmpeofrWwdtrQ3rY1RSf73LERlgRLg9v3EyZQfE7EYWYe/DxGTAg1HtWwq1O77YouFgBp7A/0DKikpq88hxcnWV506xc/6RV1bbETQjmYN3ALws55MG+RlCGOggEJN/c+rdH0eFt+dYboz9HUtkmV66HNwzh9ueDB/xAfWVrav+XvdC1wqG/Sctgc6fF/oXK5Zc9h2jj31xEtvsNfakhOmR0b0Js27Fy1+EHxiSu14Kh5U0e6PaqU6eiOfNQUJvb/SGWSvt8EulOtAmYbj5T0aGyaki4k6X2XzlV2UVIy0wtZL45uAclx8XGWWSXUlGaXdiQFFcff3/gF7QGHGWe+G8NRbSb1/x8JRI2KbpRZLR/PzOIvlcwiNq+T4jWxX699uiKCSxjCD1fbYjGDpPZnHn0TMRMmdb30rCX18K1QYdL6k+5EvmhVqqsXi029oLwrRWL2GEqgY3cVv9IprFAl4kYYQRRGMuhI+gEFFpB7m8Q+6dw+XQeQ9QhmPG6EdccZx3r95HAdW+0M+ZN5pCm8gVqmADZwpaaz5rPAmDOOEXPji9orp8HzMmxADw2GWZiXtlDquxEXjnXyA3W9S/lN3fGHwbn/YR+UQ8y37ScrM/wgdbff//z6+de8yVXXyGR1ng7lHt2r4tICJ5KPaH1+WE23Gqv4+kWuLqwB3M5iB/MvzoETzHC5dvBeCz2Wa9/xzr1N2sXvLeyBudraLat6J5uDKaCc76/BJz7iP28WFh/9OlCHdlDytss/inoFgqHvcobTRHc2eNu3SrApa 8FO4ZPh7 FJXKUShn9DTlgwqti3UbblPoKODfiL4aLe6ym+fT9djBoPM3GernItNwdDswwj7pqTxld8JRdL72N2bC0HFAjjmGBFAjp+Qpz0xTX9hI+aGOk0rfeSUgrNBlogmM3j/zXGl1BPKCXNx+nPeQGMt9fU7H8xzP/Fj1/EYVotM1fi7l+rzDw3909KlUeFQ2VT2Md6z2x8Yg3tYUZe2W1tfp3L7WHgaavLV1PwydFqi+SbE/BEb8DqOHKXBpAW8U+R652Gh+89TnrfAzXmoFohgcy0yzsfdNVq27t+u7CoVNgNKVnpeKuENcrIy9Tu+K7HiTfONvEnuynxfjF4H3sRUcc6xHrNfHuUoNY04Vw5DH7QR6d8iEM1aLHg/QcW3D885b0PtLHVrubwXlljxZ5TEEV1eK2NzryZ1rvm1Obj6B6v979Fsd9kAIuKnxWikdkI6rSMahDBaX2WsyqcxCzot/YTIQPt6lEVGSe+7V/AbZoB1ohjjgGwnACxa0K+2O0coLhoWtN4RrTcJ7XFb+HcafpUR3wB8X55Ccy7lpbRWc0hpkd+LS04PNqxq2/US68Hxh4VW1QUO1jctb3uOZMkLmT9uudHg== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/riscv/include/asm/pgalloc.h | 8 ++++---- arch/riscv/mm/init.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 59dc12b5b7e8..cb5536403bd8 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ } while (0) #endif /* CONFIG_MMU */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 0f14f4a8d179..2737cbc4ad12 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -346,12 +346,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) static phys_addr_t __init alloc_pte_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_pte_ctor(ptdesc)); + return __pa((pte_t *)ptdesc_address(ptdesc)); } static void __init create_pte_mapping(pte_t *ptep, @@ -429,12 +427,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) static phys_addr_t __init alloc_pmd_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp, From patchwork Mon Apr 17 20:50:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214588 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 EA666C7EE25 for ; Mon, 17 Apr 2023 20:53:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0082328000B; Mon, 17 Apr 2023 16:53:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED413280005; Mon, 17 Apr 2023 16:53:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C633C28000B; Mon, 17 Apr 2023 16:53:28 -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 A5E5C280005 for ; Mon, 17 Apr 2023 16:53:28 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7E6A41A0759 for ; Mon, 17 Apr 2023 20:53:28 +0000 (UTC) X-FDA: 80692083696.04.4882A0C Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf14.hostedemail.com (Postfix) with ESMTP id B2E8610001F for ; Mon, 17 Apr 2023 20:53:26 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bMzg27Gq; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764806; a=rsa-sha256; cv=none; b=Q4uIbyVOmTbf9hgld0Q/6u75NdJu4t4tdWojQfKgrF7vI/oYkVRuUOBHksqPRmFmNkGbUs bbsW/pXctsPILUmXX4wg4KdR/bj+dOFTHWQHxX1A4m3IyEK3ZfZLFkhYb8Se5564rRnR2U VX/4UAtCOapY5QPZM8BwSb67BekZGbM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bMzg27Gq; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764806; 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=1imWRfaXT28Tln454VWhUpR4BzNKR6UHESFdZqWEUY0=; b=wHbNglYwXxrZuWh1Tlnz4PHcS/fxolb9IVeb9Ry5UqS2u+eAhKsu4DuLiZjCg6KJsInGSA 9eDsDwFJgK6MJ6YIRLCj9LKwnGplZFWMl1uk8zwWpW0DATTK4iTSziy0vGCaus3Oa6JXit BLeQRiV1BypAEmnwmVHsDZMF1BPW35k= Received: by mail-pl1-f179.google.com with SMTP id lh8so14362212plb.1 for ; Mon, 17 Apr 2023 13:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764806; x=1684356806; 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=1imWRfaXT28Tln454VWhUpR4BzNKR6UHESFdZqWEUY0=; b=bMzg27GqJpInZYbq5g7DlCbGyMQLVTO8/WaIXUjb9+Y1sP2Yg8U4pzTwcvHRDHiFNW xnksAVwNdJxrKURy2fgxnULAI227N9ToKvbiocqPRvOKs7RzP8ExmOpSZqrcqZUrdfu0 Ly3bYv1kY3GNKQVg3ZctvJCnyIezYAOXblSfIzPoK3U4x0lQOFf2Xm+WIvk4tnnJrN+1 YHPfjXznGMNehBha6m//o8BZSI/Chio1eErrXl3QeUgRmQPwnQk3cvQT2roiB3zkJZil tzHED45+1PigKvsFpmle9q7jl79yHSt/NZKlZjrviShfr3b19IL3cewZ6zZfWBjcahF9 kN0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764806; x=1684356806; 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=1imWRfaXT28Tln454VWhUpR4BzNKR6UHESFdZqWEUY0=; b=PDJrxgbluEEKWIfHr7YwZMfPSiDZS6wIBpDm+85GZPr9Es9ONrEpaC1/IFM+ngV8oZ owGlQPf0vjIwGqoBbDrG3GPfu2OqHW55RFIQeKAugjnP9GUTsM8ot1QT1b3P84l8dzHy Mv5xwSd2NozgLTJZTi9/ajE/q7plk/0GRN5ZCLu+wGNd+JJXATdmOO5E5QDA6s9hCjJ0 kV6BPTLId7G+LqgVQGKIueWGd6NsDtz7NfSurYBvBNylj1PIsq3ae3Pup3hq2qvFf21T WvCCR5ECI0wLQSZeC1O/q6gNEbEIxiKCvhpvlZIJ/3Fg8IoSIW9dq4sMN2pRAbyHe0BX Iumw== X-Gm-Message-State: AAQBX9c5Xupik5bnkjlDUtr6da10qJd7Nrt0OeX3g0Qn6SkxRwQnYynr 9ooSYCnJcGwtdFw2islie6Q= X-Google-Smtp-Source: AKy350Z5+qBQNd0Z/JNfcMKaitdnDjfxbnOB0qE080qoviMZywL0T3VtP+5OcGBInDjHaerFJSFHYg== X-Received: by 2002:a17:90a:d142:b0:246:5fbb:43bf with SMTP id t2-20020a17090ad14200b002465fbb43bfmr15902207pjw.4.1681764805699; Mon, 17 Apr 2023 13:53:25 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:25 -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, "Vishal Moola (Oracle)" Subject: [PATCH 29/33] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:44 -0700 Message-Id: <20230417205048.15870-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: B2E8610001F X-Rspamd-Server: rspam01 X-Stat-Signature: s3bickxs75ika79oheobzghdnxay5dcg X-HE-Tag: 1681764806-446858 X-HE-Meta: U2FsdGVkX1/y9sV06dQlmtuxGPIbedO0QdQ+zbHzGG9c8fuLGktLPYuOMpB885WZRp7q9+pvoTVpyTrF+iz576l/kom83P6UW6+gYtWrvb+TQKfa8W3jupfL677j5ETStwUBZSJIho50ZmC6zZy9dRBdxtS9wp+Jo+aw4JBs/8qpC/B0hdPTYVUOq177GuyLtbqHJpRFXJ+5Cova+BNH4I4GNkhHwO1iqboIyp1mQnom2TBr3mgXe7QQcIab9KGuqRsqffh+HrAoWHZhAFVL3tu+LK+5jPqr65W22OQE2xVLBpV7SMAdUqpBAMrnMAhhfgRmkM0qyJbc6OEJbyP6lf5yc9q6sW6jTHVAH4t8onzcKXsuIZQkXyv7knN5Wv9YyeIVh7j1Z2AfEX/mI9d4VqFOA0P7+ypzZW+0mfBLPCQBZ06u314FXkgHhU58BdsJVZYlNUwIAUK3gbZPLL3kIhaazwEjor7bWL6GEazQtyAht/x2sR7ioxJBFs0l1Ny+MOP1yVaQfFAdAW0qv07oW4hlaDTFpbNnhDBWEscLvua/7FsxWFngKySXFLmbvBypA2DFBoCoIM3fS280aGMYjFT/bRqs1HvJ3ynaxr1++aHPJ1rqol6n/62YL1SIN+J9B3Q3h9rMhRtT+4pJe7y7E1qcxUDo5EITpoiA9jSH4mjlYF+n7ZioyqPCj0VgNfqCmj61JjNR/zPko4O/n3C9KB1M4YuobuvtvoFZkVQ9uCf1kKKxgcLcy6Rv+0ehUCbMODhdgMdwetvzs5Kg+Tqf4jUjXSCRXZmnDZqlqwidDgoxwPv4hA/iN8twb32meYKevHHc6QmJaOU0A6dzAqZXbR5unC8uI3tO0V5T4Sff4FO+jaHY+FTb0mtnkh2HhdM2lMj2ZelnF8SjmX9lgCHs1ZBgJ6BeDqRPjGVXFdupQet3lw9QQJPcGS4nlxbPcY44AEZM7MPvsb4CJum415Q ZqdsMGcL up3p44Gc0fnNVRo4OXkj87Kq6/YtX2YYXXwZWtIBK8T1NbymrOMfeH2nY7MhhKdKwz8e5uN81JvdqMRJWCKDIfol3SWXI1p0uUkdbwM7fTha527kh/o1UcirHTBczfV3OnjozWkh+PXcJkjEknbvh0b7LMDYK8hxmJ75JWMYrdNEnhvHfEnkWSPSYGuL3HsaR/RqMUNikaCn+eYOJ+WWz93mE/eeOqGYDd3ep6a4EN0Zo7ypb4li4hejZPj/0zNx1gqKpe7fChLjrcLFQr/j6QrjVEAtvBcFmwiEMM0g9V0NS/Xg8qF/DD+m8KRpwF+vsdeHYLbIN6H1lxkXD7WzAkW389NcxBGXbrhU391ScNML1pCiN2yJr8+AfGFY8mPvK1Ti/bqwJ7S7vUw8DAHBLNVcU+YA7mynRR7kVPsPZTYa3UFhjOTLCwUTntRyZhvpeQqyMt+X+7wiXwCQq5jZbHsKn3se+EpQNmTKRjxLGawGrFo6OK2oMbkfPBw3p8CxEuuaH1dd7MB+qo0xXszCsX6NpQqFC5BeGmeJNVoEc+0D9tnopqBD2PGUrA49gkf5B+R97B7CBc2Cy3qHyschhDivqrg== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) --- arch/sh/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index a9e98233c4d4..30e1823d2347 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -31,10 +31,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, set_pmd(pmd, __pmd((unsigned long)page_address(pte))); } -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* __ASM_SH_PGALLOC_H */ From patchwork Mon Apr 17 20:50:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214589 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 B82E7C7EE20 for ; Mon, 17 Apr 2023 20:53:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42671900004; Mon, 17 Apr 2023 16:53:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AF7E90000D; Mon, 17 Apr 2023 16:53:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2047C900004; Mon, 17 Apr 2023 16:53:30 -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 E9E4028000C for ; Mon, 17 Apr 2023 16:53:29 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CBD1F1C63F2 for ; Mon, 17 Apr 2023 20:53:29 +0000 (UTC) X-FDA: 80692083738.23.BF0BE5A Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf26.hostedemail.com (Postfix) with ESMTP id 0396D14001E for ; Mon, 17 Apr 2023 20:53:27 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fsz9HBXp; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.48 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=1681764808; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=KZVX/mWjJrSrjjYCriq83N/Wo947JYzoUIEmEL+2beHZAUuSmzw3WrcG7bVFKgD2OHe+pz 0QTA7aV3kg80huAXl1egEsdQT0VMb+F1d+j1wNSmvXto+ifvukJp2lHWAMSLot0ry1vnX+ 8rz8DxvLisOBbYJZ1HunRtG8UKYXREI= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fsz9HBXp; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.48 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=1681764808; a=rsa-sha256; cv=none; b=L6AWqXjtazgY4ztXU708japVcIc5XUZE9u2NL+m/dvQmCUiHLczmIxIBbYsPZYhPzKbK3G FoETGKEuXPH5IJdpwE1MT1/FEb9h34W8tnbOqsaWqrB4B+UnovPiph/LYe0h4hBMWNKoTl jL2aqAZcbjd4MQ50X+NVJey5hz/t0z0= Received: by mail-pj1-f48.google.com with SMTP id s23-20020a17090aba1700b00247a8f0dd50so3411948pjr.1 for ; Mon, 17 Apr 2023 13:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764807; x=1684356807; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=fsz9HBXpyixYv0zGEIQNfLPb4EjMqtI/28pihon+vRduZpglxs4kGo7QlnsgzbeVep MUefXrtmBIPAEKph1/xE0Hixz+XFSj9eLb4OXqcCPGwVWZta2b+6OV8DcUNUc3MYWho8 foQqBfLzT6QF4GBhL/zISw/ZQfIxqSnZu2sd2q6CE2U54ygVclXX08i47edCNHvoHxB+ sBBNY+ovhIlsXyYoYKNVSm2boGQ3Di1szM5293gnTSGOnWYTxtAAUVimXGr6dZV0Zyrz TtkMrcCltGZOVK2SbO9vEj4TQWwRgKIU6/H0ozoMQVL6Kfmq0ZrnJgq0p7Ga0/De5Qi0 sDcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764807; x=1684356807; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=I0X8llqXgt65tgCvOKVEvH9QOCdMU6oCBWTsjart9tcDwQqUwsGzIMESPUPIMc+yrB Viv6sXBR0D1gZACZLMzlMXDKtJZ7L+FliivdCb0s2y/QOfj+FNtegWQXVNLpY3XsI3E/ LZcyafvHTwd/B1eZ20tYFLebitJHVREsddSaI2gGGGWNaJb8jSvA6NDXqcGHfcwADo+C tMVllZLcs54h06yxSvS0ATj+sLBJ1AhL8IZqZMrYa8JS8Q6piJp81K68H63cMdbD2Les p+x2im19uEzcA/H6csURn6rBiLaqxdq5YnTGczu0wgY41NQyLpXFSv6ciJIsu4Gp41OJ u0ng== X-Gm-Message-State: AAQBX9fjT/r5XPnnzm9KJ1rBkqL8W2+fz/Iyq+J4S+kRCR05KkJZ6/qZ eIh5qONSB96fhTwTBKAOP0I= X-Google-Smtp-Source: AKy350YfnaT8KE6LOLQ9wRoeSIO99cnRXYKnv4nnzRXnI3u1QAONlMDFC8rrZFtHP4TZD3hWsCKEag== X-Received: by 2002:a17:90a:fa3:b0:237:3dfb:9095 with SMTP id 32-20020a17090a0fa300b002373dfb9095mr16284735pjz.6.1681764806946; Mon, 17 Apr 2023 13:53:26 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53: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, "Vishal Moola (Oracle)" Subject: [PATCH 30/33] sparc64: Convert various functions to use ptdescs Date: Mon, 17 Apr 2023 13:50:45 -0700 Message-Id: <20230417205048.15870-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0396D14001E X-Stat-Signature: m7dohc5xgbw4fih4xic174f5zbn6tcsm X-HE-Tag: 1681764807-990154 X-HE-Meta: U2FsdGVkX19c3EYMCR1z8bdydxyPVK2T4Z+KbqtNaRpqPg6WH812vQsE69yWH0K84Z/+uIu1ndPJ7LUDM2t8Ltf7jQNr7o1lUHYb1BZr7/t96cq0WiXgVTxERXMWNOeVlO6xlUZPJHurql7rbL7eGnes1LI2XdT7Od/wMEdFUPA0N/cpcUgOlGyYseQNcwtj23eGgprHJcOFkqCHf8IGyjxsLog9Hd/P++KrHsHKS98c4eJy8FNxwzXqUnyFvKy1NMoCroF6AaVW3NJeiTPwHfF2uPTZDXfbVK7Q5oc/i4c8h4o+2wFs1/oohi1oANFrifxJa3rnRv8+r5NODxgQoMMj55v4uztcVCemQGYAfh77d3ePKj3ffKJNGYt+Jzy4Nr4NNErSlps0Ot8nAvEGEWVnlQoBU0+PXK5Tm/nSmzLcneSHlfZl5bmI/+nAomU5uZQ13RsgXhQeYAHljF+716oabR71Aj29YEV2FmOYAmM1FN6/ukOZgMnnx7Tn1AEO5CXwBKBSI9WWuMabUZnw7d5s8ed7GxxAMu9pMEKAUCUq8on1PmAHgE5a6yMx/h+M/rPZTtKHxnGzTXc1LV2dmfsddmxzF8pdpVS5SJOLwLMBS7Db8oJS0Q+Rrs5UujZzmwuHz+pFvj2zbfxFr+4DKmje/YRoK993exaWmUuD1f4zJW2oEzxXB+TGXFsY/vQNkYte60VQ/7jp7x5iCwowiciA2i4GMnquXWj9eDOPE/jgkWHGkWJOhTmeYtq2d9VqQtaysf6/3HftWyAchQQyq4i5TQAtrA8MI4DFN9aymd7f9c14fhUPAPnaZQBfMXgGlhKZSqaE4l6+VwarzE4EZk61hsp32+RYibTduieXOEVDTmDFPjS4iaJvYSCHJs/2YWiL1Lisb0WWikvIOPtVs3+piKeaZo03GY7Gq94wbLLcW9bWaPW4tNpnOHQ2nqlofK7EuktXtvwjUV81AG0 mnc2vYMp 7bkGC2ObXPpB63mbkXeLUbgqp9S82m/q6dVMDZS0cVcS0MQRSgohFpqubkMFq+p6d1bulUymKfGRGeNZBDVrxizc56igXOGe+p5dUyBdiH9c7C2rfS2QOSFCpLh6SQNVmBRMw9jVoq7SA0v0dPS9mAeMmyk5lEmO1CJWmxMo989mlINjfKS8HvAPFXWxd1O2MgrlSCWQoe5uQmF3UklOxnufa46FbTDgX5h92T5xkcUwq/c5U1g4S7AQpc/bFQZE9fjpOUyIuobmKmxKWLOKsCYgGhGenxqZY24L7tD0EFA/ELMTwcD4ltEPKS11l2Kq5iJ5y+BVj5R4uZYA9p494aBH/ayYciUZ2jog9U61YXgWifBnmfcHo3TWOtyCVIraxPyMLdFKi+iQIsdv0T+7jWbzW6+0ca2/MR9EfLBCtTMF4T8OXogb74v8DMlL/1KRjePr72Nyledh5jtBy6PtRk0zEfnXgHD2Fde4Xn907m5yHf1shu8JIQmJ7xlCHhLcM15Jz+1W1DRBCpQH/cAbsSBny7wHnMFUrc7FmyBDl9WjH1vI= 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. Signed-off-by: Vishal Moola (Oracle) --- arch/sparc/mm/init_64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 04f9db0c3111..eedb3e03b1fe 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL | __GFP_ZERO, 0); + + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return (pte_t *) page_address(page); + return (pte_t *) ptdesc_address(ptdesc); } void pte_free_kernel(struct mm_struct *mm, pte_t *pte) @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static void __pte_free(pgtable_t pte) { - struct page *page = virt_to_page(pte); + struct ptdesc *ptdesc = virt_to_ptdesc(pte); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } void pte_free(struct mm_struct *mm, pgtable_t pte) From patchwork Mon Apr 17 20:50:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214590 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 A5F56C88CB3 for ; Mon, 17 Apr 2023 20:53:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A504280005; Mon, 17 Apr 2023 16:53:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02D8690000D; Mon, 17 Apr 2023 16:53:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC287280005; Mon, 17 Apr 2023 16:53:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BFFB190000D for ; Mon, 17 Apr 2023 16:53:31 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9F4121C66E6 for ; Mon, 17 Apr 2023 20:53:31 +0000 (UTC) X-FDA: 80692083822.06.2680A7F Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf15.hostedemail.com (Postfix) with ESMTP id 94447A000F for ; Mon, 17 Apr 2023 20:53:29 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bs6MBnbj; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764809; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=OrPNkZfSpgOH5cjfFo4l6iwguCJSWl/4cjKHQ30hXDUmeqR7LdZT+5BPTnhM3QQLYm5iau DpXh+HXuTLA8Df2ZqbffM9TKFArdzLWi3ztUEqoxVYjaoJQm9B9Nr1cZUIQS8SqWZ5EHEr UlUI1EvRsbXUz3+p8nbuVwH3U9eP6CA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bs6MBnbj; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764809; a=rsa-sha256; cv=none; b=HLYJ5lP8uozVDVEb6/e6HDnhsKoPgNZj3XEVoHmBjxCYRZ/7QCw220/3blhW6d3mEV3vKD VN1JxFpxzdSU1hXNqZopMapBGeu+XjufvjuOhsx71u6VUsRm4WJ5tUpHZqiV/YenaG8tLJ xLr3NZoqX2UjgVMmjW1Kca+21b0FvlE= Received: by mail-pl1-f179.google.com with SMTP id i8so18360383plt.10 for ; Mon, 17 Apr 2023 13:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764808; x=1684356808; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=Bs6MBnbjQkX1GScZCbLklar3CQYsHMcNQJhdEJMSRoz85XciXhpnQ0YtDU9kdG/nWk TxMCtPr19eviQJI5aQ6Z23KjvD0/UYdwUUF801SK8Z3tk/XuPH8n6ufK4lU6OPOoTkEa tcxsOYaiL60cLVhSI6wekl2Ojt4T3pVi0l4/Kpd6dmP8a2GTqJPhoPlibhYfl7AzaVkC 8dHP626PMZuKBlHUuWDeE5Ws0Xf5nvhx1+eNXqdjJYxnU1JpJLYxfuGpVyKb6jdKhgqK l+AozFzFnnh8JDe5VzEpQS6lDqTnIa40opwHXXYLbmcB20BMSqSIISIYF0OD142rh4KG 4Sbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764808; x=1684356808; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=ikefq+YH2r3SePCnFERYyrx29InJWCEcX7pQ7zXMGB+0XulWsa72gYznEHPpfCLukW BlXv5RvZGBJy4meAimRT/UYuesR1olQGw0YPk1qETxbtq3cjam5R+MYjGPepjCS29pdk pymX5DZLgZhTrANqyiXrTe4y2ab+Ccxa1M6Yv1GoKLFClOLzCUrNFTn056z4bAS5MiGB DaLWwF2PU0N3kBt9kiQmZL/xgdpMRbHjQChbOj9iw1nvdtI3aUUUsrOLN2ixprvhqAi1 EkJ1OfCRHLjVqWcF3z53j36bneX0J1CyuDxUU0E3IlmDonY9hTsOYnwWkXIcXuCposdn +gWg== X-Gm-Message-State: AAQBX9f8KiM+QQgpRyds/zK3SDtfcbHLZo4MTCXqDxkI9heON7UioDdn E4CLqny9b3WvDCvVIKlow5M= X-Google-Smtp-Source: AKy350a2GcdGbRUVrvD14pA7yb7zjU30cICJUnhJQSgTB8CRLuH7Cup5yhi/f0UjvURoMBG/RaZdVQ== X-Received: by 2002:a17:903:1206:b0:19f:1871:3dcd with SMTP id l6-20020a170903120600b0019f18713dcdmr272381plh.5.1681764808447; Mon, 17 Apr 2023 13:53:28 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:28 -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, "Vishal Moola (Oracle)" Subject: [PATCH 31/33] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 17 Apr 2023 13:50:46 -0700 Message-Id: <20230417205048.15870-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 94447A000F X-Stat-Signature: wei3cw9k3eb7zfmy3scgs5ho84a8yr5x X-Rspam-User: X-HE-Tag: 1681764809-685495 X-HE-Meta: U2FsdGVkX19UNgOYEiFp5hqMRHFYVAqHyYY2dznrxvlS/3/p2mL8XyFTSWsPImOkvhYddmloEQHobUruUhpOV0dEORq1zK0jGjTB96+JuNyHjRnCUszX9gbZaTyOOQ3gW+rVyGLsIAv+G5aZMTaPRAuQj7mxw124jBr8LVKLf6nV0eOm2L4ku87MiWOhmr8vdBmrBUn2S8ipShc39FqVkc5pm0CkchmmQ8fkKHIHXCBb/Hzm+6/2uz7Sk1An2k2vFr93HPFPirZrbFcDLRqGENE/SMo733ZOnw26vcp7z1z1sQiQteRwPrpvOKo4XJmix4IUIydbOX9G6u+G2GEmUL3cu5CWLX5MhTNfbA9lfPhllyM+sZOdbquBW0+9E9NaT0xR7peWbbfxvzhrScjF1fnlqs2WsdEvK7BuMmK0CUqtQdoPzL2OhhC2HG7cxyNa1dkkjuaal79Ke2YxlHgxBrQKinEWlShk9QucxzqXs5oMQwDD6fP/JssRKSBn8cACMMhPEc3HC0cI2BF0BDrDtkMye6zeL6QHOvr3F5CN8MTCSp9li3jmnxo7BA2r7/q7O+iaI3aktSlzjnmRy3YLlhPwB0+nTYivfEKHA4z/YwS1w/++Vh9ZAdHFgiafSy1QlpsBYYAl0uTea3ahgwCxHY6BGhrVs4XlFaW/L+9BIZhRBaDRK6tWeFg3uFoa3MKIM9miELy6mIDXlfUIQZYYA/re/Mb4rbAo5jUr/kAl+9q11j+eSryPo0JGW2Lmb8yZv7beEfaZt439jO5rIZQrbnf/A3wMnfQ1mc3sp8sXe45xuOsxnkmLQ4ctvCb+u9Tqt+NSHTuYx3x7M+kisMAhUTTqiE/7GHBdyP3K9GlpLWTSarHvxZO2oO3eq4sbXJ9ZwiK8QeYI5/slKlLVlr48p3JBSOy6zweJhsBSgGisT6aCScEa9WXAgoiq6HdCESdWwuYcu5TyRe5onDRkYXR wJbhqeLh XDbzTibk/pfBNa1JUt1s1EdfsCD/X/VZikJUHQUjY8zm8C0Ypoz4K1xIEm5sxW0Z/guWFDVk2xUw1aI/2raBZmG8Hy0I5KZodfZtvpOLdXzWK3Ks93Aj8YCae0UJC1qbs4/WLBBFky3Fa27on/nFWvG1UsAISh1RJ99V9aHkmpLRXQ4zF9JsjHNzqUtPo05H39cyrCFdUmfZWLGU1PFDf4TUP/N2WYAcTZz+qSYY3z6L4pbUxS/LAsiRj0y+xvjp9Sb1dFqF5gCTEtE2itC3Py8EuUBydZG3U5a7ySv7ZdG/x5bFDZpA9O/A5+DvFX0tMrQ1VCzEJDa7OyaIbvA2Hu+z2Tb0HxGIMuaE66/a4NjMZNBqF6WKSa3IiwdwuqODmT23ppbLgk5KKny+ulegJOOUXZi6FNHuDJc3amLLDnL5lmwEDYgQTX8bSl0B68ox5ZhC97w4Hw1CByTjFqVbGz2Wt97nPysNeDJWFlBAIfEZAOBs2LCPNKQI9nToRVuswKSU89PQusm8eRsZMjns0xw8Pd5MYG9pFGY4h9Loyl6DWj2lv2shEXHZ6UgYYpuyykbb/uYybIlQf++VN+yzgXAVcpA== 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: Part of the conversions to replace pgtable pte constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- arch/sparc/mm/srmmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 13f027afc875..964938aa7b88 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -355,7 +355,8 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) return NULL; page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); - if (page_ref_inc_return(page) == 2 && !pgtable_pte_page_ctor(page)) { + if (page_ref_inc_return(page) == 2 && + !ptdesc_pte_ctor(page_ptdesc(page))) { page_ref_dec(page); ptep = NULL; } @@ -371,7 +372,7 @@ void pte_free(struct mm_struct *mm, pgtable_t ptep) page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); if (page_ref_dec_return(page) == 1) - pgtable_pte_page_dtor(page); + ptdesc_pte_dtor(page_ptdesc(page)); spin_unlock(&mm->page_table_lock); srmmu_free_nocache(ptep, SRMMU_PTE_TABLE_SIZE); From patchwork Mon Apr 17 20:50:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214591 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 93471C88C85 for ; Mon, 17 Apr 2023 20:53:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DF0290000D; Mon, 17 Apr 2023 16:53:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1408028000C; Mon, 17 Apr 2023 16:53:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D750690000E; Mon, 17 Apr 2023 16:53:32 -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 BED2E90000D for ; Mon, 17 Apr 2023 16:53:32 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9C29E14016E for ; Mon, 17 Apr 2023 20:53:32 +0000 (UTC) X-FDA: 80692083864.02.63A19CF Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf28.hostedemail.com (Postfix) with ESMTP id D22AFC0005 for ; Mon, 17 Apr 2023 20:53:30 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="RTJID0Q/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 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=1681764810; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=cEi2TglW3y1jV2dEhUGeAyisMu/LHFMX4M2p2rZqdYK9RxUhz+7lS+U0fEyRDq5lpZQY8x +thdKrX3WIvW7hoGSGLLQ/sKuFik0zpcgxTUleeIjYCXm4tRNRWQMERzBh7jveviBg4WnQ D5mB2OhC/KB7RgwWA+EMohQe/JWyY9I= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="RTJID0Q/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681764810; a=rsa-sha256; cv=none; b=biKIEsHK1IhN1Frrp2HQvFN8Myh+wHpHqIpGKaUd6UwtuQBzuQwsMTMpKfhoOu7HeAnUqt ktiSszSETPY4z/FoGDOwrFTBTL8arDTRTKeCgmPe0POyxkFXgeLtxeKttC8dcVePcEG8uX Z67n0ksqKso6P+lK2pWJsEvsRzvgwIM= Received: by mail-pj1-f50.google.com with SMTP id v21-20020a17090a459500b0024776162815so6442165pjg.2 for ; Mon, 17 Apr 2023 13:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764810; x=1684356810; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=RTJID0Q/WW7iedj/afuCWToOfH/aBrY/NrWNeyN7ByP/usee9y9Bzy2eV2Pryddh5k SgN8rXjbYlFESamvA2kpEGUYeNDAEQAcb5DBJGBzqZ39H1PUjeRb3TeWmdsscSkj+duB XdhsoeufQBiAlQ1VDbbJWcUzg1wdK3pe72OAkzLWRjQ1C0S075Nqq87qXF8IdfaSlDxW +Bud3Bjv7jwgjZOfa7R1sSZhrnf0y6c/vZkSvJ9Qym0uRrXk7trecdbr2o902twf3Tei jaw/7g2aCCpoNC5Ttid57NGpw+n0jzjqhu5TM+KCbKbeUljRTtHuGZwGu624c+XnB9eN r1BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764810; x=1684356810; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=TFRE/uAfS6cUke4hD8s0nJOh5g+SSnJrJrofG/ABgT1tm4uMktOtdvaENSoMYDKQzE hEsGqSMxZiX7UKQcHjpl18CLCul0CNMdXcyribURZC/ak/xGz7nkoVHaCHVM/3KZ1UQG aaUvfStmTYloBehDkK5JrujyW3ZAdHN33dFyxWruhli4l6keYtvg2Rku68BPjwWJ2zeX ZRkDfAR00gmLKj6SKG/quhCuIUAml0SEDSpP6KX6c15oXWAcbSuGzhCBvJ/F5b4j7Not 0N225hyrHoQPDBZlegkyrLTErfLX9J52itY7tJZcJPxFdIhuB/Ey6nrDLmaU76mGG8JO FdWQ== X-Gm-Message-State: AAQBX9ff2Eo1tR2wlmX8eRkOqJ1UtOw7/QC4mHlkJkqhHSQrzeRkYpTD OILEKnw8gKPRkUT2uttMSWk= X-Google-Smtp-Source: AKy350Ygryz7WWGm7uHh1637qBCeDzWZK5X9wTShPkAHp+hvTpFfVrAPSXU4dDYY+IJtVCH6njxkhg== X-Received: by 2002:a17:90a:4144:b0:240:973d:b436 with SMTP id m4-20020a17090a414400b00240973db436mr14169767pjg.49.1681764809815; Mon, 17 Apr 2023 13:53:29 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:29 -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, "Vishal Moola (Oracle)" Subject: [PATCH 32/33] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 17 Apr 2023 13:50:47 -0700 Message-Id: <20230417205048.15870-33-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D22AFC0005 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: zszyfqbs8fd48fxnbkbx7xk7gws1tsbb X-HE-Tag: 1681764810-434312 X-HE-Meta: U2FsdGVkX19fUd+QGX5XyCZVMT4S48BGVqGTtfZRy5wezp8+vSwBYYs0vYAG/31PRNrV5uJHB+g8IppA6rXh1XZ6/yEflW4avfEWFcBSwXSE4JGUQ2VWW/jzsYWOmHA6FazVPQJNJ33YAREpYz4j+BvDVm7mRaF2FdmdnP++FDe1xo/2niLRNkvl9+jDp6DTkYJdmBgy877nIyk9Wbc4czXpB0PuCTFp9ki+CfpMiwElhtH/GqUkkL5GiSVREUCxjEOuch33ZrvigcWaQVnIjy7mmom//s2XifxTbHEELvNBnDbx/+rDooJmirnlo9aWfAS1VM5x6lpp1hLJ8utzvLjpFjoQdlqBDF3eMqs4rJWWZ7k1G97c1YNyVKiAgzJpHIu2zcrK1OhTuREYl3ZS2xU4fZ9VfOc2QH3uHZiOT90H21c8LRiDXsTv2Go0S/uqMq0l7S8AnL55DSsASeD89WxXse1So/d5f8dI88KV0B5OQTYyjR+fPivlRC26pHV37x3Pze63oY8Gl3tXk64jYMs7uBLCKjkDpoLu+fl26pXA1WY8mjayqm/TekrGRgl97+RHFJSCMqryY07VrhFHPZn9iFesVjhq3j8farp3nGiyHLBF2W2X6oGw6Yfdxv+i4gbMZTEaEzk34LY7hEeCPEKj61om/WvNBzHoCl9oIo9PDkVhBdZrFuZM1jDvksweZgMHeKT3qSAnmG6pdNJWP7CvHU6OaDHtqP+0ZmD6j5nrIowH0itVBfftZESoyxa+l4lpK9sQq9B0qrbA+WdErnYruh0QFXyxpcVDOsizjP6A8DBJDLeCzeYD4Lisd9ZOZNjwdxd0cScKCeh/7qTgFgEdfwhJG//FOceDicXglE48xBVZsIphSDRQda6mKLjdEQl4aULs3Dub6Cpx3M0/e+VgaGu1MVjCbsZmkUTKO6tA4ydbzrdCVdF+aqb/r3bTiEQyxMwi5buR/FArYuT a5LmdOzm FcqXhThZBnaTkpOHdCe/4ZE1DkarhCzf5xn3pCR26wLIXbmLt/1zZZcJolCtS5WwL6x5XcdwFPKZVijM49mENAOqLJRjfLw9gczuZoVFXIyGoKcgoLw7Ref0rWPkxQmuxVETDfQZMTmjOqMgiyjBSS8rYqGTjMrrbQwjn+hAdqdIULfmiztx/Dnor6wzhtviSn7kdoXkpUElJODLV8gMYTJVXYlLJuvczhjjb29E8ijBLYGazIKr69vpW3myhi0ju75Bf+irim3bVns7v8jaZal05TjzMQHckcFHCcjhLft8CyuC1SkT0scU5FMbq7Lz94Zx3Na4xDWLqeQAqObCkWOiISX9wHnbOZk0QSgrC6JVk2H2wxBu0HWW7rb2UjqZsz9SoT/C+p+GkUtl0HsqKATnaQPQwUJ5kNdIHIVDivle+dR7AszA2B+Ktp89Kliz/OXwlwczHClk2FtP0pIuloRzcNuEylcsAj9cTdvM2GOILaPZruqX0PQTJhj2mdU9MGK7eZfc9kLNb7g5s2J1IfFH+Okg8QACshw9UdO2X7eqWJXjCtkTOTCrdInwuRo9XYWo/6hn6K0z78nt09NYuW2P0jA== 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) --- arch/um/include/asm/pgalloc.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h index 8ec7cd46dd96..760b029505c1 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h @@ -25,19 +25,19 @@ */ extern pgd_t *pgd_alloc(struct mm_struct *); -#define __pte_free_tlb(tlb,pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb),(pte)); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #ifdef CONFIG_3_LEVEL_PGTABLES -#define __pmd_free_tlb(tlb, pmd, address) \ -do { \ - pgtable_pmd_page_dtor(virt_to_page(pmd)); \ - tlb_remove_page((tlb),virt_to_page(pmd)); \ -} while (0) \ +#define __pmd_free_tlb(tlb, pmd, address) \ +do { \ + ptdesc_pmd_dtor(virt_to_ptdesc(pmd)); \ + tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ +} while (0) #endif From patchwork Mon Apr 17 20:50:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214592 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 36FAEC88CB8 for ; Mon, 17 Apr 2023 20:53:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC66328000D; Mon, 17 Apr 2023 16:53:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD88128000C; Mon, 17 Apr 2023 16:53:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B058028000D; Mon, 17 Apr 2023 16:53:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8D17528000C for ; Mon, 17 Apr 2023 16:53:34 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5FB88C01C0 for ; Mon, 17 Apr 2023 20:53:34 +0000 (UTC) X-FDA: 80692083948.13.D226C44 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf23.hostedemail.com (Postfix) with ESMTP id 78876140020 for ; Mon, 17 Apr 2023 20:53:32 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OlBOZiQX; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764812; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lI4mQ87WoWgY+PGEzL+RyVT2V9KzYHmGTUoQkkpMa78=; b=dj6KmIUEGHdifXSaCPq1ftFH2Bso1ttkbqLPqYiVHQymFRXFVkoIjx4zB2OGfd8xJMCDS7 9aBFJ4bARBOX1hDpu5cOryxM370sZQiV4HgEmj85zrRYWgjDTdYNZcqJMePadTT2A8B14m XTr/yaq15qNecKOWmOj4Cm/fUaW1rF8= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OlBOZiQX; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764812; a=rsa-sha256; cv=none; b=MgSD+CYX9lp5vo4mJRrrcNhydpEboVN6Gs/sYONFWLDvXoPN2emRG2alDTPtWwtfF8sPKI M1vXkT0nJT+Hru8yiL8TIB788lsaDbEuYbj1QH9t9ixpki7RdrpFgl73QG6GhPyz1f6Cx2 S3pIXzwehmz4U5HxY5rKJkB/xv52CEQ= Received: by mail-pl1-f179.google.com with SMTP id w11so27338067plp.13 for ; Mon, 17 Apr 2023 13:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764811; x=1684356811; 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=lI4mQ87WoWgY+PGEzL+RyVT2V9KzYHmGTUoQkkpMa78=; b=OlBOZiQXTEQ2yJNCXWXVeEV70jBd/5g1C1TEFSYKGJH4RB2t5MeymRQTJkCAMhqY8X xT0QIMwkP3fej3rBN/YVKJNeHnVxdz5dc1MiD+bCMEF9s0dHv6uN4wyDmNsH2Y2Ym+iY 2ZNsAP/RgJk51+uVp81qcQOj+bGNImtPBjaen/JrqoOw/PBUibNGoaM/ZCPpfG5uzvkW XBTMu6ICJd2ADipenkzYOjnqUxYIKWTiKPtzD1nHG87S/riR67Qes5ac47aDjBNBedgZ nWtoSmVXLxbkA7A5m2dqK2dJ5Frc5F3qBCVwCqlbD2BXSOmg77x4kXyTkenC4W3QlTw8 reIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764811; x=1684356811; 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=lI4mQ87WoWgY+PGEzL+RyVT2V9KzYHmGTUoQkkpMa78=; b=hdQF/33EHxVQQ9b/aDdd8/c9NGXzUo2cV/vIlRxLZrxFePxCghNT2NaNqUlfufWiD1 mmENYStr4rgsSWQVZ331TjLtCTvzmasbKIqls3wvWmkHAJVaKrjrOqOxhBLnyBrzpDYG svt9ioBTUKbpRfLes76C1NsuFKkRBi7B2km76yjt4zpKY9q1T4FP3kI2fhMLGGxyn2Oq 6zy3X6c0sfOk1rsYYLSbB/FXBxhgGcjIiJ1M3eNwlojgHwoetEQpzsOGx/pIPzVWZFDt VaW+XjwMgDD73WWRRyIJbZCyDWG6JJ88z2LDvlGlbUSL9zjyY/WKec8m/k0Gzc2/iC5k GxVw== X-Gm-Message-State: AAQBX9ckcFWgk50EBfC7Yy09lzGNYBZwcfroKPts2FFPzRXyEI+bIqpN IzaR0CH+94y9bS7NxRGMIZQ= X-Google-Smtp-Source: AKy350bto7gkYUEXZmV5HcAXbLEbfMM+TO53YOoTMdsdAnKO7c7cFoDN5d9Q3fv9Tr0h94wXesVw1Q== X-Received: by 2002:a17:902:ec82:b0:1a1:b137:4975 with SMTP id x2-20020a170902ec8200b001a1b1374975mr256275plg.49.1681764811306; Mon, 17 Apr 2023 13:53:31 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:31 -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, "Vishal Moola (Oracle)" Subject: [PATCH 33/33] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 17 Apr 2023 13:50:48 -0700 Message-Id: <20230417205048.15870-34-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 7s8ox5qg6pckwt95bh8tcq7i6qaubhia X-Rspam-User: X-Rspamd-Queue-Id: 78876140020 X-Rspamd-Server: rspam06 X-HE-Tag: 1681764812-251690 X-HE-Meta: U2FsdGVkX1/9UYdfqy72fMuhvN+4TdCjQ657hg04QDjvuucZQRnbxxnTyBPV+2c7rxNU2gPVeGsr9UR6wnXRyamzrt1YlzNFdy43qR0mZgfuJaFEXNOsAZzjDjBp7rKrC19SmBjR5dlGzLIyg+N37OBDtRSiNvmygO/ws1Bt2a2CT1SzXbKgao+fJ5xC0SAFpuXLctNMztNKVvAlQFVeHUG6TarvP55dbL4KyfrpnvPd9NzubLcuaKgGkfYgLZowbIS+cK7mj89zbKdpMehEFaLgH9W4/TP6B/hFp3c8fcyfeZjkbdbllQ8pYEf4hzk5b17n6pt6Hwn011L9tjF2YokS3UA1/sxk/gLhBAewrObSA4GIbGv2lrb9am3OVy/uoPQYGLTFd8pDDBuYl6C4pe7tk5EcKr2GzWNwM/juW3SLsK0QWSpbpUKklmq+6A0RSmNAhtvs8n3t3BRWT9yl4nqB+OcGSPqaXCpy5ytmfuQlbuD04M5cQoo0wp5QMElF4WCckNvBBw5v/uTOK3BT6ZdpPSploBxJkEscrZ4vxgUBU1KQfopad5NkQunlHMPxMwuwNEPwDP5It6O5VdDR8fsh8tORYP3nAdtKdsVkUfyY4MzDkrjz+uxw2fOT7NnVMtZuz3Q670Xl+HPj8DswlCjD6Z5L1FCVbtYZAp7cfeW55hq2AlgSS2VSSJUVLTojZAj4p6zTis/vprB2nr3F5JzvL8njGJdrlNhuLTnrWaaUlSziVkAvkGj7ZMtiO9OIDSK2uefec4D5K4r9zR+Muz0CHB2YKSbcw0TD1Le4OAS3vrkWbtR+KkvEctKk9sQfYWHHCLdKumdknIXrl5UtyOyeCOEr6/MiGVJuho/TUUIAa7SQt/Y/MqvOVt1GSPRHNMVuLY+Pt0XyMCZFEICCD6YMaokLaFjGHjtIrMxrs+oRNWbOYd+UxKm2ZgfUepPuixrw/n1UZmAQFStm48Q X8ldNdQi HNIF9/JDdzCmMmUVSuDcSqZ0Z9u14R0cwojRykdZqn3iJd24Sp7oDT0KHxiMegOJ0Q6Hc5zH/Od7mKEmGO+p0kDTq0KFiAyosDE2zMXjOI3oqquEKr3HRWEWlGYho1Y1gZWQ/Mn7ulrW2f6VTHAdeRnDFE30vt2R3xoUCpJLnWzDHg0DhHvBe04CJOkb14kOM0aeMLhYOSguOCrioSOdMFotR+tHo+cl2cbbiDBpIttS1gy0iVy9BTPGeu2VNWE/H/dqG0ki8OvtM34X+iQ5Tp1StJ4uO55vnls2065lW3p1J9CBxsnEA4DJCH2mOOWNMNvCGLcEAqYkyVK6mCTpYGrP/FiDlxACRg39TvJsRytyM/5uRNJ89yhqjY6PE/rjyj5dIHryJgeqwhyLKYSj1ss5Rh6gh2AtGCRFiy611zgznqXoZ04lJ5oJ9ylquN9s9vTBf/rw/VGUI3qf1lWmtKeg3JzT0EjLznYaQIQDdbhTghQgIBtR8BSrlNAuxYDbn3Rc8U6WGVvJhyPngLPAuAwMhgao+00IccIL16+BkiJDunQw9YT38nYgSQNFefI9HkaTdQPHYFu42RaOEe2D6c85CG5OVUczHhkCX 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: These functions are no longer necessary. Remove them and cleanup Documentation referencing them. Signed-off-by: Vishal Moola (Oracle) --- Documentation/mm/split_page_table_lock.rst | 12 +++++------ .../zh_CN/mm/split_page_table_lock.rst | 14 ++++++------- include/linux/mm.h | 20 ------------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/Documentation/mm/split_page_table_lock.rst b/Documentation/mm/split_page_table_lock.rst index 50ee0dfc95be..b3c612183135 100644 --- a/Documentation/mm/split_page_table_lock.rst +++ b/Documentation/mm/split_page_table_lock.rst @@ -53,7 +53,7 @@ Support of split page table lock by an architecture =================================================== There's no need in special enabling of PTE split page table lock: everything -required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which +required is done by ptdesc_pte_ctor() and ptdesc_pte_dtor(), which must be called on PTE table allocation / freeing. Make sure the architecture doesn't use slab allocator for page table @@ -63,8 +63,8 @@ This field shares storage with page->ptl. PMD split lock only makes sense if you have more than two page table levels. -PMD split lock enabling requires pgtable_pmd_page_ctor() call on PMD table -allocation and pgtable_pmd_page_dtor() on freeing. +PMD split lock enabling requires ptdesc_pmd_ctor() call on PMD table +allocation and ptdesc_pmd_dtor() on freeing. Allocation usually happens in pmd_alloc_one(), freeing in pmd_free() and pmd_free_tlb(), but make sure you cover all PMD table allocation / freeing @@ -72,7 +72,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc(). With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK. -NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must +NOTE: ptdesc_pte_ctor() and ptdesc_pmd_ctor() can fail -- it must be handled properly. page->ptl @@ -92,7 +92,7 @@ trick: split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs one more cache line for indirect access; -The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in -pgtable_pmd_page_ctor() for PMD table. +The spinlock_t allocated in ptdesc_pte_ctor() for PTE table and in +ptdesc_pmd_ctor() for PMD table. Please, never access page->ptl directly -- use appropriate helper. diff --git a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst index 4fb7aa666037..a3323eb9dc40 100644 --- a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst +++ b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst @@ -56,16 +56,16 @@ Hugetlb特定的辅助函数: 架构对分页表锁的支持 ==================== -没有必要特别启用PTE分页表锁:所有需要的东西都由pgtable_pte_page_ctor() -和pgtable_pte_page_dtor()完成,它们必须在PTE表分配/释放时被调用。 +没有必要特别启用PTE分页表锁:所有需要的东西都由ptdesc_pte_ctor() +和ptdesc_pte_dtor()完成,它们必须在PTE表分配/释放时被调用。 确保架构不使用slab分配器来分配页表:slab使用page->slab_cache来分配其页 面。这个区域与page->ptl共享存储。 PMD分页锁只有在你有两个以上的页表级别时才有意义。 -启用PMD分页锁需要在PMD表分配时调用pgtable_pmd_page_ctor(),在释放时调 -用pgtable_pmd_page_dtor()。 +启用PMD分页锁需要在PMD表分配时调用ptdesc_pmd_ctor(),在释放时调 +用ptdesc_pmd_dtor()。 分配通常发生在pmd_alloc_one()中,释放发生在pmd_free()和pmd_free_tlb() 中,但要确保覆盖所有的PMD表分配/释放路径:即X86_PAE在pgd_alloc()中预先 @@ -73,7 +73,7 @@ PMD分页锁只有在你有两个以上的页表级别时才有意义。 一切就绪后,你可以设置CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK。 -注意:pgtable_pte_page_ctor()和pgtable_pmd_page_ctor()可能失败--必 +注意:ptdesc_pte_ctor()和ptdesc_pmd_ctor()可能失败--必 须正确处理。 page->ptl @@ -90,7 +90,7 @@ page->ptl用于访问分割页表锁,其中'page'是包含该表的页面struc 的指针并动态分配它。这允许在启用DEBUG_SPINLOCK或DEBUG_LOCK_ALLOC的 情况下使用分页锁,但由于间接访问而多花了一个缓存行。 -PTE表的spinlock_t分配在pgtable_pte_page_ctor()中,PMD表的spinlock_t -分配在pgtable_pmd_page_ctor()中。 +PTE表的spinlock_t分配在ptdesc_pte_ctor()中,PMD表的spinlock_t +分配在ptdesc_pmd_ctor()中。 请不要直接访问page->ptl - -使用适当的辅助函数。 diff --git a/include/linux/mm.h b/include/linux/mm.h index cb136d2fdf74..e08638dc58cf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2858,11 +2858,6 @@ static inline bool ptdesc_pte_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pte_page_ctor(struct page *page) -{ - return ptdesc_pte_ctor(page_ptdesc(page)); -} - static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2872,11 +2867,6 @@ static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pte_page_dtor(struct page *page) -{ - ptdesc_pte_dtor(page_ptdesc(page)); -} - #define pte_offset_map_lock(mm, pmd, address, ptlp) \ ({ \ spinlock_t *__ptl = pte_lockptr(mm, pmd); \ @@ -2967,11 +2957,6 @@ static inline bool ptdesc_pmd_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pmd_page_ctor(struct page *page) -{ - return ptdesc_pmd_ctor(page_ptdesc(page)); -} - static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2981,11 +2966,6 @@ static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pmd_page_dtor(struct page *page) -{ - ptdesc_pmd_dtor(page_ptdesc(page)); -} - /* * No scalability reason to split PUD locks yet, but follow the same pattern * as the PMD locks to make it easier if we decide to. The VM should not be