From patchwork Thu Dec 19 16:44:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 13915290 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 77FC4E77184 for ; Thu, 19 Dec 2024 16:46:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B9056B0092; Thu, 19 Dec 2024 11:46:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 041466B0093; Thu, 19 Dec 2024 11:46:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFD296B0095; Thu, 19 Dec 2024 11:46:26 -0500 (EST) 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 BEBF76B0092 for ; Thu, 19 Dec 2024 11:46:26 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 75B92C175D for ; Thu, 19 Dec 2024 16:46:26 +0000 (UTC) X-FDA: 82912285806.12.EA86838 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 20F4440020 for ; Thu, 19 Dec 2024 16:46:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734626753; a=rsa-sha256; cv=none; b=FXXNrQcuDHd9G/RejwReO8QtoNR+xkVTph0RvXY6gd0Hf7HLhLAqoDwqg5qaCqzaDeT4l2 ymnXfsZM/+rGWbIvrVy5FOYC2FM4g8NCThyfgmDYLoJ1xO0DB9d2QvB+9qkngn867MV8Ne sXDVJmgVZObOfwupFz5KCVbFvoHlG7E= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734626753; 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=URvkOy53UcBsPFjkdm3DY6eWupuu8tvChY7EKfoY7IQ=; b=MNGnidrBkD+vQ+WQwFyTcrJQ5U9QWbczAYNaVgrbVNXZmuntAgca9HY2vZdmb4Vx1aQveQ LSzS5pu+O3efFPStS7qgCCuf4NCTrIlfFv/Y4Jwo5uoHBM32Unb+58SboLrwHi1hPw+BiN yuF3Vt4I4lqMNQINY80b1x6s48ZXxgs= 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 BEB531480; Thu, 19 Dec 2024 08:46:51 -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 C069C3F58B; Thu, 19 Dec 2024 08:46:19 -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 , 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 03/10] m68k: mm: Add calls to pagetable_pmd_[cd]tor Date: Thu, 19 Dec 2024 16:44:18 +0000 Message-ID: <20241219164425.2277022-4-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241219164425.2277022-1-kevin.brodsky@arm.com> References: <20241219164425.2277022-1-kevin.brodsky@arm.com> MIME-Version: 1.0 X-Stat-Signature: kks65d5ck11gq5bdgc9zz4cs7x85rxo5 X-Rspam-User: X-Rspamd-Queue-Id: 20F4440020 X-Rspamd-Server: rspam08 X-HE-Tag: 1734626769-992806 X-HE-Meta: U2FsdGVkX1/D5+hxxSzab61p/01BCUh/wt9ZNDsC5/uwekMC5Kj+2ASDCktcIhWsQJddQ8Hps6MR3NvhH+3n7QE4fyyNVEF2f31Ct+lEpU6FU3D5aQBKJ3YxfkzvounQamQfq87wbMQNnVMoeoDJsPtt/Eocumimce02D/QveKgUvm/ZlfiYjeU0mY6jJg5jPZ+ItLTlirM7+/5YVpC0FU4KPhbRwyLVgToRD7e46gOTl+/grkBxNeCzimX+uPgx4axmQQnGjfQvS9l/Ikyezkui/coNuW7vj64dSggXR+P/ZC3LHUx28ZghDZQd/k70tgZmIiwKQj5hnY5Ziht7xt5rQrVjO3+FA6ANxY/xIC2927Vr0eNdaXCMVSYTMrJDCYEJ3k3dmMRSZECh3ys41+JzAbTBjoNTQIGVEl5cNxDT6a0h9PkBvDgFhKyRX1RWZcl8dvVQ4zkK3goIYAr/YS7T+p3l4pnsVXPtTk9JqaCYm1wTBreJ4M9Z+uwieVxhzx5wWqrI8kFCifsnCkurCQrtRpd72DlZEmCZ4OBN+R2Uyu3T3wNZFhsMOrc/S+qEquppjUlEhCPbXjZhS0xsu7UKavfk670xsLFV1yiGdUDCLi64fL1F99TACSj1dRAMR3348rdoZ1cx+L08M2mIlL3Gi0iuedFviDWqaAVHx1aSukKwNIqneRvseU55gsHOKF1SosQ1Xxvp739HdMexMIBPQZSRt7IzAtz+FFP1mkC11dcgz5hZW/zp7T80A5f7Y19UllpsrB37jKdsxM3kyNpJyIywggBpd217a3pTfBIOmxtmtO0KfWWz9lS6BwyHnpvmygkb1Sjq6xV/avc2aLaPQ3rjJvqezzwyYOSyAQHJXdG4kTD6TgiEcDOH86awxunRvxdubvgoeBWh3/Vnl8NZqx8a0YMg+WtY/FIOaP32NBuVGWXL/ScNJglQAR2F+GxQXyUIU2/gJ74xn21 YqHO1GaY BFnhphRBzuoz6AY8/CkMatjf8QpCn3822sz3fEqDb/bntefN1gssvHCU1Uj3cF969iwaG7bBeVFqgYD9uej8szWvYhwUdTNFmy7sMlVYCtaHPkr85O7fZol3+tFhOtIkH1sQ+PevdRO8n+W76QcchsePk+9owbQogAmSJNFROUUnM7IzmI/gyIj8fX+JpdDMrghJB15x2mu82cKr5RyCkhpbf4TKOYIdDAeOIy762BQWJuQt0oJt2BWmEwnt1U8w/SirIqdf7ezCLHS5j6G+YS0/7ZxNMpYyuxzOZp/+6cSRnQnpwUC9XDuZ/no/+9avoleGqM/yHmepdfs4= 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. Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/motorola_pgalloc.h | 6 +++--- arch/m68k/mm/motorola.c | 25 +++++++++++++++++++----- 2 files changed, 23 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 c1761d309fc6..37010ee15928 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,8 +207,16 @@ 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) + + switch (type) { + case TABLE_PTE: pagetable_pte_dtor(virt_to_ptdesc((void *)page)); + break; + case TABLE_PMD: + pagetable_pmd_dtor(virt_to_ptdesc((void *)page)); + break; + } + free_page (page); return 1; } else if (ptable_list[type].next != dp) {