* [PATCH 1/6] csky: remove BS check for FAULT_FLAG_ALLOW_RETRY
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
@ 2025-09-11 1:52 ` Al Viro
2025-09-11 2:55 ` Guo Ren
2025-09-11 1:53 ` [PATCH 2/6][alpha,m68k,openrisc] PAGE_PTR() had been last used outside of arch/* in 1.1.94 Al Viro
` (4 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:52 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
flags are initialized as FAULT_FLAG_DEFAULT, and the only thing done
to that afterwards is |=; since FAULT_FLAG_DEFAULT already includes
FAULT_FLAG_ALLOW_RETRY, it's guaranteed to remain there all along.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/csky/mm/fault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
index a885518ce1dd..a6ca7dff4215 100644
--- a/arch/csky/mm/fault.c
+++ b/arch/csky/mm/fault.c
@@ -277,7 +277,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
if (fault & VM_FAULT_COMPLETED)
return;
- if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
+ if (unlikely(fault & VM_FAULT_RETRY)) {
flags |= FAULT_FLAG_TRIED;
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 1/6] csky: remove BS check for FAULT_FLAG_ALLOW_RETRY
2025-09-11 1:52 ` [PATCH 1/6] csky: remove BS check for FAULT_FLAG_ALLOW_RETRY Al Viro
@ 2025-09-11 2:55 ` Guo Ren
0 siblings, 0 replies; 11+ messages in thread
From: Guo Ren @ 2025-09-11 2:55 UTC (permalink / raw)
To: Al Viro
Cc: linux-arch, Arnd Bergmann, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
On Thu, Sep 11, 2025 at 9:52 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> flags are initialized as FAULT_FLAG_DEFAULT, and the only thing done
> to that afterwards is |=; since FAULT_FLAG_DEFAULT already includes
> FAULT_FLAG_ALLOW_RETRY, it's guaranteed to remain there all along.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> arch/csky/mm/fault.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
> index a885518ce1dd..a6ca7dff4215 100644
> --- a/arch/csky/mm/fault.c
> +++ b/arch/csky/mm/fault.c
> @@ -277,7 +277,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
> if (fault & VM_FAULT_COMPLETED)
> return;
>
> - if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
> + if (unlikely(fault & VM_FAULT_RETRY)) {
Yes, FAULT_FLAG_ALLOW_RETRY is unnecessary.
LGTM!
Reviewed-by: Guo Ren (Alibaba Damo Academy) <guoren@kernel.org>
> flags |= FAULT_FLAG_TRIED;
>
> /*
> --
> 2.47.2
>
--
Best Regards
Guo Ren
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/6][alpha,m68k,openrisc] PAGE_PTR() had been last used outside of arch/* in 1.1.94
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
2025-09-11 1:52 ` [PATCH 1/6] csky: remove BS check for FAULT_FLAG_ALLOW_RETRY Al Viro
@ 2025-09-11 1:53 ` Al Viro
2025-09-11 7:29 ` Geert Uytterhoeven
2025-09-11 1:53 ` [PATCH 3/6][openrisc] SET_PAGE_DIR() users had been gone since 2.3.12pre1 Al Viro
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:53 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
.. and in arch/* - circa 2.2.7.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/alpha/include/asm/pgtable.h | 13 -------------
arch/m68k/include/asm/pgtable_mm.h | 10 ----------
arch/openrisc/include/asm/pgtable.h | 14 --------------
3 files changed, 37 deletions(-)
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 44e7aedac6e8..ae2bdbeec91c 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -141,19 +141,6 @@ extern unsigned long __zero_page(void);
#define BAD_PAGE __bad_page()
#define ZERO_PAGE(vaddr) (virt_to_page(ZERO_PGE))
-/* number of bits that fit into a memory pointer */
-#define BITS_PER_PTR (8*sizeof(unsigned long))
-
-/* to align the pointer to a pointer address */
-#define PTR_MASK (~(sizeof(void*)-1))
-
-/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
-#define SIZEOF_PTR_LOG2 3
-
-/* to find an entry in a page-table */
-#define PAGE_PTR(address) \
- ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
-
/*
* On certain platforms whose physical address space can overlap KSEG,
* namely EV6 and above, we must re-twiddle the physaddr to restore the
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
index 62f2ff4e6799..bba64a9c49ac 100644
--- a/arch/m68k/include/asm/pgtable_mm.h
+++ b/arch/m68k/include/asm/pgtable_mm.h
@@ -119,16 +119,6 @@ extern void *empty_zero_page;
*/
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
-/* number of bits that fit into a memory pointer */
-#define BITS_PER_PTR (8*sizeof(unsigned long))
-
-/* to align the pointer to a pointer address */
-#define PTR_MASK (~(sizeof(void*)-1))
-
-/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
-/* 64-bit machines, beware! SRB. */
-#define SIZEOF_PTR_LOG2 2
-
extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
/*
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index d33702831505..138f46fc838b 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -183,20 +183,6 @@ extern void paging_init(void);
extern unsigned long empty_zero_page[2048];
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
-/* number of bits that fit into a memory pointer */
-#define BITS_PER_PTR (8*sizeof(unsigned long))
-
-/* to align the pointer to a pointer address */
-#define PTR_MASK (~(sizeof(void *)-1))
-
-/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
-/* 64-bit machines, beware! SRB. */
-#define SIZEOF_PTR_LOG2 2
-
-/* to find an entry in a page-table */
-#define PAGE_PTR(address) \
-((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
-
/* to set the page-dir */
#define SET_PAGE_DIR(tsk, pgdir)
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 2/6][alpha,m68k,openrisc] PAGE_PTR() had been last used outside of arch/* in 1.1.94
2025-09-11 1:53 ` [PATCH 2/6][alpha,m68k,openrisc] PAGE_PTR() had been last used outside of arch/* in 1.1.94 Al Viro
@ 2025-09-11 7:29 ` Geert Uytterhoeven
0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-09-11 7:29 UTC (permalink / raw)
To: Al Viro
Cc: linux-arch, Arnd Bergmann, Guo Ren, linux-alpha, Michal Simek,
Max Filippov, Jonas Bonn
On Thu, 11 Sept 2025 at 03:53, Al Viro <viro@zeniv.linux.org.uk> wrote:
> .. and in arch/* - circa 2.2.7.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> arch/alpha/include/asm/pgtable.h | 13 -------------
> arch/m68k/include/asm/pgtable_mm.h | 10 ----------
> arch/openrisc/include/asm/pgtable.h | 14 --------------
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
(I would have just taken it if it wasn't mixed with non-m68k stuff ;-)
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] 11+ messages in thread
* [PATCH 3/6][openrisc] SET_PAGE_DIR() users had been gone since 2.3.12pre1
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
2025-09-11 1:52 ` [PATCH 1/6] csky: remove BS check for FAULT_FLAG_ALLOW_RETRY Al Viro
2025-09-11 1:53 ` [PATCH 2/6][alpha,m68k,openrisc] PAGE_PTR() had been last used outside of arch/* in 1.1.94 Al Viro
@ 2025-09-11 1:53 ` Al Viro
2025-09-11 1:54 ` [PATCH 4/6] alpha: get rid of the remnants of BAD_PAGE and friends Al Viro
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:53 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/openrisc/include/asm/pgtable.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index 138f46fc838b..b218050e2f6d 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -183,9 +183,6 @@ extern void paging_init(void);
extern unsigned long empty_zero_page[2048];
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
-/* to set the page-dir */
-#define SET_PAGE_DIR(tsk, pgdir)
-
#define pte_none(x) (!pte_val(x))
#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
#define pte_clear(mm, addr, xp) do { pte_val(*(xp)) = 0; } while (0)
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 4/6] alpha: get rid of the remnants of BAD_PAGE and friends
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
` (2 preceding siblings ...)
2025-09-11 1:53 ` [PATCH 3/6][openrisc] SET_PAGE_DIR() users had been gone since 2.3.12pre1 Al Viro
@ 2025-09-11 1:54 ` Al Viro
2025-09-11 1:54 ` [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR Al Viro
2025-09-11 1:55 ` [PATCH 6/6] alpha: unobfuscate _PAGE_P() definition Al Viro
5 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:54 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
unused since 2.4 times...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/alpha/include/asm/pgtable.h | 10 ----------
arch/alpha/mm/init.c | 27 ---------------------------
2 files changed, 37 deletions(-)
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index ae2bdbeec91c..84014e9be504 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -126,19 +126,9 @@ struct vm_area_struct;
#define pgprot_noncached(prot) (prot)
/*
- * BAD_PAGETABLE is used when we need a bogus page-table, while
- * BAD_PAGE is used for a bogus page.
- *
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
-extern pte_t __bad_page(void);
-extern pmd_t * __bad_pagetable(void);
-
-extern unsigned long __zero_page(void);
-
-#define BAD_PAGETABLE __bad_pagetable()
-#define BAD_PAGE __bad_page()
#define ZERO_PAGE(vaddr) (virt_to_page(ZERO_PGE))
/*
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 2d491b8cdab9..4c5ab9cd8a0a 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -60,33 +60,6 @@ pgd_alloc(struct mm_struct *mm)
}
-/*
- * BAD_PAGE is the page that is used for page faults when linux
- * is out-of-memory. Older versions of linux just did a
- * do_exit(), but using this instead means there is less risk
- * for a process dying in kernel mode, possibly leaving an inode
- * unused etc..
- *
- * BAD_PAGETABLE is the accompanying page-table: it is initialized
- * to point to BAD_PAGE entries.
- *
- * ZERO_PAGE is a special page that is used for zero-initialized
- * data and COW.
- */
-pmd_t *
-__bad_pagetable(void)
-{
- memset(absolute_pointer(EMPTY_PGT), 0, PAGE_SIZE);
- return (pmd_t *) EMPTY_PGT;
-}
-
-pte_t
-__bad_page(void)
-{
- memset(absolute_pointer(EMPTY_PGE), 0, PAGE_SIZE);
- return pte_mkdirty(mk_pte(virt_to_page(EMPTY_PGE), PAGE_SHARED));
-}
-
static inline unsigned long
load_PCB(struct pcb_struct *pcb)
{
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
` (3 preceding siblings ...)
2025-09-11 1:54 ` [PATCH 4/6] alpha: get rid of the remnants of BAD_PAGE and friends Al Viro
@ 2025-09-11 1:54 ` Al Viro
2025-09-11 14:57 ` Max Filippov
2025-09-15 6:42 ` Michal Simek
2025-09-11 1:55 ` [PATCH 6/6] alpha: unobfuscate _PAGE_P() definition Al Viro
5 siblings, 2 replies; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:54 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
dead since 2005, time to bury the body...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/microblaze/include/asm/pgtable.h | 1 -
arch/xtensa/include/asm/pgtable.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index bae1abfa6f6b..ec10ec9ca639 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -99,7 +99,6 @@ extern pte_t *va_to_pte(unsigned long address);
#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT))
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
-#define FIRST_USER_PGD_NR 0
#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
#define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS)
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index d6eb695f2b26..50a136213b2b 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -58,7 +58,6 @@
#define PTRS_PER_PTE_SHIFT 10
#define PTRS_PER_PGD 1024
#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
-#define FIRST_USER_PGD_NR (FIRST_USER_ADDRESS >> PGDIR_SHIFT)
#ifdef CONFIG_MMU
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR
2025-09-11 1:54 ` [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR Al Viro
@ 2025-09-11 14:57 ` Max Filippov
2025-09-15 6:42 ` Michal Simek
1 sibling, 0 replies; 11+ messages in thread
From: Max Filippov @ 2025-09-11 14:57 UTC (permalink / raw)
To: Al Viro
Cc: linux-arch, Arnd Bergmann, Guo Ren, linux-alpha,
Geert Uytterhoeven, Michal Simek, Jonas Bonn
On Wed, Sep 10, 2025 at 6:54 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> dead since 2005, time to bury the body...
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> arch/microblaze/include/asm/pgtable.h | 1 -
> arch/xtensa/include/asm/pgtable.h | 1 -
> 2 files changed, 2 deletions(-)
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR
2025-09-11 1:54 ` [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR Al Viro
2025-09-11 14:57 ` Max Filippov
@ 2025-09-15 6:42 ` Michal Simek
1 sibling, 0 replies; 11+ messages in thread
From: Michal Simek @ 2025-09-15 6:42 UTC (permalink / raw)
To: Al Viro, linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Max Filippov, Jonas Bonn
On 9/11/25 03:54, Al Viro wrote:
> dead since 2005, time to bury the body...
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> arch/microblaze/include/asm/pgtable.h | 1 -
Reviewed-by: Michal Simek <michal.simek@amd.com> # microblaze
Thanks
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs
TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 6/6] alpha: unobfuscate _PAGE_P() definition
2025-09-11 1:51 [PATCHES] misc dead code removals in arch/* - mostly asm/pgtable.h Al Viro
` (4 preceding siblings ...)
2025-09-11 1:54 ` [PATCH 5/6][microblaze,xtensa] kill FIRST_USER_PGD_NR Al Viro
@ 2025-09-11 1:55 ` Al Viro
5 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2025-09-11 1:55 UTC (permalink / raw)
To: linux-arch
Cc: Arnd Bergmann, Guo Ren, linux-alpha, Geert Uytterhoeven,
Michal Simek, Max Filippov, Jonas Bonn
Way, way back it used to be
_PAGE_NORMAL((x) | ((x & _PAGE_FOW) ? 0 : _PAGE_FOW | _PAGE_COW))
Then (in 1.3.54) _PAGE_COW had died. Result:
_PAGE_NORMAL((x) | ((x & _PAGE_FOW) ? 0 : _PAGE_FOW))
which is somewhat... obscure. What it does is simply
_PAGE_NORMAL((x) | _PAGE_FOW)
and IMO that's easier to follow.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
arch/alpha/include/asm/pgtable.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 84014e9be504..90e7a9539102 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -107,7 +107,7 @@ struct vm_area_struct;
#define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | (x))
-#define _PAGE_P(x) _PAGE_NORMAL((x) | (((x) & _PAGE_FOW)?0:_PAGE_FOW))
+#define _PAGE_P(x) _PAGE_NORMAL((x) | _PAGE_FOW)
#define _PAGE_S(x) _PAGE_NORMAL(x)
/*
--
2.47.2
^ permalink raw reply related [flat|nested] 11+ messages in thread