diff mbox series

[v4,07/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for m68k-coldfire

Message ID 20260922-rcu-pagetable-freeing-v4-7-fe1ad1f1e303@kernel.org
State New
Headers show
Series mm: make userland page table freeing RCU-safe | expand

Commit Message

Lorenzo Stoakes (ARM) Sept. 22, 2026, 3:35 p.m. UTC
Similar to sun3, the coldfire variant of m68k uses 2-level page tables.

Update its __pte_free_tlb() function to use tlb_remove_ptdesc() in order
that, with CONFIG_MMU_GATHER_RCU_TABLE_FREE, page tables are freed under
RCU.

The page tables occupy a page each and have no odd semantics, so this
change suffices to allow enabling of CONFIG_MMU_GATHER_RCU_TABLE_FREE for
m68k-coldfire, so do so.

This forms part of an overall effort to switch every architecture to this
mode.

Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
 arch/m68k/Kconfig                   | 2 +-
 arch/m68k/include/asm/mcf_pgalloc.h | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

Comments

Lance Yang Sept. 23, 2026, 9:13 a.m. UTC | #1
On Tue, Sep 22, 2026 at 04:35:38PM +0100, Lorenzo Stoakes (ARM) wrote:
>Similar to sun3, the coldfire variant of m68k uses 2-level page tables.
>
>Update its __pte_free_tlb() function to use tlb_remove_ptdesc() in order
>that, with CONFIG_MMU_GATHER_RCU_TABLE_FREE, page tables are freed under
>RCU.
>
>The page tables occupy a page each and have no odd semantics, so this
>change suffices to allow enabling of CONFIG_MMU_GATHER_RCU_TABLE_FREE for
>m68k-coldfire, so do so.
>
>This forms part of an overall effort to switch every architecture to this
>mode.
>
>Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
>Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>---

Yep, ColdFire PTE freeing now goes through tlb_remove_ptdesc() :)

Feel free to add:

Acked-by: Lance Yang <lance.yang@linux.dev>
Greg Ungerer Sept. 23, 2026, 11:31 a.m. UTC | #2
Hi Lorenzo,

On 23/9/26 01:35, Lorenzo Stoakes (ARM) wrote:
> Similar to sun3, the coldfire variant of m68k uses 2-level page tables.
> 
> Update its __pte_free_tlb() function to use tlb_remove_ptdesc() in order
> that, with CONFIG_MMU_GATHER_RCU_TABLE_FREE, page tables are freed under
> RCU.
> 
> The page tables occupy a page each and have no odd semantics, so this
> change suffices to allow enabling of CONFIG_MMU_GATHER_RCU_TABLE_FREE for
> m68k-coldfire, so do so.
> 
> This forms part of an overall effort to switch every architecture to this
> mode.
> 
> Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

Looks good to me for ColdFire, so:

Acked-by: Greg Ungerer <gerg@linux-m68k.org>

Tested and run with no issues I could see on a M5475 ColdFire system, so:

Tested-by: Greg Ungerer <gerg@linux-m68k.org>

Regards
Greg



> ---
>  arch/m68k/Kconfig                   | 2 +-
>  arch/m68k/include/asm/mcf_pgalloc.h | 5 +----
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index e29610fd1240..6b8ec67c86fd 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -36,7 +36,7 @@ config M68K
>  	select HAVE_MOD_ARCH_SPECIFIC
>  	select HAVE_UID16
>  	select MMU_GATHER_NO_RANGE if MMU
> -	select MMU_GATHER_RCU_TABLE_FREE if MMU && SUN3
> +	select MMU_GATHER_RCU_TABLE_FREE if MMU && (SUN3 || COLDFIRE)
>  	select MODULES_USE_ELF_REL
>  	select MODULES_USE_ELF_RELA
>  	select NO_DMA if !MMU && !COLDFIRE
> diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
> index fc5454d37da3..b53ff0950db2 100644
> --- a/arch/m68k/include/asm/mcf_pgalloc.h
> +++ b/arch/m68k/include/asm/mcf_pgalloc.h
> @@ -39,10 +39,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
>  static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
>  				  unsigned long address)
>  {
> -	struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
> -
> -	pagetable_dtor(ptdesc);
> -	pagetable_free(ptdesc);
> +	tlb_remove_ptdesc(tlb, virt_to_ptdesc(pgtable));
>  }
>  
>  static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
>
Lorenzo Stoakes (ARM) Sept. 23, 2026, 11:36 a.m. UTC | #3
On Wed, Sep 23, 2026 at 09:31:47PM +1000, Greg Ungerer wrote:
> Hi Lorenzo,
>
> On 23/9/26 01:35, Lorenzo Stoakes (ARM) wrote:
> > Similar to sun3, the coldfire variant of m68k uses 2-level page tables.
> >
> > Update its __pte_free_tlb() function to use tlb_remove_ptdesc() in order
> > that, with CONFIG_MMU_GATHER_RCU_TABLE_FREE, page tables are freed under
> > RCU.
> >
> > The page tables occupy a page each and have no odd semantics, so this
> > change suffices to allow enabling of CONFIG_MMU_GATHER_RCU_TABLE_FREE for
> > m68k-coldfire, so do so.
> >
> > This forms part of an overall effort to switch every architecture to this
> > mode.
> >
> > Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> Looks good to me for ColdFire, so:
>
> Acked-by: Greg Ungerer <gerg@linux-m68k.org>
>
> Tested and run with no issues I could see on a M5475 ColdFire system, so:
>
> Tested-by: Greg Ungerer <gerg@linux-m68k.org>

Thanks, much appreciated! :)

>
> Regards
> Greg
>
>
>
> > ---
> >  arch/m68k/Kconfig                   | 2 +-
> >  arch/m68k/include/asm/mcf_pgalloc.h | 5 +----
> >  2 files changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> > index e29610fd1240..6b8ec67c86fd 100644
> > --- a/arch/m68k/Kconfig
> > +++ b/arch/m68k/Kconfig
> > @@ -36,7 +36,7 @@ config M68K
> >  	select HAVE_MOD_ARCH_SPECIFIC
> >  	select HAVE_UID16
> >  	select MMU_GATHER_NO_RANGE if MMU
> > -	select MMU_GATHER_RCU_TABLE_FREE if MMU && SUN3
> > +	select MMU_GATHER_RCU_TABLE_FREE if MMU && (SUN3 || COLDFIRE)
> >  	select MODULES_USE_ELF_REL
> >  	select MODULES_USE_ELF_RELA
> >  	select NO_DMA if !MMU && !COLDFIRE
> > diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
> > index fc5454d37da3..b53ff0950db2 100644
> > --- a/arch/m68k/include/asm/mcf_pgalloc.h
> > +++ b/arch/m68k/include/asm/mcf_pgalloc.h
> > @@ -39,10 +39,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
> >  static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
> >  				  unsigned long address)
> >  {
> > -	struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
> > -
> > -	pagetable_dtor(ptdesc);
> > -	pagetable_free(ptdesc);
> > +	tlb_remove_ptdesc(tlb, virt_to_ptdesc(pgtable));
> >  }
> >
> >  static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
> >
>

--
Cheers, Lorenzo
diff mbox series

Patch

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index e29610fd1240..6b8ec67c86fd 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -36,7 +36,7 @@  config M68K
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_UID16
 	select MMU_GATHER_NO_RANGE if MMU
-	select MMU_GATHER_RCU_TABLE_FREE if MMU && SUN3
+	select MMU_GATHER_RCU_TABLE_FREE if MMU && (SUN3 || COLDFIRE)
 	select MODULES_USE_ELF_REL
 	select MODULES_USE_ELF_RELA
 	select NO_DMA if !MMU && !COLDFIRE
diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
index fc5454d37da3..b53ff0950db2 100644
--- a/arch/m68k/include/asm/mcf_pgalloc.h
+++ b/arch/m68k/include/asm/mcf_pgalloc.h
@@ -39,10 +39,7 @@  extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
 				  unsigned long address)
 {
-	struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
-
-	pagetable_dtor(ptdesc);
-	pagetable_free(ptdesc);
+	tlb_remove_ptdesc(tlb, virt_to_ptdesc(pgtable));
 }
 
 static inline pgtable_t pte_alloc_one(struct mm_struct *mm)