From patchwork Tue Jul 30 06:46:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13746740 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 0015BC3DA61 for ; Tue, 30 Jul 2024 06:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 756BC6B008C; Tue, 30 Jul 2024 02:43:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72D7F6B0092; Tue, 30 Jul 2024 02:43:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CDEF6B0093; Tue, 30 Jul 2024 02:43:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 408076B008C for ; Tue, 30 Jul 2024 02:43:22 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B0D681A0125 for ; Tue, 30 Jul 2024 06:43:21 +0000 (UTC) X-FDA: 82395477402.01.D2480AE Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 5B9D414000A for ; Tue, 30 Jul 2024 06:43:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXb4byD4; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722321744; 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=N+b/tkEwy+VP7NQrXZ2C7fLE86+QmLlc6F25XGCmpnk=; b=wfIcfAxVyqMM/cHqBxcj92/ArxIBfPDOGz2IHq7qcGt9/N9+jIkkyPK1U0zaHNky3YU9o6 ibSY1BtEk+pO2t7jK1d1Xg+yfpFKmMx7E4qyOeeOFuLEKDeM8Oy17uXepMgKoIR7v1BNIj jHsC+l/Aul40bTpgosQLq6B7WrBvI+Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722321744; a=rsa-sha256; cv=none; b=t9JPojhwy2HJ164cXjcn2qPhmnowscSOoElZvht5cZb+00gWF2EnK55+iMznKXWj4WBdaP 8vQRAMTkzfoSzU7rhE+MEmhVNm2ilXIcslatkFf9D1CgyLyuEqDTDHa44FvfSTH/7kiulm P8WTHetSWv6vqVuEg/bjKfUgunRqwmc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXb4byD4; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B8E46CE0EA6; Tue, 30 Jul 2024 06:43:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 469FBC32782; Tue, 30 Jul 2024 06:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722321793; bh=9NZb0rrKQqKYXT4j44hct+A4v/K9XblH1QcI1NJ86wY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXb4byD4QEB/pykGQSUxfRgInQG2nhMHKXm5xZNegBtn3rrGWMaLewVYiqUNRYDtJ aQ+opzP1rC4aJUxCXkL2wAnqAIW3nIQYdRxHYnksJ0PJsaNlzE/MV3jYxsY7CWC6i6 A55O5dfE29WFwTXyQHh6asj1EX4qez2hBgWChYq1nW9wZhzPJt7adzM3dujj4fTqjW GPMlZQsWyciJ/EykTgqqAmIjcZelbGlK8I8ok7QSAhrcTaitTlPHXoD4wXFz71j46R BpZv8MZ6nqA/BUfQ66+uiCN6lG0xAGpqKsFp7FzaM7qSm50/Hdt7uFpAhZjkPrnNQ4 JZOzjdQ+jlf0A== From: alexs@kernel.org To: Will Deacon , "Aneesh Kumar K . V" , Nick Piggin , Peter Zijlstra , Russell King , Catalin Marinas , Brian Cain , WANG Xuerui , Geert Uytterhoeven , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Naveen N Rao , Paul Walmsley , Albert Ou , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Andy Lutomirski , Bibo Mao , Baolin Wang , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Qi Zheng , Vishal Moola , "Aneesh Kumar K . V" , Kemeng Shi , Lance Yang , Peter Xu , Barry Song , linux-s390@vger.kernel.org Cc: Guo Ren , Christophe Leroy , Palmer Dabbelt , Mike Rapoport , Oscar Salvador , Alexandre Ghiti , Jisheng Zhang , Samuel Holland , Anup Patel , Josh Poimboeuf , Breno Leitao , Alexander Gordeev , Gerald Schaefer , Hugh Dickins , David Hildenbrand , Ryan Roberts , Matthew Wilcox , Alex Shi , sparclinux@vger.kernel.org, Andreas Larsson , "David S . Miller" , Zi Yan Subject: [RFC PATCH 02/18] mm/pgtable: convert ptdesc.pmd_huge_pte to ptdesc pointer Date: Tue, 30 Jul 2024 14:46:56 +0800 Message-ID: <20240730064712.3714387-3-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730064712.3714387-1-alexs@kernel.org> References: <20240730064712.3714387-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5B9D414000A X-Stat-Signature: uxpo3eqtjs59yactg8zc8yarizazffxy X-HE-Tag: 1722321797-407764 X-HE-Meta: U2FsdGVkX1+Zu7Z8OvMVGBqhvM+hK0MYYIQsUhLQN3fPO/UaquG0BIeenFrA9xn0WP3jii12cybxYQvTri8ko92cycJw9L3+7qnjDG9cQFh1AfDwnD58SMRQlnkzJWD8NPPB9B+p2ieEUlLW0ruPT2qwBUBMFkxIjSVNs4tljGPMFGg9qSyrMKj9cE31iQQxdahV5UpTYoer4g2dC5M4Gpi7UZ1JkjaD7CAsbNqjF7/CodBU15PLbrxeFafcSj9c9pEtDKzIFxxM8kaBlnW2Ukkc5SV48ahN6gBQn4oIwx1IhwcDpjH+slPbP+soVptEcEXOUMnlju79IHnH2g61dvX6jBgi0hOM3ki8l/cWWz4AJWWWRa6dKwvRSBQxoil1hqUeEb1Eq6j9ieo+LBjQjZHF1nIaU8Q7m6+rwb0XhKLdayZrZHqjh5h71OsqZk8qlhwhhhVfNP1lFCnKkoldLzDgljhVxa1p4aRpuUdPkhF755r+b8voOIOR+c5ttdzbj0qhbE/ygHeFSZ167bWrr1WXmf1VBBEyZknMzaqfc4scziE/Skl+S+As3e1yIWbLc99f4q56nREUuVgOUxjo9m+9wtwy33t/N+BqZjiHsVHaT9Eyq9iUIY7K/oEDIJZaSI0basnUmXpI/+A6JsuC+4qsU86/GljLjbGcS3IXe3z/7gURbo0K4DjHYLO7geSljPVHstZUgE1XWI4/00ZaTzXP2PMo346SMvOEtmpsuAs0cXzfdN1957mJ1ZZl0NVV8X0vZO4ANNvp1Sclfvr0guNd4am+uoO9qSW7HlpWrbrDI6ad9gv1YyAPiTux1FdK7skvBaATkDSC/tmkkl2w3HGdxXAGIFGuW2EhqxQjx7TgKacI/FpelWZRhjHqBgShQL8lIbqzs3FwUVmR/ukiWpq82p4TFBDMPrnohrB/9jVeu7hobO2XyuiTLjQEMcBAYcjeTLi+PlhgvQNBBqh Xwzi55Mm OarESx73dHAOihH4I8drY+p6+T/+TnroZhYbm3e3KoLvL+gqd5/Sq7xiR40mRdtViuO8LtSng7eR1rHoHgTSaa+OYdrgUczym9C8qKYWJSCXfjs8K/w9FGkqwQP96BDxIVY6B51t1Df9co3QBgnhqIc/2wRNiU857glQZN49LWYuHaSaSKQF6znob2u6Z3DvVaAcSbqZzoZT1vEVYro+mhGmA7xfeMd39ARphwpTrlcLSDREy5TXpze1KShiUaEudMEmoG/+NJ/TJFBVNVNF3EssZ0swdiQakIJEH6R6y555t2jyKgLw2wwTun86aSchEctd1sfdAezF/stxY+mm9lNoAJdK1E24yO0ISYvIQlLGfC/ttNZjKuufWiBYRlsN85LbDLlj/qnRiaGusuEDY17xsPTP0CnaMOwakkJs4rxp3fPe7h4VNb8I+yajy7LwKstAJPTeqVxZTtUPmfqyRVzCZ3pe8jO/O88cV5BY/qriVI1LcLZgTY/EJro+kFDzxRG+hv1BGlfyt8uo8gLZwd9ee2Tuu94LzgveKnyBoZ6cUeb8oJePnElxRrweIeECiQKAmFNeUq+IQx2nzTvqSG/0c2V4Ym6oZbKlOoYymeQS0PocoIi7FOp9/vBjAfCjFV8Ha9n6Hc/ljhzc5z5cilHnpMRohtZ14BQEVFMe/R2cRIc1OzzsPIr/n+u309Isp3e5RJC6jCo9ixJltwy5AfproZw== 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: List-Subscribe: List-Unsubscribe: From: Alex Shi folio/page.pmd_huge_pte is a pointer to pagetable descriptor: pgtable_t. In most arch, it is a typedef of 'struct page *'. But we have ptdesc now, tt's better to convert it to right one: struct ptdesc pointer. Different from others, s390/sparc use typedef 'pte_t *' as pgtable_t, so they need different cost in their arch. Thanks for lkp found the build issue for s390/sparc, it fixed now. Signed-off-by: Alex Shi Cc: linux-mm@kvack.org Cc: sparclinux@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: Ryan Roberts Cc: Andreas Larsson Cc: David S. Miller Cc: Sven Schnelle Cc: Christian Borntraeger Cc: Vasily Gorbik Cc: Heiko Carstens Cc: Gerald Schaefer Cc: Alexander Gordeev Cc: Zi Yan Cc: Matthew Wilcox Cc: Mike Rapoport Cc: David Hildenbrand --- arch/s390/mm/pgtable.c | 6 +++--- arch/sparc/mm/tlb.c | 6 +++--- include/linux/mm_types.h | 4 ++-- mm/pgtable-generic.c | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 2c944bafb030..201d350abd1e 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c @@ -574,7 +574,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, INIT_LIST_HEAD(lh); else list_add(lh, (struct list_head *) pmd_huge_pte(mm, pmdp)); - pmd_huge_pte(mm, pmdp) = pgtable; + pmd_huge_pte(mm, pmdp) = (struct ptdesc *)pgtable; } pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) @@ -586,12 +586,12 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) assert_spin_locked(pmd_lockptr(mm, pmdp)); /* FIFO */ - pgtable = pmd_huge_pte(mm, pmdp); + pgtable = (pte_t *)pmd_huge_pte(mm, pmdp); lh = (struct list_head *) pgtable; if (list_empty(lh)) pmd_huge_pte(mm, pmdp) = NULL; else { - pmd_huge_pte(mm, pmdp) = (pgtable_t) lh->next; + pmd_huge_pte(mm, pmdp) = (struct ptdesc *) lh->next; list_del(lh); } ptep = (pte_t *) pgtable; diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c index 8648a50afe88..903825b4c997 100644 --- a/arch/sparc/mm/tlb.c +++ b/arch/sparc/mm/tlb.c @@ -278,7 +278,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, INIT_LIST_HEAD(lh); else list_add(lh, (struct list_head *) pmd_huge_pte(mm, pmdp)); - pmd_huge_pte(mm, pmdp) = pgtable; + pmd_huge_pte(mm, pmdp) = (struct ptdesc *)pgtable; } pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) @@ -289,12 +289,12 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) assert_spin_locked(&mm->page_table_lock); /* FIFO */ - pgtable = pmd_huge_pte(mm, pmdp); + pgtable = (pte_t *)pmd_huge_pte(mm, pmdp); lh = (struct list_head *) pgtable; if (list_empty(lh)) pmd_huge_pte(mm, pmdp) = NULL; else { - pmd_huge_pte(mm, pmdp) = (pgtable_t) lh->next; + pmd_huge_pte(mm, pmdp) = (struct ptdesc *) lh->next; list_del(lh); } pte_val(pgtable[0]) = 0; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 485424979254..2e3eddf6edc9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -462,7 +462,7 @@ struct ptdesc { struct list_head pt_list; struct { unsigned long _pt_pad_1; - pgtable_t pmd_huge_pte; + struct ptdesc *pmd_huge_pte; }; }; unsigned long __page_mapping; @@ -948,7 +948,7 @@ struct mm_struct { struct mmu_notifier_subscriptions *notifier_subscriptions; #endif #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS - pgtable_t pmd_huge_pte; /* protected by page_table_lock */ + struct ptdesc *pmd_huge_pte; /* protected by page_table_lock */ #endif #ifdef CONFIG_NUMA_BALANCING /* diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 2ce714f1dd15..f34a8d115f5b 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -171,8 +171,8 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, if (!pmd_huge_pte(mm, pmdp)) INIT_LIST_HEAD(&pgtable->lru); else - list_add(&pgtable->lru, &pmd_huge_pte(mm, pmdp)->lru); - pmd_huge_pte(mm, pmdp) = pgtable; + list_add(&pgtable->lru, &pmd_huge_pte(mm, pmdp)->pt_list); + pmd_huge_pte(mm, pmdp) = page_ptdesc(pgtable); } #endif @@ -180,17 +180,17 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, /* no "address" argument so destroys page coloring of some arch */ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) { - pgtable_t pgtable; + struct ptdesc *ptdesc; assert_spin_locked(pmd_lockptr(mm, pmdp)); /* FIFO */ - pgtable = pmd_huge_pte(mm, pmdp); - pmd_huge_pte(mm, pmdp) = list_first_entry_or_null(&pgtable->lru, - struct page, lru); + ptdesc = pmd_huge_pte(mm, pmdp); + pmd_huge_pte(mm, pmdp) = list_first_entry_or_null(&ptdesc->pt_list, + struct ptdesc, pt_list); if (pmd_huge_pte(mm, pmdp)) - list_del(&pgtable->lru); - return pgtable; + list_del(&ptdesc->pt_list); + return ptdesc_page(ptdesc); } #endif