* [PATCH 0/4] Convert motorola to use ptdescs
@ 2025-06-11 0:12 Vishal Moola (Oracle)
2025-06-11 0:12 ` [PATCH 1/4] m68k: mm: Convert get_pointer_table() " Vishal Moola (Oracle)
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-11 0:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-m68k, linux-kernel, Andrew Morton, Vishal Moola (Oracle)
m68k's Motorola still uses struct page (it's pointer tables) to track
page tables. This patchset converts it to use ptdescs, to help prepare
for allocating memory descriptors independently of struct page.
It also includes some minor cleanups to make the code more readable.
----
Based on mm-new. This has only been compile tested, but there are
no expected runtime changes.
Vishal Moola (Oracle) (4):
m68k: mm: Convert get_pointer_table() to use ptdescs
m68k: mm: Convert free_pointer_table() to use ptdescs
m68k: mm: Convert init_pointer_table() to use ptdescs
m68k: mm: Convert pointer table macros to use ptdescs
arch/m68k/mm/motorola.c | 54 ++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 27 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] m68k: mm: Convert get_pointer_table() to use ptdescs
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
@ 2025-06-11 0:12 ` Vishal Moola (Oracle)
2025-06-26 8:38 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 2/4] m68k: mm: Convert free_pointer_table() " Vishal Moola (Oracle)
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-11 0:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-m68k, linux-kernel, Andrew Morton, Vishal Moola (Oracle)
Motorola uses get_pointer_table() for page tables, so it should be using
struct ptdesc, not struct page.
This helps us prepare to allocate ptdescs as their own memory
descriptor, and prepares to remove a user of page->lru.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
arch/m68k/mm/motorola.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 745bd575dcfa..35c3571ffbef 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -148,16 +148,18 @@ void *get_pointer_table(struct mm_struct *mm, int type)
/*
* For a pointer table for a user process address space, a
- * table is taken from a page allocated for the purpose. Each
- * page can hold 8 pointer tables. The page is remapped in
+ * table is taken from a ptdesc allocated for the purpose. Each
+ * ptdesc can hold 8 pointer tables. The ptdesc is remapped in
* virtual address space to be noncacheable.
*/
if (mask == 0) {
- void *page;
+ struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0);
+ void *pt_addr;
ptable_desc *new;
- if (!(page = (void *)get_zeroed_page(GFP_KERNEL)))
+ if (!ptdesc)
return NULL;
+ pt_addr = ptdesc_address(ptdesc);
switch (type) {
case TABLE_PTE:
@@ -165,23 +167,23 @@ void *get_pointer_table(struct mm_struct *mm, int type)
* m68k doesn't have SPLIT_PTE_PTLOCKS for not having
* SMP.
*/
- pagetable_pte_ctor(mm, virt_to_ptdesc(page));
+ pagetable_pte_ctor(mm, ptdesc);
break;
case TABLE_PMD:
- pagetable_pmd_ctor(mm, virt_to_ptdesc(page));
+ pagetable_pmd_ctor(mm, ptdesc);
break;
case TABLE_PGD:
- pagetable_pgd_ctor(virt_to_ptdesc(page));
+ pagetable_pgd_ctor(ptdesc);
break;
}
- mmu_page_ctor(page);
+ mmu_page_ctor(pt_addr);
- new = PD_PTABLE(page);
+ new = PD_PTABLE(pt_addr);
PD_MARKBITS(new) = ptable_mask(type) - 1;
list_add_tail(new, dp);
- return (pmd_t *)page;
+ return (pmd_t *)pt_addr;
}
for (tmp = 1, off = 0; (mask & tmp) == 0; tmp <<= 1, off += ptable_size(type))
@@ -191,7 +193,7 @@ void *get_pointer_table(struct mm_struct *mm, int type)
/* move to end of list */
list_move_tail(dp, &ptable_list[type]);
}
- return page_address(PD_PAGE(dp)) + off;
+ return ptdesc_address(PD_PTDESC(dp)) + off;
}
int free_pointer_table(void *table, int type)
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] m68k: mm: Convert free_pointer_table() to use ptdescs
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
2025-06-11 0:12 ` [PATCH 1/4] m68k: mm: Convert get_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-11 0:12 ` Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 3/4] m68k: mm: Convert init_pointer_table() " Vishal Moola (Oracle)
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-11 0:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-m68k, linux-kernel, Andrew Morton, Vishal Moola (Oracle)
Motorola uses free_pointer_table() for page tables, so it should be using
struct ptdesc, not struct page.
This helps us prepare to allocate ptdescs as their own memory
descriptor, and prepares to remove a user of page->lru.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
arch/m68k/mm/motorola.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 35c3571ffbef..6a459710b2a7 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -200,21 +200,20 @@ int free_pointer_table(void *table, int type)
{
ptable_desc *dp;
unsigned long ptable = (unsigned long)table;
- unsigned long page = ptable & PAGE_MASK;
- unsigned int mask = 1U << ((ptable - page)/ptable_size(type));
+ unsigned long pt_addr = ptable & PAGE_MASK;
+ unsigned int mask = 1U << ((ptable - pt_addr)/ptable_size(type));
- dp = PD_PTABLE(page);
+ dp = PD_PTABLE(pt_addr);
if (PD_MARKBITS (dp) & mask)
panic ("table already free!");
PD_MARKBITS (dp) |= mask;
if (PD_MARKBITS(dp) == ptable_mask(type)) {
- /* all tables in page are free, free page */
+ /* all tables in ptdesc are free, free ptdesc */
list_del(dp);
- mmu_page_dtor((void *)page);
- pagetable_dtor(virt_to_ptdesc((void *)page));
- free_page (page);
+ mmu_page_dtor((void *)pt_addr);
+ pagetable_dtor_free(virt_to_ptdesc((void *)pt_addr));
return 1;
} else if (ptable_list[type].next != dp) {
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] m68k: mm: Convert init_pointer_table() to use ptdescs
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
2025-06-11 0:12 ` [PATCH 1/4] m68k: mm: Convert get_pointer_table() " Vishal Moola (Oracle)
2025-06-11 0:12 ` [PATCH 2/4] m68k: mm: Convert free_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-11 0:12 ` Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 4/4] m68k: mm: Convert pointer table macros " Vishal Moola (Oracle)
2025-06-18 16:56 ` [PATCH 0/4] Convert motorola " Vishal Moola (Oracle)
4 siblings, 1 reply; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-11 0:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-m68k, linux-kernel, Andrew Morton, Vishal Moola (Oracle)
Motorola uses init_pointer_table() for page tables, so it should be using
struct ptdesc, not struct page.
This helps us prepare to allocate ptdescs as their own memory
descriptor, and prepares to remove a user of page->lru.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
arch/m68k/mm/motorola.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 6a459710b2a7..9bd79f42abd5 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -121,10 +121,10 @@ void __init init_pointer_table(void *table, int type)
{
ptable_desc *dp;
unsigned long ptable = (unsigned long)table;
- unsigned long page = ptable & PAGE_MASK;
- unsigned int mask = 1U << ((ptable - page)/ptable_size(type));
+ unsigned long pt_addr = ptable & PAGE_MASK;
+ unsigned int mask = 1U << ((ptable - pt_addr)/ptable_size(type));
- dp = PD_PTABLE(page);
+ dp = PD_PTABLE(pt_addr);
if (!(PD_MARKBITS(dp) & mask)) {
PD_MARKBITS(dp) = ptable_mask(type);
list_add(dp, &ptable_list[type]);
@@ -133,9 +133,9 @@ void __init init_pointer_table(void *table, int type)
PD_MARKBITS(dp) &= ~mask;
pr_debug("init_pointer_table: %lx, %x\n", ptable, PD_MARKBITS(dp));
- /* unreserve the page so it's possible to free that page */
- __ClearPageReserved(PD_PAGE(dp));
- init_page_count(PD_PAGE(dp));
+ /* unreserve the ptdesc so it's possible to free that ptdesc */
+ __ClearPageReserved(ptdesc_page(PD_PTDESC(dp)));
+ init_page_count(ptdesc_page(PD_PTDESC(dp)));
return;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] m68k: mm: Convert pointer table macros to use ptdescs
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
` (2 preceding siblings ...)
2025-06-11 0:12 ` [PATCH 3/4] m68k: mm: Convert init_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-11 0:12 ` Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-18 16:56 ` [PATCH 0/4] Convert motorola " Vishal Moola (Oracle)
4 siblings, 1 reply; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-11 0:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-m68k, linux-kernel, Andrew Morton, Vishal Moola (Oracle)
Motorola uses its pointer tables for page tables, so its macros should be
using struct ptdesc, not struct page. This removes a user of page->lru.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
arch/m68k/mm/motorola.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 9bd79f42abd5..492e34dc45e6 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -92,7 +92,7 @@ void mmu_page_dtor(void *page)
}
/* ++andreas: {get,free}_pointer_table rewritten to use unused fields from
- struct page instead of separately kmalloced struct. Stolen from
+ struct ptdesc instead of separately kmalloced struct. Stolen from
arch/sparc/mm/srmmu.c ... */
typedef struct list_head ptable_desc;
@@ -103,8 +103,7 @@ static struct list_head ptable_list[3] = {
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_PTABLE(ptdesc) ((ptable_desc *)&(virt_to_ptdesc((void *)(ptdesc))->pt_list))
#define PD_PTDESC(ptable) (list_entry(ptable, struct ptdesc, pt_list))
#define PD_MARKBITS(dp) (*(unsigned int *)&PD_PTDESC(dp)->pt_index)
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] Convert motorola to use ptdescs
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
` (3 preceding siblings ...)
2025-06-11 0:12 ` [PATCH 4/4] m68k: mm: Convert pointer table macros " Vishal Moola (Oracle)
@ 2025-06-18 16:56 ` Vishal Moola (Oracle)
4 siblings, 0 replies; 10+ messages in thread
From: Vishal Moola (Oracle) @ 2025-06-18 16:56 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel, Andrew Morton
On Tue, Jun 10, 2025 at 05:12:51PM -0700, Vishal Moola (Oracle) wrote:
> m68k's Motorola still uses struct page (it's pointer tables) to track
> page tables. This patchset converts it to use ptdescs, to help prepare
> for allocating memory descriptors independently of struct page.
>
> It also includes some minor cleanups to make the code more readable.
>
> ----
>
> Based on mm-new. This has only been compile tested, but there are
> no expected runtime changes.
Just a friendly ping requesting someone takes a look at this series..
It should be simple, just make sure I didn't miss anything :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] m68k: mm: Convert get_pointer_table() to use ptdescs
2025-06-11 0:12 ` [PATCH 1/4] m68k: mm: Convert get_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-26 8:38 ` Geert Uytterhoeven
0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2025-06-26 8:38 UTC (permalink / raw)
To: Vishal Moola (Oracle); +Cc: linux-m68k, linux-kernel, Andrew Morton
Hi Vishal,
On Wed, 11 Jun 2025 at 02:13, Vishal Moola (Oracle)
<vishal.moola@gmail.com> wrote:
> Motorola uses get_pointer_table() for page tables, so it should be using
> struct ptdesc, not struct page.
>
> This helps us prepare to allocate ptdescs as their own memory
> descriptor, and prepares to remove a user of page->lru.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Thanks for your patch!
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.17, with the small changes
described below.
> --- a/arch/m68k/mm/motorola.c
> +++ b/arch/m68k/mm/motorola.c
> @@ -148,16 +148,18 @@ void *get_pointer_table(struct mm_struct *mm, int type)
>
> /*
> * For a pointer table for a user process address space, a
> - * table is taken from a page allocated for the purpose. Each
> - * page can hold 8 pointer tables. The page is remapped in
> + * table is taken from a ptdesc allocated for the purpose. Each
> + * ptdesc can hold 8 pointer tables. The ptdesc is remapped in
> * virtual address space to be noncacheable.
> */
> if (mask == 0) {
> - void *page;
> + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0);
I will move the assignment just before the NULL-check below, to ease
applying the WIP preempt patches on top.
> + void *pt_addr;
I will move this one line down, to follow the reverse Xmas rule.
> ptable_desc *new;
>
> - if (!(page = (void *)get_zeroed_page(GFP_KERNEL)))
> + if (!ptdesc)
> return NULL;
> + pt_addr = ptdesc_address(ptdesc);
>
> switch (type) {
> case TABLE_PTE:
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] m68k: mm: Convert free_pointer_table() to use ptdescs
2025-06-11 0:12 ` [PATCH 2/4] m68k: mm: Convert free_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-26 8:39 ` Geert Uytterhoeven
0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2025-06-26 8:39 UTC (permalink / raw)
To: Vishal Moola (Oracle); +Cc: linux-m68k, linux-kernel, Andrew Morton
On Wed, 11 Jun 2025 at 02:13, Vishal Moola (Oracle)
<vishal.moola@gmail.com> wrote:
> Motorola uses free_pointer_table() for page tables, so it should be using
> struct ptdesc, not struct page.
>
> This helps us prepare to allocate ptdescs as their own memory
> descriptor, and prepares to remove a user of page->lru.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.17.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] m68k: mm: Convert init_pointer_table() to use ptdescs
2025-06-11 0:12 ` [PATCH 3/4] m68k: mm: Convert init_pointer_table() " Vishal Moola (Oracle)
@ 2025-06-26 8:39 ` Geert Uytterhoeven
0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2025-06-26 8:39 UTC (permalink / raw)
To: Vishal Moola (Oracle); +Cc: linux-m68k, linux-kernel, Andrew Morton
On Wed, 11 Jun 2025 at 02:13, Vishal Moola (Oracle)
<vishal.moola@gmail.com> wrote:
> Motorola uses init_pointer_table() for page tables, so it should be using
> struct ptdesc, not struct page.
>
> This helps us prepare to allocate ptdescs as their own memory
> descriptor, and prepares to remove a user of page->lru.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.17.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] m68k: mm: Convert pointer table macros to use ptdescs
2025-06-11 0:12 ` [PATCH 4/4] m68k: mm: Convert pointer table macros " Vishal Moola (Oracle)
@ 2025-06-26 8:39 ` Geert Uytterhoeven
0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2025-06-26 8:39 UTC (permalink / raw)
To: Vishal Moola (Oracle); +Cc: linux-m68k, linux-kernel, Andrew Morton
On Wed, 11 Jun 2025 at 02:13, Vishal Moola (Oracle)
<vishal.moola@gmail.com> wrote:
> Motorola uses its pointer tables for page tables, so its macros should be
> using struct ptdesc, not struct page. This removes a user of page->lru.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.17.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-26 8:40 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 0:12 [PATCH 0/4] Convert motorola to use ptdescs Vishal Moola (Oracle)
2025-06-11 0:12 ` [PATCH 1/4] m68k: mm: Convert get_pointer_table() " Vishal Moola (Oracle)
2025-06-26 8:38 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 2/4] m68k: mm: Convert free_pointer_table() " Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 3/4] m68k: mm: Convert init_pointer_table() " Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-11 0:12 ` [PATCH 4/4] m68k: mm: Convert pointer table macros " Vishal Moola (Oracle)
2025-06-26 8:39 ` Geert Uytterhoeven
2025-06-18 16:56 ` [PATCH 0/4] Convert motorola " Vishal Moola (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).