Skip to content

Commit 1879688

Browse files
kevin-brodsky-armakpm00
authored andcommitted
m68k: mm: add calls to pagetable_pmd_[cd]tor
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/[email protected] Signed-off-by: Kevin Brodsky <[email protected]> Acked-by: Dave Hansen <[email protected]> Acked-by: Qi Zheng <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Mike Rapoport (Microsoft) <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3565522 commit 1879688

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

arch/m68k/include/asm/motorola_pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ extern void mmu_page_ctor(void *page);
99
extern void mmu_page_dtor(void *page);
1010

1111
enum m68k_table_types {
12-
TABLE_PGD = 0,
13-
TABLE_PMD = 0, /* same size as PGD */
14-
TABLE_PTE = 1,
12+
TABLE_PGD,
13+
TABLE_PMD,
14+
TABLE_PTE,
1515
};
1616

1717
extern void init_pointer_table(void *table, int type);

arch/m68k/mm/motorola.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,19 @@ void mmu_page_dtor(void *page)
9797

9898
typedef struct list_head ptable_desc;
9999

100-
static struct list_head ptable_list[2] = {
100+
static struct list_head ptable_list[3] = {
101101
LIST_HEAD_INIT(ptable_list[0]),
102102
LIST_HEAD_INIT(ptable_list[1]),
103+
LIST_HEAD_INIT(ptable_list[2]),
103104
};
104105

105106
#define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page((void *)(page))->lru))
106107
#define PD_PAGE(ptable) (list_entry(ptable, struct page, lru))
107108
#define PD_MARKBITS(dp) (*(unsigned int *)&PD_PAGE(dp)->index)
108109

109-
static const int ptable_shift[2] = {
110-
7+2, /* PGD, PMD */
110+
static const int ptable_shift[3] = {
111+
7+2, /* PGD */
112+
7+2, /* PMD */
111113
6+2, /* PTE */
112114
};
113115

@@ -156,12 +158,17 @@ void *get_pointer_table(int type)
156158
if (!(page = (void *)get_zeroed_page(GFP_KERNEL)))
157159
return NULL;
158160

159-
if (type == TABLE_PTE) {
161+
switch (type) {
162+
case TABLE_PTE:
160163
/*
161164
* m68k doesn't have SPLIT_PTE_PTLOCKS for not having
162165
* SMP.
163166
*/
164167
pagetable_pte_ctor(virt_to_ptdesc(page));
168+
break;
169+
case TABLE_PMD:
170+
pagetable_pmd_ctor(virt_to_ptdesc(page));
171+
break;
165172
}
166173

167174
mmu_page_ctor(page);
@@ -200,7 +207,7 @@ int free_pointer_table(void *table, int type)
200207
/* all tables in page are free, free page */
201208
list_del(dp);
202209
mmu_page_dtor((void *)page);
203-
if (type == TABLE_PTE)
210+
if (type == TABLE_PTE || type == TABLE_PMD)
204211
pagetable_dtor(virt_to_ptdesc((void *)page));
205212
free_page (page);
206213
return 1;

0 commit comments

Comments
 (0)