From patchwork Fri Jan 3 18:44:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 13925792 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 92AE3E77188 for ; Fri, 3 Jan 2025 18:44:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2367A6B0096; Fri, 3 Jan 2025 13:44:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 20D606B0098; Fri, 3 Jan 2025 13:44:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AEC26B0099; Fri, 3 Jan 2025 13:44:45 -0500 (EST) 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 E33E76B0096 for ; Fri, 3 Jan 2025 13:44:44 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8EC551209F0 for ; Fri, 3 Jan 2025 18:44:44 +0000 (UTC) X-FDA: 82967016888.10.5F82E9F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id DFB1540006 for ; Fri, 3 Jan 2025 18:44:42 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735929883; 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; bh=2At99XcZDFcXlkIf+qv97R+a7TzNSQFTbGSOrVu3ygw=; b=DgY7jPWjAPOapXuK5LWqVdEqw+iGti48dJvfrC4nwkg9QT6RnYq7JV4cdLjpPcEHOsOaYF ybOT7/7WFkJjPMyeVQgvBl5vqjvbeHpqjLyakJ93aspPy8RlyOEzN7d0J+itVDn29qJFGT 4Z7CkWZGwD57B+V0MYWXJC0DICVh2Lo= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735929883; a=rsa-sha256; cv=none; b=EyMC0VdX/ipC668JcFhLa+QFPGBGh5CZFhRujJAXCHweylWkuf2f3zGGMwXaVvL9Y55JcF UXFLED4ceo633YPe7h/neg1zFcwVb0JHaUbsS744cLRR/ie/zBODM2wyj8tvUBuJzaAn+q 3pmlvRK0VlY/AxR450vQJ2//mM5jhiE= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47F661C25; Fri, 3 Jan 2025 10:45:10 -0800 (PST) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0FCC13F673; Fri, 3 Jan 2025 10:44:37 -0800 (PST) From: Kevin Brodsky To: linux-mm@kvack.org Cc: Kevin Brodsky , Andrew Morton , Catalin Marinas , Dave Hansen , Linus Walleij , Andy Lutomirski , Peter Zijlstra , "Mike Rapoport (IBM)" , Ryan Roberts , Thomas Gleixner , Will Deacon , Matthew Wilcox , Qi Zheng , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, loongarch@lists.linux.dev, x86@kernel.org Subject: [PATCH v2 3/6] m68k: mm: Add calls to pagetable_pmd_[cd]tor Date: Fri, 3 Jan 2025 18:44:12 +0000 Message-ID: <20250103184415.2744423-4-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250103184415.2744423-1-kevin.brodsky@arm.com> References: <20250103184415.2744423-1-kevin.brodsky@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: t54f36por3oxb15xfny4wtco6jb3gykd X-Rspamd-Queue-Id: DFB1540006 X-Rspam-User: X-HE-Tag: 1735929882-478457 X-HE-Meta: U2FsdGVkX1/4TvCi2FqJMj3NBc1EVl15l6yB6BFCRYuTrPGhLOYeIzSJ/FPsMT1TfX633XdLurKWzb1kmtypVZL6Uw6PRB+fEud30Aw3VNuMomHL7srDvl8PjH2JqLweunPFSsS74vq+qW8gsqdBrCpCbwFFFMgOiaJEArtsn4LJOEZmTH1IVsMR7auFBFyZsY9kDANZncbkHyldB8ABWc4ZFMbOFvpvB3DMeGpqcprHE/VQvKsnInK0NIr3wXW+/qupeuc1UzX+1uDx8qGyPdp5R60o23FMq+RIU6ap3jz0OH62MqSukAPKYm//Bcp3HzL90EHT++5HoCGWsPQ1Ptf/5ajp8Umqjk0OoUsuvBmdUpNw3Dk/wPJR+5tanK/7iMYfNDawBwg8EQQHrsKChDhWNcF08aJK8H0NeaTV3DNOaGqA5yT7k/ETKPWP1dkZn7z3RFkHzA9LQeSvWZRq6IY0pO87oK6PqnCvxogXTktuRdrHu9UrQ54j6TL+kxFjXNUeW+KmV3mbQlz5PTqMRdCMQ/VwEdLUjKKyZV9f6HHq9ogYPo2Ul6WfYWmibPOIPz00TR/F+DAib/MIL10NjcQZJTZlSkgFvQyaFSrBqNHcSO0Itw+JLUJ+vIMgSaaYI8H5JP10HB0Y72vyBtUitG1B8ZqeCYcD9azkOvuUlDJQMuwrgPRL+toJzlMLbDhDMFF7IqU7T2+oOzdZqff8jk1j/9Td1e/abCMOittHOXZWpfdHjXBUIBlXzcWEqOJk5ZL+7T7RTrc6R1NfvUpZSSrVZ+8IMLZbatfkgR7HLQdFMNeuO6n82VSAKvfa3quE1g9ixRCp+eoTNETQmuR7aXmxTv9xQF84ER9nNYKACwx5ek/bqjzpTI9I/QpCv7Hy9p92HmIuojqFYpiyyPjwelR/mDDrzQRfmAGHqTvowcTMtgxtubC09Q574nOMiW+k22769phBlyLRSypO2oH ycmEQRcD GcxiuJS0cQL4eanIU8JNzr3P0sEYxJArGPjaIDfstctmyqPvwxwClPedlFnjHg9mRhBaI0lwo/5K0KgWexvxQ8zU4o760pxbCLpKU9JlGGj/tLA/v4E+F7IK2yPGqWoLocy7Cy0x4Q4JTiH/gq2HTG7OZeC8Ezko1R7+mHr3I5PUh3yfKBPdR8fql29iRnrXyd+JnFShagA3DCZLBVt3MpbBVDi6598LmSyAg 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: get_pointer_table() and free_pointer_table() already special-case TABLE_PTE to call pagetable_pte_[cd]tor. Let's do the same at PMD level to improve accounting further. TABLE_PGD and TABLE_PMD are currently defined to the same value, so we first need to separate them. That also implies separating ptable_list for PMD/PGD levels. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/motorola_pgalloc.h | 6 +++--- arch/m68k/mm/motorola.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 74a817d9387f..5abe7da8ac5a 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h @@ -9,9 +9,9 @@ extern void mmu_page_ctor(void *page); extern void mmu_page_dtor(void *page); enum m68k_table_types { - TABLE_PGD = 0, - TABLE_PMD = 0, /* same size as PGD */ - TABLE_PTE = 1, + TABLE_PGD, + TABLE_PMD, + TABLE_PTE, }; extern void init_pointer_table(void *table, int type); diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index eab50dda14ee..6c09ccb72e8b 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -97,17 +97,19 @@ void mmu_page_dtor(void *page) typedef struct list_head ptable_desc; -static struct list_head ptable_list[2] = { +static struct list_head ptable_list[3] = { LIST_HEAD_INIT(ptable_list[0]), LIST_HEAD_INIT(ptable_list[1]), + LIST_HEAD_INIT(ptable_list[2]), }; #define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page((void *)(page))->lru)) #define PD_PAGE(ptable) (list_entry(ptable, struct page, lru)) #define PD_MARKBITS(dp) (*(unsigned int *)&PD_PAGE(dp)->index) -static const int ptable_shift[2] = { - 7+2, /* PGD, PMD */ +static const int ptable_shift[3] = { + 7+2, /* PGD */ + 7+2, /* PMD */ 6+2, /* PTE */ }; @@ -156,12 +158,17 @@ void *get_pointer_table(int type) if (!(page = (void *)get_zeroed_page(GFP_KERNEL))) return NULL; - if (type == TABLE_PTE) { + switch (type) { + case TABLE_PTE: /* * m68k doesn't have SPLIT_PTE_PTLOCKS for not having * SMP. */ pagetable_pte_ctor(virt_to_ptdesc(page)); + break; + case TABLE_PMD: + pagetable_pmd_ctor(virt_to_ptdesc(page)); + break; } mmu_page_ctor(page); @@ -200,7 +207,7 @@ int free_pointer_table(void *table, int type) /* all tables in page are free, free page */ list_del(dp); mmu_page_dtor((void *)page); - if (type == TABLE_PTE) + if (type == TABLE_PTE || type == TABLE_PMD) pagetable_dtor(virt_to_ptdesc((void *)page)); free_page (page); return 1;