]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
m68k: mm: add calls to pagetable_pmd_[cd]tor
authorKevin Brodsky <kevin.brodsky@arm.com>
Fri, 3 Jan 2025 18:44:12 +0000 (18:44 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 26 Jan 2025 04:22:24 +0000 (20:22 -0800)
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.

Link: https://lkml.kernel.org/r/20250103184415.2744423-4-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/m68k/include/asm/motorola_pgalloc.h
arch/m68k/mm/motorola.c

index 74a817d9387fd105b6a1189b9149498e3c329d44..5abe7da8ac5ab0a3be0083ba94afbaddbf13a022 100644 (file)
@@ -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);
index 81715cece70c6f7b0458647684e8325935aa51c4..12de00df53c475c3c1506c7307eff5d8754e90e3 100644 (file)
@@ -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;