All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC
@ 2026-12-03 16:58 Julian Braha
  2026-12-03 18:23 ` + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julian Braha @ 2026-12-03 16:58 UTC (permalink / raw)
  To: richard.henderson, linmag7
  Cc: qi.zheng, akpm, viro, geert, catalin.marinas, rppt, joao,
	linux-alpha, linux-kernel, kernel-janitors, Julian Braha

Currently, the ALPHA_LARGE_VMALLOC config option can never be enabled,
meaning that all references to it are dead code.

As Al explained [1], the code for a larger vmalloc area set up only the
first PGD slot at boot. It added PGD entries on demand and relied on the
page fault handler to copy a missing entry into the faulting address
space. That synchronization was racy.

The 8 GiB vmalloc area fits in one PGD slot. callback_init() sets up that
entry at boot, and pgd_alloc() copies it into each new address space.
Later vmalloc updates use the lower-level page tables that all address
spaces share.

Let's remove this dead option and its associated code.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

Link: https://lore.kernel.org/all/20251130030146.GN3538@ZenIV/ [1]
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
Changes since v1:
- add Al's rationale and link to RFC (Magnus)
- clarify comment in callback_init() (Magnus)

Link to v1:
https://lore.kernel.org/all/20260816143835.1068971-1-julianbraha@gmail.com/
---
 arch/alpha/Kconfig               | 15 ---------------
 arch/alpha/include/asm/pgtable.h |  4 ----
 arch/alpha/mm/fault.c            | 24 ------------------------
 arch/alpha/mm/init.c             | 10 ++--------
 4 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 79700e350603..e78174c8d990 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -520,21 +520,6 @@ config ALPHA_WTINT
 
 	  If unsure, say N.
 
-# LARGE_VMALLOC is racy, if you *really* need it then fix it first
-config ALPHA_LARGE_VMALLOC
-	bool
-	help
-	  Process creation and other aspects of virtual memory management can
-	  be streamlined if we restrict the kernel to one PGD for all vmalloc
-	  allocations.  This equates to about 8GB.
-
-	  Under normal circumstances, this is so far and above what is needed
-	  as to be laughable.  However, there are certain applications (such
-	  as benchmark-grade in-kernel web serving) that can make use of as
-	  much vmalloc space as is available.
-
-	  Say N unless you know you need gobs and gobs of vmalloc space.
-
 config VERBOSE_MCHECK
 	bool "Verbose Machine Checks"
 
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index e96fcafc3f00..afedfda13543 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -50,11 +50,7 @@ struct vm_area_struct;
 /* Number of pointers that fit on a page:  this will go away. */
 #define PTRS_PER_PAGE	(1UL << (PAGE_SHIFT-3))
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-#define VMALLOC_START		0xfffffe0000000000
-#else
 #define VMALLOC_START		(-2*PGDIR_SIZE)
-#endif
 #define VMALLOC_END		(-PGDIR_SIZE)
 
 /*
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index a46553b5e7d9..1d49776333d6 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -153,10 +153,6 @@ handle_page_fault(unsigned long address, unsigned long mmcsr,
 	if (!mm || faulthandler_disabled())
 		goto no_context;
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-	if (address >= TASK_SIZE)
-		goto vmalloc_fault;
-#endif
 	if (user_mode(regs))
 		flags |= FAULT_FLAG_USER;
 	perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
@@ -289,26 +285,6 @@ handle_page_fault(unsigned long address, unsigned long mmcsr,
 					       : "access violation");
 	force_sig_fault(SIGSEGV, si_code, (void __user *) address);
 	return;
-
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
- vmalloc_fault:
-	if (user_mode(regs))
-		goto do_sigsegv;
-	else {
-		/* Synchronize this task's top level page-table
-		   with the "reference" page table from init.  */
-		long index = pgd_index(address);
-		pgd_t *pgd, *pgd_k;
-
-		pgd = current->active_mm->pgd + index;
-		pgd_k = swapper_pg_dir + index;
-		if (!pgd_present(*pgd) && pgd_present(*pgd_k)) {
-			pgd_val(*pgd) = pgd_val(*pgd_k);
-			return;
-		}
-		goto no_context;
-	}
-#endif
 }
 
 asmlinkage noinstr void
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 6c28947d6e2d..d6b9b8418543 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -45,12 +45,7 @@ pgd_alloc(struct mm_struct *mm)
 	ret = __pgd_alloc(mm, 0);
 	init = pgd_offset(&init_mm, 0UL);
 	if (ret) {
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-		memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
-			(PTRS_PER_PGD - USER_PTRS_PER_PGD - 1)*sizeof(pgd_t));
-#else
 		pgd_val(ret[PTRS_PER_PGD-2]) = pgd_val(init[PTRS_PER_PGD-2]);
-#endif
 
 		/* The last PGD entry is the VPTB self-map.  */
 		pgd_val(ret[PTRS_PER_PGD-1])
@@ -147,9 +142,8 @@ callback_init(void * kernel_end)
 	   On systems with larger consoles, additional pages will be
 	   allocated as needed during the mapping process.
 
-	   In the case of not SRM, but not CONFIG_ALPHA_LARGE_VMALLOC,
-	   we need to allocate the PGD we use for vmalloc before we start
-	   forking other tasks.  */
+	   With or without SRM, the vmalloc PGD entry must be set up early
+	   so pgd_alloc() can copy it into each new address space.  */
 
 	two_pages = (void *)
 	  (((unsigned long)kernel_end + ~PAGE_MASK) & PAGE_MASK);
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch
  2026-12-03 16:58 [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Julian Braha
@ 2026-12-03 18:23 ` Andrew Morton
  2026-12-03 22:25   ` Magnus Lindholm
  2026-12-03 22:36 ` [obsolete] alpha-cleanup-dead-alpha_large_vmalloc.patch removed from -mm tree Andrew Morton
  2026-12-04 15:44 ` [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Magnus Lindholm
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2026-12-03 18:23 UTC (permalink / raw)
  To: mm-commits, viro, rppt, richard.henderson, qi.zheng, linmag7,
	julian.braha, joao, geert, catalin.marinas, julianbraha, akpm


The patch titled
     Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     alpha-cleanup-dead-alpha_large_vmalloc.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/alpha-cleanup-dead-alpha_large_vmalloc.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Julian Braha <julianbraha@gmail.com>
Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
Date: Thu,  3 Dec 2026 16:58:51 +0000

Currently, the ALPHA_LARGE_VMALLOC config option can never be enabled,
meaning that all references to it are dead code.

As Al explained [1], the code for a larger vmalloc area set up only the
first PGD slot at boot.  It added PGD entries on demand and relied on the
page fault handler to copy a missing entry into the faulting address
space.  That synchronization was racy.

The 8 GiB vmalloc area fits in one PGD slot.  callback_init() sets up that
entry at boot, and pgd_alloc() copies it into each new address space. 
Later vmalloc updates use the lower-level page tables that all address
spaces share.

Let's remove this dead option and its associated code.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

Link: https://patch.msgid.link/20261203165851.2505535-1-julianbraha@gmail.com
Link: https://lore.kernel.org/all/20251130030146.GN3538@ZenIV/ [1]
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Julian Braha <julian.braha@gmail.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: <joao@joaoff.com>

 arch/alpha/Kconfig               |   15 ---------------
 arch/alpha/include/asm/pgtable.h |    4 ----
 arch/alpha/mm/fault.c            |   24 ------------------------
 arch/alpha/mm/init.c             |   10 ++--------
 4 files changed, 2 insertions(+), 51 deletions(-)

--- a/arch/alpha/include/asm/pgtable.h~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/include/asm/pgtable.h
@@ -50,11 +50,7 @@ struct vm_area_struct;
 /* Number of pointers that fit on a page:  this will go away. */
 #define PTRS_PER_PAGE	(1UL << (PAGE_SHIFT-3))
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-#define VMALLOC_START		0xfffffe0000000000
-#else
 #define VMALLOC_START		(-2*PGDIR_SIZE)
-#endif
 #define VMALLOC_END		(-PGDIR_SIZE)
 
 /*
--- a/arch/alpha/Kconfig~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/Kconfig
@@ -521,21 +521,6 @@ config ALPHA_WTINT
 
 	  If unsure, say N.
 
-# LARGE_VMALLOC is racy, if you *really* need it then fix it first
-config ALPHA_LARGE_VMALLOC
-	bool
-	help
-	  Process creation and other aspects of virtual memory management can
-	  be streamlined if we restrict the kernel to one PGD for all vmalloc
-	  allocations.  This equates to about 8GB.
-
-	  Under normal circumstances, this is so far and above what is needed
-	  as to be laughable.  However, there are certain applications (such
-	  as benchmark-grade in-kernel web serving) that can make use of as
-	  much vmalloc space as is available.
-
-	  Say N unless you know you need gobs and gobs of vmalloc space.
-
 config VERBOSE_MCHECK
 	bool "Verbose Machine Checks"
 
--- a/arch/alpha/mm/fault.c~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/mm/fault.c
@@ -152,10 +152,6 @@ do_page_fault(unsigned long address, uns
 	if (!mm || faulthandler_disabled())
 		goto no_context;
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-	if (address >= TASK_SIZE)
-		goto vmalloc_fault;
-#endif
 	if (user_mode(regs))
 		flags |= FAULT_FLAG_USER;
 	perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
@@ -288,24 +284,4 @@ retry:
 					       : "access violation");
 	force_sig_fault(SIGSEGV, si_code, (void __user *) address);
 	return;
-
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
- vmalloc_fault:
-	if (user_mode(regs))
-		goto do_sigsegv;
-	else {
-		/* Synchronize this task's top level page-table
-		   with the "reference" page table from init.  */
-		long index = pgd_index(address);
-		pgd_t *pgd, *pgd_k;
-
-		pgd = current->active_mm->pgd + index;
-		pgd_k = swapper_pg_dir + index;
-		if (!pgd_present(*pgd) && pgd_present(*pgd_k)) {
-			pgd_val(*pgd) = pgd_val(*pgd_k);
-			return;
-		}
-		goto no_context;
-	}
-#endif
 }
--- a/arch/alpha/mm/init.c~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/mm/init.c
@@ -45,12 +45,7 @@ pgd_alloc(struct mm_struct *mm)
 	ret = __pgd_alloc(mm, 0);
 	init = pgd_offset(&init_mm, 0UL);
 	if (ret) {
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-		memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
-			(PTRS_PER_PGD - USER_PTRS_PER_PGD - 1)*sizeof(pgd_t));
-#else
 		pgd_val(ret[PTRS_PER_PGD-2]) = pgd_val(init[PTRS_PER_PGD-2]);
-#endif
 
 		/* The last PGD entry is the VPTB self-map.  */
 		pgd_val(ret[PTRS_PER_PGD-1])
@@ -147,9 +142,8 @@ callback_init(void * kernel_end)
 	   On systems with larger consoles, additional pages will be
 	   allocated as needed during the mapping process.
 
-	   In the case of not SRM, but not CONFIG_ALPHA_LARGE_VMALLOC,
-	   we need to allocate the PGD we use for vmalloc before we start
-	   forking other tasks.  */
+	   With or without SRM, the vmalloc PGD entry must be set up early
+	   so pgd_alloc() can copy it into each new address space.  */
 
 	two_pages = (void *)
 	  (((unsigned long)kernel_end + ~PAGE_MASK) & PAGE_MASK);
_

Patches currently in -mm which might be from julianbraha@gmail.com are

alpha-cleanup-dead-alpha_large_vmalloc.patch


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch
  2026-12-03 18:23 ` + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch Andrew Morton
@ 2026-12-03 22:25   ` Magnus Lindholm
  2026-12-03 22:35     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Magnus Lindholm @ 2026-12-03 22:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, viro, rppt, richard.henderson, qi.zheng, julian.braha,
	joao, geert, catalin.marinas, julianbraha

Hi Andrew,

On Thu, Dec 3, 2026 at 7:23 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
>
> The patch titled
>      Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
> has been added to the -mm mm-nonmm-unstable branch.  Its filename is
>      alpha-cleanup-dead-alpha_large_vmalloc.patch
>
> This patch will shortly appear at
>      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/alpha-cleanup-dead-alpha_large_vmalloc.patch
>
> This patch will later appear in the mm-nonmm-unstable branch at
>     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via various
> branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there most days
>

Julian posted v2 of the Alpha ALPHA_LARGE_VMALLOC cleanup. I'm
reviewing it as well as testing it now on my ES40.

Were you planning to take this through the -mm tree? That route works
for me and if so, I'll leave it out of the Alpha tree.

Thanks,
Magnus


> ------------------------------------------------------
> From: Julian Braha <julianbraha@gmail.com>
> Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
> Date: Thu,  3 Dec 2026 16:58:51 +0000
>
> Currently, the ALPHA_LARGE_VMALLOC config option can never be enabled,
> meaning that all references to it are dead code.
>
> As Al explained [1], the code for a larger vmalloc area set up only the
> first PGD slot at boot.  It added PGD entries on demand and relied on the
> page fault handler to copy a missing entry into the faulting address
> space.  That synchronization was racy.
>
> The 8 GiB vmalloc area fits in one PGD slot.  callback_init() sets up that
> entry at boot, and pgd_alloc() copies it into each new address space.
> Later vmalloc updates use the lower-level page tables that all address
> spaces share.
>
> Let's remove this dead option and its associated code.
>
> This dead code was found by kconfirm, a static analysis tool for Kconfig.
>
> Link: https://patch.msgid.link/20261203165851.2505535-1-julianbraha@gmail.com
> Link: https://lore.kernel.org/all/20251130030146.GN3538@ZenIV/ [1]
> Signed-off-by: Julian Braha <julianbraha@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Cc: Julian Braha <julian.braha@gmail.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Magnus Lindholm <linmag7@gmail.com>
> Cc: Qi Zheng <qi.zheng@linux.dev>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: <joao@joaoff.com>
>
>  arch/alpha/Kconfig               |   15 ---------------
>  arch/alpha/include/asm/pgtable.h |    4 ----
>  arch/alpha/mm/fault.c            |   24 ------------------------
>  arch/alpha/mm/init.c             |   10 ++--------
>  4 files changed, 2 insertions(+), 51 deletions(-)
>
> --- a/arch/alpha/include/asm/pgtable.h~alpha-cleanup-dead-alpha_large_vmalloc
> +++ a/arch/alpha/include/asm/pgtable.h
> @@ -50,11 +50,7 @@ struct vm_area_struct;
>  /* Number of pointers that fit on a page:  this will go away. */
>  #define PTRS_PER_PAGE  (1UL << (PAGE_SHIFT-3))
>
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -#define VMALLOC_START          0xfffffe0000000000
> -#else
>  #define VMALLOC_START          (-2*PGDIR_SIZE)
> -#endif
>  #define VMALLOC_END            (-PGDIR_SIZE)
>
>  /*
> --- a/arch/alpha/Kconfig~alpha-cleanup-dead-alpha_large_vmalloc
> +++ a/arch/alpha/Kconfig
> @@ -521,21 +521,6 @@ config ALPHA_WTINT
>
>           If unsure, say N.
>
> -# LARGE_VMALLOC is racy, if you *really* need it then fix it first
> -config ALPHA_LARGE_VMALLOC
> -       bool
> -       help
> -         Process creation and other aspects of virtual memory management can
> -         be streamlined if we restrict the kernel to one PGD for all vmalloc
> -         allocations.  This equates to about 8GB.
> -
> -         Under normal circumstances, this is so far and above what is needed
> -         as to be laughable.  However, there are certain applications (such
> -         as benchmark-grade in-kernel web serving) that can make use of as
> -         much vmalloc space as is available.
> -
> -         Say N unless you know you need gobs and gobs of vmalloc space.
> -
>  config VERBOSE_MCHECK
>         bool "Verbose Machine Checks"
>
> --- a/arch/alpha/mm/fault.c~alpha-cleanup-dead-alpha_large_vmalloc
> +++ a/arch/alpha/mm/fault.c
> @@ -152,10 +152,6 @@ do_page_fault(unsigned long address, uns
>         if (!mm || faulthandler_disabled())
>                 goto no_context;
>
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -       if (address >= TASK_SIZE)
> -               goto vmalloc_fault;
> -#endif
>         if (user_mode(regs))
>                 flags |= FAULT_FLAG_USER;
>         perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
> @@ -288,24 +284,4 @@ retry:
>                                                : "access violation");
>         force_sig_fault(SIGSEGV, si_code, (void __user *) address);
>         return;
> -
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> - vmalloc_fault:
> -       if (user_mode(regs))
> -               goto do_sigsegv;
> -       else {
> -               /* Synchronize this task's top level page-table
> -                  with the "reference" page table from init.  */
> -               long index = pgd_index(address);
> -               pgd_t *pgd, *pgd_k;
> -
> -               pgd = current->active_mm->pgd + index;
> -               pgd_k = swapper_pg_dir + index;
> -               if (!pgd_present(*pgd) && pgd_present(*pgd_k)) {
> -                       pgd_val(*pgd) = pgd_val(*pgd_k);
> -                       return;
> -               }
> -               goto no_context;
> -       }
> -#endif
>  }
> --- a/arch/alpha/mm/init.c~alpha-cleanup-dead-alpha_large_vmalloc
> +++ a/arch/alpha/mm/init.c
> @@ -45,12 +45,7 @@ pgd_alloc(struct mm_struct *mm)
>         ret = __pgd_alloc(mm, 0);
>         init = pgd_offset(&init_mm, 0UL);
>         if (ret) {
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -               memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
> -                       (PTRS_PER_PGD - USER_PTRS_PER_PGD - 1)*sizeof(pgd_t));
> -#else
>                 pgd_val(ret[PTRS_PER_PGD-2]) = pgd_val(init[PTRS_PER_PGD-2]);
> -#endif
>
>                 /* The last PGD entry is the VPTB self-map.  */
>                 pgd_val(ret[PTRS_PER_PGD-1])
> @@ -147,9 +142,8 @@ callback_init(void * kernel_end)
>            On systems with larger consoles, additional pages will be
>            allocated as needed during the mapping process.
>
> -          In the case of not SRM, but not CONFIG_ALPHA_LARGE_VMALLOC,
> -          we need to allocate the PGD we use for vmalloc before we start
> -          forking other tasks.  */
> +          With or without SRM, the vmalloc PGD entry must be set up early
> +          so pgd_alloc() can copy it into each new address space.  */
>
>         two_pages = (void *)
>           (((unsigned long)kernel_end + ~PAGE_MASK) & PAGE_MASK);
> _
>
> Patches currently in -mm which might be from julianbraha@gmail.com are
>
> alpha-cleanup-dead-alpha_large_vmalloc.patch
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch
  2026-12-03 22:25   ` Magnus Lindholm
@ 2026-12-03 22:35     ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2026-12-03 22:35 UTC (permalink / raw)
  To: Magnus Lindholm
  Cc: mm-commits, viro, rppt, richard.henderson, qi.zheng, julian.braha,
	joao, geert, catalin.marinas, julianbraha

On Thu, 3 Dec 2026 23:25:05 +0100 Magnus Lindholm <linmag7@gmail.com> wrote:

> >
> 
> Julian posted v2 of the Alpha ALPHA_LARGE_VMALLOC cleanup. I'm
> reviewing it as well as testing it now on my ES40.

Great.

> Were you planning to take this through the -mm tree? That route works
> for me and if so, I'll leave it out of the Alpha tree.

oops, sorry, I was assuming there was no alpha tree!

Let me drop that patch ;)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [obsolete] alpha-cleanup-dead-alpha_large_vmalloc.patch removed from -mm tree
  2026-12-03 16:58 [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Julian Braha
  2026-12-03 18:23 ` + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch Andrew Morton
@ 2026-12-03 22:36 ` Andrew Morton
  2026-12-04 15:44 ` [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Magnus Lindholm
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2026-12-03 22:36 UTC (permalink / raw)
  To: mm-commits, viro, rppt, richard.henderson, qi.zheng, linmag7,
	julian.braha, joao, geert, catalin.marinas, julianbraha, akpm


The quilt patch titled
     Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
has been removed from the -mm tree.  Its filename was
     alpha-cleanup-dead-alpha_large_vmalloc.patch

This patch was dropped because it is obsolete

------------------------------------------------------
From: Julian Braha <julianbraha@gmail.com>
Subject: alpha: cleanup dead ALPHA_LARGE_VMALLOC
Date: Thu,  3 Dec 2026 16:58:51 +0000

Currently, the ALPHA_LARGE_VMALLOC config option can never be enabled,
meaning that all references to it are dead code.

As Al explained [1], the code for a larger vmalloc area set up only the
first PGD slot at boot.  It added PGD entries on demand and relied on the
page fault handler to copy a missing entry into the faulting address
space.  That synchronization was racy.

The 8 GiB vmalloc area fits in one PGD slot.  callback_init() sets up that
entry at boot, and pgd_alloc() copies it into each new address space. 
Later vmalloc updates use the lower-level page tables that all address
spaces share.

Let's remove this dead option and its associated code.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

Link: https://patch.msgid.link/20261203165851.2505535-1-julianbraha@gmail.com
Link: https://lore.kernel.org/all/20251130030146.GN3538@ZenIV/ [1]
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Julian Braha <julian.braha@gmail.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: <joao@joaoff.com>

 arch/alpha/Kconfig               |   15 ---------------
 arch/alpha/include/asm/pgtable.h |    4 ----
 arch/alpha/mm/fault.c            |   24 ------------------------
 arch/alpha/mm/init.c             |   10 ++--------
 4 files changed, 2 insertions(+), 51 deletions(-)

--- a/arch/alpha/include/asm/pgtable.h~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/include/asm/pgtable.h
@@ -50,11 +50,7 @@ struct vm_area_struct;
 /* Number of pointers that fit on a page:  this will go away. */
 #define PTRS_PER_PAGE	(1UL << (PAGE_SHIFT-3))
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-#define VMALLOC_START		0xfffffe0000000000
-#else
 #define VMALLOC_START		(-2*PGDIR_SIZE)
-#endif
 #define VMALLOC_END		(-PGDIR_SIZE)
 
 /*
--- a/arch/alpha/Kconfig~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/Kconfig
@@ -521,21 +521,6 @@ config ALPHA_WTINT
 
 	  If unsure, say N.
 
-# LARGE_VMALLOC is racy, if you *really* need it then fix it first
-config ALPHA_LARGE_VMALLOC
-	bool
-	help
-	  Process creation and other aspects of virtual memory management can
-	  be streamlined if we restrict the kernel to one PGD for all vmalloc
-	  allocations.  This equates to about 8GB.
-
-	  Under normal circumstances, this is so far and above what is needed
-	  as to be laughable.  However, there are certain applications (such
-	  as benchmark-grade in-kernel web serving) that can make use of as
-	  much vmalloc space as is available.
-
-	  Say N unless you know you need gobs and gobs of vmalloc space.
-
 config VERBOSE_MCHECK
 	bool "Verbose Machine Checks"
 
--- a/arch/alpha/mm/fault.c~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/mm/fault.c
@@ -152,10 +152,6 @@ do_page_fault(unsigned long address, uns
 	if (!mm || faulthandler_disabled())
 		goto no_context;
 
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-	if (address >= TASK_SIZE)
-		goto vmalloc_fault;
-#endif
 	if (user_mode(regs))
 		flags |= FAULT_FLAG_USER;
 	perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
@@ -288,24 +284,4 @@ retry:
 					       : "access violation");
 	force_sig_fault(SIGSEGV, si_code, (void __user *) address);
 	return;
-
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
- vmalloc_fault:
-	if (user_mode(regs))
-		goto do_sigsegv;
-	else {
-		/* Synchronize this task's top level page-table
-		   with the "reference" page table from init.  */
-		long index = pgd_index(address);
-		pgd_t *pgd, *pgd_k;
-
-		pgd = current->active_mm->pgd + index;
-		pgd_k = swapper_pg_dir + index;
-		if (!pgd_present(*pgd) && pgd_present(*pgd_k)) {
-			pgd_val(*pgd) = pgd_val(*pgd_k);
-			return;
-		}
-		goto no_context;
-	}
-#endif
 }
--- a/arch/alpha/mm/init.c~alpha-cleanup-dead-alpha_large_vmalloc
+++ a/arch/alpha/mm/init.c
@@ -45,12 +45,7 @@ pgd_alloc(struct mm_struct *mm)
 	ret = __pgd_alloc(mm, 0);
 	init = pgd_offset(&init_mm, 0UL);
 	if (ret) {
-#ifdef CONFIG_ALPHA_LARGE_VMALLOC
-		memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
-			(PTRS_PER_PGD - USER_PTRS_PER_PGD - 1)*sizeof(pgd_t));
-#else
 		pgd_val(ret[PTRS_PER_PGD-2]) = pgd_val(init[PTRS_PER_PGD-2]);
-#endif
 
 		/* The last PGD entry is the VPTB self-map.  */
 		pgd_val(ret[PTRS_PER_PGD-1])
@@ -147,9 +142,8 @@ callback_init(void * kernel_end)
 	   On systems with larger consoles, additional pages will be
 	   allocated as needed during the mapping process.
 
-	   In the case of not SRM, but not CONFIG_ALPHA_LARGE_VMALLOC,
-	   we need to allocate the PGD we use for vmalloc before we start
-	   forking other tasks.  */
+	   With or without SRM, the vmalloc PGD entry must be set up early
+	   so pgd_alloc() can copy it into each new address space.  */
 
 	two_pages = (void *)
 	  (((unsigned long)kernel_end + ~PAGE_MASK) & PAGE_MASK);
_

Patches currently in -mm which might be from julianbraha@gmail.com are



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC
  2026-12-03 16:58 [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Julian Braha
  2026-12-03 18:23 ` + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch Andrew Morton
  2026-12-03 22:36 ` [obsolete] alpha-cleanup-dead-alpha_large_vmalloc.patch removed from -mm tree Andrew Morton
@ 2026-12-04 15:44 ` Magnus Lindholm
  2 siblings, 0 replies; 6+ messages in thread
From: Magnus Lindholm @ 2026-12-04 15:44 UTC (permalink / raw)
  To: Julian Braha
  Cc: richard.henderson, qi.zheng, akpm, viro, geert, catalin.marinas,
	rppt, joao, linux-alpha, linux-kernel, kernel-janitors,
	Matt Turner

Hi Julian

On Thu, Dec 3, 2026 at 5:58 PM Julian Braha <julianbraha@gmail.com> wrote:
>
> Currently, the ALPHA_LARGE_VMALLOC config option can never be enabled,
> meaning that all references to it are dead code.
>
> As Al explained [1], the code for a larger vmalloc area set up only the
> first PGD slot at boot. It added PGD entries on demand and relied on the
> page fault handler to copy a missing entry into the faulting address
> space. That synchronization was racy.
>
> The 8 GiB vmalloc area fits in one PGD slot. callback_init() sets up that
> entry at boot, and pgd_alloc() copies it into each new address space.
> Later vmalloc updates use the lower-level page tables that all address
> spaces share.
>
> Let's remove this dead option and its associated code.
>
> This dead code was found by kconfirm, a static analysis tool for Kconfig.
>
> Link: https://lore.kernel.org/all/20251130030146.GN3538@ZenIV/ [1]
> Signed-off-by: Julian Braha <julianbraha@gmail.com>
> ---
> Changes since v1:
> - add Al's rationale and link to RFC (Magnus)
> - clarify comment in callback_init() (Magnus)
>
> Link to v1:
> https://lore.kernel.org/all/20260816143835.1068971-1-julianbraha@gmail.com/
> ---
>  arch/alpha/Kconfig               | 15 ---------------
>  arch/alpha/include/asm/pgtable.h |  4 ----
>  arch/alpha/mm/fault.c            | 24 ------------------------
>  arch/alpha/mm/init.c             | 10 ++--------
>  4 files changed, 2 insertions(+), 51 deletions(-)
>
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 79700e350603..e78174c8d990 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -520,21 +520,6 @@ config ALPHA_WTINT
>
>           If unsure, say N.
>
> -# LARGE_VMALLOC is racy, if you *really* need it then fix it first
> -config ALPHA_LARGE_VMALLOC
> -       bool
> -       help
> -         Process creation and other aspects of virtual memory management can
> -         be streamlined if we restrict the kernel to one PGD for all vmalloc
> -         allocations.  This equates to about 8GB.
> -
> -         Under normal circumstances, this is so far and above what is needed
> -         as to be laughable.  However, there are certain applications (such
> -         as benchmark-grade in-kernel web serving) that can make use of as
> -         much vmalloc space as is available.
> -
> -         Say N unless you know you need gobs and gobs of vmalloc space.
> -
>  config VERBOSE_MCHECK
>         bool "Verbose Machine Checks"
>
> diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
> index e96fcafc3f00..afedfda13543 100644
> --- a/arch/alpha/include/asm/pgtable.h
> +++ b/arch/alpha/include/asm/pgtable.h
> @@ -50,11 +50,7 @@ struct vm_area_struct;
>  /* Number of pointers that fit on a page:  this will go away. */
>  #define PTRS_PER_PAGE  (1UL << (PAGE_SHIFT-3))
>
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -#define VMALLOC_START          0xfffffe0000000000
> -#else
>  #define VMALLOC_START          (-2*PGDIR_SIZE)
> -#endif
>  #define VMALLOC_END            (-PGDIR_SIZE)
>
>  /*
> diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
> index a46553b5e7d9..1d49776333d6 100644
> --- a/arch/alpha/mm/fault.c
> +++ b/arch/alpha/mm/fault.c
> @@ -153,10 +153,6 @@ handle_page_fault(unsigned long address, unsigned long mmcsr,
>         if (!mm || faulthandler_disabled())
>                 goto no_context;
>
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -       if (address >= TASK_SIZE)
> -               goto vmalloc_fault;
> -#endif
>         if (user_mode(regs))
>                 flags |= FAULT_FLAG_USER;
>         perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
> @@ -289,26 +285,6 @@ handle_page_fault(unsigned long address, unsigned long mmcsr,
>                                                : "access violation");
>         force_sig_fault(SIGSEGV, si_code, (void __user *) address);
>         return;
> -
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> - vmalloc_fault:
> -       if (user_mode(regs))
> -               goto do_sigsegv;
> -       else {
> -               /* Synchronize this task's top level page-table
> -                  with the "reference" page table from init.  */
> -               long index = pgd_index(address);
> -               pgd_t *pgd, *pgd_k;
> -
> -               pgd = current->active_mm->pgd + index;
> -               pgd_k = swapper_pg_dir + index;
> -               if (!pgd_present(*pgd) && pgd_present(*pgd_k)) {
> -                       pgd_val(*pgd) = pgd_val(*pgd_k);
> -                       return;
> -               }
> -               goto no_context;
> -       }
> -#endif
>  }
>
>  asmlinkage noinstr void
> diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
> index 6c28947d6e2d..d6b9b8418543 100644
> --- a/arch/alpha/mm/init.c
> +++ b/arch/alpha/mm/init.c
> @@ -45,12 +45,7 @@ pgd_alloc(struct mm_struct *mm)
>         ret = __pgd_alloc(mm, 0);
>         init = pgd_offset(&init_mm, 0UL);
>         if (ret) {
> -#ifdef CONFIG_ALPHA_LARGE_VMALLOC
> -               memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
> -                       (PTRS_PER_PGD - USER_PTRS_PER_PGD - 1)*sizeof(pgd_t));
> -#else
>                 pgd_val(ret[PTRS_PER_PGD-2]) = pgd_val(init[PTRS_PER_PGD-2]);
> -#endif
>
>                 /* The last PGD entry is the VPTB self-map.  */
>                 pgd_val(ret[PTRS_PER_PGD-1])
> @@ -147,9 +142,8 @@ callback_init(void * kernel_end)
>            On systems with larger consoles, additional pages will be
>            allocated as needed during the mapping process.
>
> -          In the case of not SRM, but not CONFIG_ALPHA_LARGE_VMALLOC,
> -          we need to allocate the PGD we use for vmalloc before we start
> -          forking other tasks.  */
> +          With or without SRM, the vmalloc PGD entry must be set up early
> +          so pgd_alloc() can copy it into each new address space.  */
>
>         two_pages = (void *)
>           (((unsigned long)kernel_end + ~PAGE_MASK) & PAGE_MASK);
> --
> 2.56.0
>

Thanks for the update. Built and boot-tested on my three-CPU ES40.
A vmalloc/fork stress test passed across all three CPUs: 3,300 forked
processes and 13,200 allocation/check/free cycles, checking mappings
created before and after fork. No failures or new kernel errors.

Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Magnus Lindholm <linmag7@gmail.com>

Thanks,
Magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-04 15:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:58 [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Julian Braha
2026-12-03 18:23 ` + alpha-cleanup-dead-alpha_large_vmalloc.patch added to mm-nonmm-unstable branch Andrew Morton
2026-12-03 22:25   ` Magnus Lindholm
2026-12-03 22:35     ` Andrew Morton
2026-12-03 22:36 ` [obsolete] alpha-cleanup-dead-alpha_large_vmalloc.patch removed from -mm tree Andrew Morton
2026-12-04 15:44 ` [PATCH v2] alpha: cleanup dead ALPHA_LARGE_VMALLOC Magnus Lindholm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.