Skip to contentSkip to conversation

mm: MISC follow-up patches for linux/pgalloc.h

PATCH Superseded Harry Yoo 5 participants 16 messages Oct 19, 2025 – Oct 21, 2025

Subsystems (14)
Memory management VFS MM core RISC-V +10 more subsystems

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Harry Yoo

author
#0 lore raw

cover mm: MISC follow-up patches for linux/pgalloc.h

Hi folks.

This is a follow-up patch series for the patch series named:
"[PATCH V5 mm-hotfixes 0/3] mm, x86: fix crash due to missing page table sync and make it harder to miss".

This is a follow-up for MM. For x86/mm specific cleanup patches, another follow-up series is planned.

Patch 1 creates a F: entry to MAINTAINERS file in MM CORE section. Patch 2 converts common code to include <linux/pgalloc.h> instead of <asm/pgalloc.h>

[1] https://lore.kernel.org/linux-mm/[email protected]/

Harry Yoo (2):
MAINTAINERS: add include/linux/pgalloc.h to MM CORE section
treewide: include linux/pgalloc.h instead of asm/pgalloc.h

 MAINTAINERS                          | 1 +
 drivers/firmware/efi/arm-runtime.c   | 2 +-
 drivers/firmware/efi/riscv-runtime.c | 2 +-
 drivers/s390/char/sclp_sd.c          | 3 +--
 fs/dax.c                             | 2 +-
 kernel/fork.c                        | 2 +-
 mm/debug_vm_pgtable.c                | 2 +-
 mm/filemap.c                         | 2 +-
 mm/huge_memory.c                     | 2 +-
 mm/hugetlb.c                         | 2 +-
 mm/hugetlb_vmemmap.c                 | 2 +-
 mm/khugepaged.c                      | 2 +-
 mm/memory.c                          | 2 +-
 mm/mmu_gather.c                      | 2 +-
 mm/mremap.c                          | 2 +-
 mm/pgtable-generic.c                 | 2 +-
 mm/pt_reclaim.c                      | 2 +-
 17 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/2 MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h
 F:	include/linux/ptdump.h
 F:	include/linux/vmpressure.h
 F:	include/linux/vmstat.h
Signature · 1 line
2.43.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 13 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Thanks,
SJ

[...]

author
#3 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 9 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks!

Quoted 4 lines
Quoted 4 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 9 lines
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

Quoted 4 lines

Thanks,
SJ

[...]

Signature · 2 lines
Cheers,
Harry / Hyeonggon
#4 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 29 lines · Harry Yoo
Quoted 9 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks!

Quoted 4 lines
Quoted 4 lines
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 9 lines
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
  F:	include/linux/mmu_notifier.h
  F:	include/linux/pagewalk.h
  F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Quoted 3 lines

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

I think we usually try to sort alphabetically here.

Signature · 3 lines
Cheers

David / dhildenb
author
#5 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 30 lines · David Hildenbrand
Quoted 29 lines · Harry Yoo
Quoted 9 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks!

Quoted 15 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 13 lines
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
  F:	include/linux/mmu_notifier.h
  F:	include/linux/pagewalk.h
  F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Quoted 5 lines
Quoted 3 lines

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

I think we usually try to sort alphabetically here.

Thank you SJ and David, I'll sort it and resend in few days (unless Andrew prefers to adjust it)

Quoted 5 lines
Signature · 3 lines
Cheers

David / dhildenb
Signature · 2 lines
Cheers,
Harry / Hyeonggon
#6 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 31 lines · Harry Yoo
Quoted 30 lines · David Hildenbrand
Quoted 29 lines · Harry Yoo
Quoted 9 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks!

Quoted 15 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 13 lines
---
   MAINTAINERS | 1 +
   1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
   F:	include/linux/mmu_notifier.h
   F:	include/linux/pagewalk.h
   F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

I think we usually try to sort alphabetically here.

Thank you SJ and David, I'll sort it and resend in few days (unless Andrew prefers to adjust it)

Feel free to add my

Then!

Signature · 3 lines
Cheers

David / dhildenb
#7 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

In reply to Harry Yoo
Quoted 8 lines · Harry Yoo
Quoted 7 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks for adding, but please put before pgtable.h to fix the checkpatch warning.

With that done:

Quoted 21 lines
Quoted 2 lines

Thanks!

Quoted 4 lines
Quoted 4 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 9 lines
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Quoted 3 lines

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

No it's files too, checkpatch will tell you:

● checkpatch.pl: 262: WARNING: Misordered MAINTAINERS entry - list file patterns in alphabetic order

Quoted 10 lines
Quoted 5 lines

Thanks,
SJ

[...]

--
Cheers,
Harry / Hyeonggon

author
#8 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

Quoted 38 lines · Lorenzo Stoakes
Quoted 8 lines · Harry Yoo
Quoted 7 lines · SeongJae Park
Quoted 5 lines · On Sun, 19 Oct 2025 16:25:08 +0900 Harry Yoo <[email protected]> wrote:

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

Thanks for adding, but please put before pgtable.h to fix the checkpatch warning.

With that done:

Quoted 21 lines
Quoted 2 lines

Thanks!

Quoted 15 lines

MAINTAINERS F: include/linux/mmdebug.h · line 16252

Quoted 13 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h

Nit. Should we alphabetically sort?

Quoted 7 lines
Quoted 3 lines

TBH I have no idea.

I thought only subsystem names should be alphabetically sorted?

No it's files too, checkpatch will tell you:

● checkpatch.pl: 262: WARNING: Misordered MAINTAINERS entry - list file patterns in alphabetic order

*blaming myself for not running checkpatch*

Thanks, will fix it!

Signature · 2 lines
Cheers,
Harry / Hyeonggon
reviewer Acked-by on v1 1/2
#9 lore raw

Re: [PATCH V1 1/2] MAINTAINERS: add include/linux/pgalloc.h to MM CORE section

In reply to Harry Yoo
Quoted 5 lines · Harry Yoo

Since include/linux/pgtable.h is already listed in the MM CORE section, add it to the section as well to keep it maintained by the appropriate maintainers.

with the alphabetical sorting others mentioned :)

Quoted 19 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 46126ce2f968..dedb9525c2bc 100644
@@ -16249,6 +16249,7 @@ F:	include/linux/mmdebug.h
 F:	include/linux/mmu_notifier.h
 F:	include/linux/pagewalk.h
 F:	include/linux/pgtable.h
+F:	include/linux/pgalloc.h
 F:	include/linux/ptdump.h
 F:	include/linux/vmpressure.h
 F:	include/linux/vmstat.h
Signature · 1 line
2.43.0
Signature · 2 lines
Sincerely yours,
Mike.
author
#10 lore raw

PATCH 2/2 treewide: include linux/pgalloc.h instead of asm/pgalloc.h

In reply to Harry Yoo

For now, including <asm/pgalloc.h> instead of <linux/pgalloc.h> is technically fine unless the .c file calls p*d_populate_kernel() helper functions.

But it is a better practice to always include <linux/pgalloc.h>. Include <linux/pgalloc.h> instead of <asm/pgalloc.h> outside arch/.

---
 drivers/firmware/efi/arm-runtime.c   | 2 +-
 drivers/firmware/efi/riscv-runtime.c | 2 +-
 drivers/s390/char/sclp_sd.c          | 3 +--
 fs/dax.c                             | 2 +-
 kernel/fork.c                        | 2 +-
 mm/debug_vm_pgtable.c                | 2 +-
 mm/filemap.c                         | 2 +-
 mm/huge_memory.c                     | 2 +-
 mm/hugetlb.c                         | 2 +-
 mm/hugetlb_vmemmap.c                 | 2 +-
 mm/khugepaged.c                      | 2 +-
 mm/memory.c                          | 2 +-
 mm/mmu_gather.c                      | 2 +-
 mm/mremap.c                          | 2 +-
 mm/pgtable-generic.c                 | 2 +-
 mm/pt_reclaim.c                      | 2 +-
 16 files changed, 16 insertions(+), 17 deletions(-)
drivers/firmware/efi/arm-runtime.c +1 -1
index 83092d93f36a..2e3b5131df32 100644
@@ -19,11 +19,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
 #if defined(CONFIG_PTDUMP_DEBUGFS) || defined(CONFIG_ARM_PTDUMP_DEBUGFS)
 #include <asm/ptdump.h>
drivers/firmware/efi/riscv-runtime.c +1 -1
index fa71cd898120..5b8d72885fee 100644
@@ -21,11 +21,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
 static bool __init efi_virtmap_init(void)
 {
drivers/s390/char/sclp_sd.c +1 -2
index 129b89fe40a3..7a791cb35aea 100644
@@ -17,8 +17,7 @@
 #include <linux/vmalloc.h>
 #include <linux/async.h>
 #include <linux/mutex.h>
-
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #include "sclp.h"
 
fs/dax.c +1 -1
index 89f071ba7b10..1c78fc02462c 100644
@@ -24,7 +24,7 @@
 #include <linux/mmu_notifier.h>
 #include <linux/iomap.h>
 #include <linux/rmap.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/fs_dax.h>
kernel/fork.c +1 -1
index 3da0f08615a9..9d48646e659f 100644
@@ -107,7 +107,7 @@
 #include <linux/tick.h>
 #include <linux/unwind_deferred.h>
 
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
mm/debug_vm_pgtable.c +1 -1
index 830107b6dd08..25a823bddb92 100644
@@ -30,9 +30,9 @@
 #include <linux/sched/mm.h>
 #include <linux/io.h>
 #include <linux/vmalloc.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
-#include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
 
 /*
mm/filemap.c +1 -1
index 893ba49808b7..ffcdf4f81d0a 100644
@@ -48,7 +48,7 @@
 #include <linux/rcupdate_wait.h>
 #include <linux/sched/mm.h>
 #include <linux/sysctl.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlbflush.h>
 #include "internal.h"
 
mm/huge_memory.c +1 -1
index bfb52c564fb3..b4d18172cd53 100644
@@ -39,9 +39,9 @@
 #include <linux/compat.h>
 #include <linux/pgalloc_tag.h>
 #include <linux/pagewalk.h>
+#include <linux/pgalloc.h>
 
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 #include "internal.h"
 #include "swap.h"
 
mm/hugetlb.c +1 -1
index 86e672fcb305..1ea459723cce 100644
@@ -39,9 +39,9 @@
 #include <linux/memory.h>
 #include <linux/mm_inline.h>
 #include <linux/padata.h>
+#include <linux/pgalloc.h>
 
 #include <asm/page.h>
-#include <asm/pgalloc.h>
 #include <asm/tlb.h>
 #include <asm/setup.h>
 
mm/hugetlb_vmemmap.c +1 -1
index 96ee2bd16ee1..69d71e048e16 100644
@@ -15,7 +15,7 @@
 #include <linux/bootmem_info.h>
 #include <linux/mmdebug.h>
 #include <linux/pagewalk.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlbflush.h>
 #include "hugetlb_vmemmap.h"
 
mm/khugepaged.c +1 -1
index e947b96e1443..cb2245085879 100644
@@ -21,9 +21,9 @@
 #include <linux/shmem_fs.h>
 #include <linux/dax.h>
 #include <linux/ksm.h>
+#include <linux/pgalloc.h>
 
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 #include "internal.h"
 #include "mm_slot.h"
 
mm/memory.c +1 -1
index 19615bcf234f..449d3c312fcd 100644
@@ -80,7 +80,7 @@
 
 #include <asm/io.h>
 #include <asm/mmu_context.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
mm/mmu_gather.c +1 -1
index 374aa6f021c6..247e3f9db6c7 100644
@@ -9,8 +9,8 @@
 #include <linux/smp.h>
 #include <linux/swap.h>
 #include <linux/rmap.h>
+#include <linux/pgalloc.h>
 
-#include <asm/pgalloc.h>
 #include <asm/tlb.h>
 
 #ifndef CONFIG_MMU_GATHER_NO_GATHER
mm/mremap.c +1 -1
index bd7314898ec5..a7f531c17b79 100644
@@ -25,10 +25,10 @@
 #include <linux/uaccess.h>
 #include <linux/userfaultfd_k.h>
 #include <linux/mempolicy.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 
 #include "internal.h"
 
mm/pgtable-generic.c +1 -1
index 0c847cdf4fd3..7b50efe9c477 100644
@@ -13,7 +13,7 @@
 #include <linux/swap.h>
 #include <linux/swapops.h>
 #include <linux/mm_inline.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlb.h>
 
 /*
mm/pt_reclaim.c +1 -1
index 7e9455a18aae..ec6fe4eb2644 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
 #include <asm-generic/tlb.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #include "internal.h"
 
Signature · 1 line
2.43.0
Acked-by on v1 2/2
#11 lore raw

Re: [PATCH V1 2/2] treewide: include linux/pgalloc.h instead of asm/pgalloc.h

Quoted 9 lines · Harry Yoo

For now, including <asm/pgalloc.h> instead of <linux/pgalloc.h> is technically fine unless the .c file calls p*d_populate_kernel() helper functions.

But it is a better practice to always include <linux/pgalloc.h>. Include <linux/pgalloc.h> instead of <asm/pgalloc.h> outside arch/.

---

Signature · 3 lines
Cheers

David / dhildenb
Reviewed-by on v1 2/2
#12 lore raw

Re: [PATCH V1 2/2] treewide: include linux/pgalloc.h instead of asm/pgalloc.h

In reply to Harry Yoo
Quoted 8 lines · Harry Yoo

For now, including <asm/pgalloc.h> instead of <linux/pgalloc.h> is technically fine unless the .c file calls p*d_populate_kernel() helper functions.

But it is a better practice to always include <linux/pgalloc.h>. Include <linux/pgalloc.h> instead of <asm/pgalloc.h> outside arch/.

Thanks for this, LGTM so:

Quoted 252 lines
---
 drivers/firmware/efi/arm-runtime.c   | 2 +-
 drivers/firmware/efi/riscv-runtime.c | 2 +-
 drivers/s390/char/sclp_sd.c          | 3 +--
 fs/dax.c                             | 2 +-
 kernel/fork.c                        | 2 +-
 mm/debug_vm_pgtable.c                | 2 +-
 mm/filemap.c                         | 2 +-
 mm/huge_memory.c                     | 2 +-
 mm/hugetlb.c                         | 2 +-
 mm/hugetlb_vmemmap.c                 | 2 +-
 mm/khugepaged.c                      | 2 +-
 mm/memory.c                          | 2 +-
 mm/mmu_gather.c                      | 2 +-
 mm/mremap.c                          | 2 +-
 mm/pgtable-generic.c                 | 2 +-
 mm/pt_reclaim.c                      | 2 +-
 16 files changed, 16 insertions(+), 17 deletions(-)
drivers/firmware/efi/arm-runtime.c +1 -1
index 83092d93f36a..2e3b5131df32 100644
@@ -19,11 +19,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
 #if defined(CONFIG_PTDUMP_DEBUGFS) || defined(CONFIG_ARM_PTDUMP_DEBUGFS)
 #include <asm/ptdump.h>
drivers/firmware/efi/riscv-runtime.c +1 -1
index fa71cd898120..5b8d72885fee 100644
@@ -21,11 +21,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
 static bool __init efi_virtmap_init(void)
 {
drivers/s390/char/sclp_sd.c +1 -2
index 129b89fe40a3..7a791cb35aea 100644
@@ -17,8 +17,7 @@
 #include <linux/vmalloc.h>
 #include <linux/async.h>
 #include <linux/mutex.h>
-
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #include "sclp.h"
 
fs/dax.c +1 -1
index 89f071ba7b10..1c78fc02462c 100644
@@ -24,7 +24,7 @@
 #include <linux/mmu_notifier.h>
 #include <linux/iomap.h>
 #include <linux/rmap.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/fs_dax.h>
kernel/fork.c +1 -1
index 3da0f08615a9..9d48646e659f 100644
@@ -107,7 +107,7 @@
 #include <linux/tick.h>
 #include <linux/unwind_deferred.h>
 
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
mm/debug_vm_pgtable.c +1 -1
index 830107b6dd08..25a823bddb92 100644
@@ -30,9 +30,9 @@
 #include <linux/sched/mm.h>
 #include <linux/io.h>
 #include <linux/vmalloc.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
-#include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
 
 /*
mm/filemap.c +1 -1
index 893ba49808b7..ffcdf4f81d0a 100644
@@ -48,7 +48,7 @@
 #include <linux/rcupdate_wait.h>
 #include <linux/sched/mm.h>
 #include <linux/sysctl.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlbflush.h>
 #include "internal.h"
 
mm/huge_memory.c +1 -1
index bfb52c564fb3..b4d18172cd53 100644
@@ -39,9 +39,9 @@
 #include <linux/compat.h>
 #include <linux/pgalloc_tag.h>
 #include <linux/pagewalk.h>
+#include <linux/pgalloc.h>
 
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 #include "internal.h"
 #include "swap.h"
 
mm/hugetlb.c +1 -1
index 86e672fcb305..1ea459723cce 100644
@@ -39,9 +39,9 @@
 #include <linux/memory.h>
 #include <linux/mm_inline.h>
 #include <linux/padata.h>
+#include <linux/pgalloc.h>
 
 #include <asm/page.h>
-#include <asm/pgalloc.h>
 #include <asm/tlb.h>
 #include <asm/setup.h>
 
mm/hugetlb_vmemmap.c +1 -1
index 96ee2bd16ee1..69d71e048e16 100644
@@ -15,7 +15,7 @@
 #include <linux/bootmem_info.h>
 #include <linux/mmdebug.h>
 #include <linux/pagewalk.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlbflush.h>
 #include "hugetlb_vmemmap.h"
 
mm/khugepaged.c +1 -1
index e947b96e1443..cb2245085879 100644
@@ -21,9 +21,9 @@
 #include <linux/shmem_fs.h>
 #include <linux/dax.h>
 #include <linux/ksm.h>
+#include <linux/pgalloc.h>
 
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 #include "internal.h"
 #include "mm_slot.h"
 
mm/memory.c +1 -1
index 19615bcf234f..449d3c312fcd 100644
@@ -80,7 +80,7 @@
 
 #include <asm/io.h>
 #include <asm/mmu_context.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
mm/mmu_gather.c +1 -1
index 374aa6f021c6..247e3f9db6c7 100644
@@ -9,8 +9,8 @@
 #include <linux/smp.h>
 #include <linux/swap.h>
 #include <linux/rmap.h>
+#include <linux/pgalloc.h>
 
-#include <asm/pgalloc.h>
 #include <asm/tlb.h>
 
 #ifndef CONFIG_MMU_GATHER_NO_GATHER
mm/mremap.c +1 -1
index bd7314898ec5..a7f531c17b79 100644
@@ -25,10 +25,10 @@
 #include <linux/uaccess.h>
 #include <linux/userfaultfd_k.h>
 #include <linux/mempolicy.h>
+#include <linux/pgalloc.h>
 
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
-#include <asm/pgalloc.h>
 
 #include "internal.h"
 
mm/pgtable-generic.c +1 -1
index 0c847cdf4fd3..7b50efe9c477 100644
@@ -13,7 +13,7 @@
 #include <linux/swap.h>
 #include <linux/swapops.h>
 #include <linux/mm_inline.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <asm/tlb.h>
 
 /*
mm/pt_reclaim.c +1 -2
index 7e9455a18aae..ec6fe4eb2644 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
 #include <asm-generic/tlb.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 
 #include "internal.h"
 
--

2.43.0

reviewer Reviewed-by on v1 2/2
#13 lore raw

Re: [PATCH V1 2/2] treewide: include linux/pgalloc.h instead of asm/pgalloc.h

In reply to Harry Yoo
Quoted 32 lines · Harry Yoo

For now, including <asm/pgalloc.h> instead of <linux/pgalloc.h> is technically fine unless the .c file calls p*d_populate_kernel() helper functions.

But it is a better practice to always include <linux/pgalloc.h>. Include <linux/pgalloc.h> instead of <asm/pgalloc.h> outside arch/.

---
 drivers/firmware/efi/arm-runtime.c   | 2 +-
 drivers/firmware/efi/riscv-runtime.c | 2 +-
 drivers/s390/char/sclp_sd.c          | 3 +--
 fs/dax.c                             | 2 +-
 kernel/fork.c                        | 2 +-
 mm/debug_vm_pgtable.c                | 2 +-
 mm/filemap.c                         | 2 +-
 mm/huge_memory.c                     | 2 +-
 mm/hugetlb.c                         | 2 +-
 mm/hugetlb_vmemmap.c                 | 2 +-
 mm/khugepaged.c                      | 2 +-
 mm/memory.c                          | 2 +-
 mm/mmu_gather.c                      | 2 +-
 mm/mremap.c                          | 2 +-
 mm/pgtable-generic.c                 | 2 +-
 mm/pt_reclaim.c                      | 2 +-
 16 files changed, 16 insertions(+), 17 deletions(-)
drivers/firmware/efi/arm-runtime.c +0 -0
index 83092d93f36a..2e3b5131df32 100644

drivers/firmware/efi/arm-runtime.c line 22

Quoted 4 lines
drivers/firmware/efi/arm-runtime.c +1 -0
@@ -19,11 +19,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>

Looks like here the includes are sorted alphabetically, please keep it.

Quoted 12 lines
drivers/firmware/efi/arm-runtime.c +0 -1
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
 #if defined(CONFIG_PTDUMP_DEBUGFS) || defined(CONFIG_ARM_PTDUMP_DEBUGFS)
 #include <asm/ptdump.h>
drivers/firmware/efi/riscv-runtime.c +0 -0
index fa71cd898120..5b8d72885fee 100644

drivers/firmware/efi/riscv-runtime.c line 24

Quoted 4 lines
drivers/firmware/efi/riscv-runtime.c +1 -0
@@ -21,11 +21,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>

And here as well.

Quoted 4 lines
drivers/firmware/efi/riscv-runtime.c +0 -1
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>

...

kernel/fork.c line 111

Quoted 11 lines
kernel/fork.c +1 -1
index 3da0f08615a9..9d48646e659f 100644
@@ -107,7 +107,7 @@
 #include <linux/tick.h>
 #include <linux/unwind_deferred.h>
 
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>

I'd kill an empty line before include <linux/pgalloc.h> and add one here to separate include <asm/.

Quoted 2 lines
kernel/fork.c +0 -0
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>

...

mm/pt_reclaim.c line 4

Quoted 10 lines
mm/pt_reclaim.c +1 -1
index 7e9455a18aae..ec6fe4eb2644 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
 #include <asm-generic/tlb.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>

Please move it before include <asm-generic/tlb.h>

mm/pt_reclaim.c line 5

Quoted 1 line
mm/pt_reclaim.c +0 -0
 #include "internal.h"

With those fixed

Signature · 2 lines
Sincerely yours,
Mike.
author
#14 lore raw

Re: [PATCH V1 2/2] treewide: include linux/pgalloc.h instead of asm/pgalloc.h

Quoted 19 lines · Mike Rapoport
Quoted 18 lines · Harry Yoo

For now, including <asm/pgalloc.h> instead of <linux/pgalloc.h> is technically fine unless the .c file calls p*d_populate_kernel() helper functions.

But it is a better practice to always include <linux/pgalloc.h>. Include <linux/pgalloc.h> instead of <asm/pgalloc.h> outside arch/.

---
 drivers/firmware/efi/arm-runtime.c   | 2 +-
 drivers/firmware/efi/riscv-runtime.c | 2 +-
 drivers/s390/char/sclp_sd.c          | 3 +--
 fs/dax.c                             | 2 +-
 kernel/fork.c                        | 2 +-
 mm/debug_vm_pgtable.c                | 2 +-
 mm/filemap.c                         | 2 +-
 mm/huge_memory.c                     | 2 +-
 mm/hugetlb.c                         | 2 +-
Quoted 8 lines
Quoted 8 lines
 mm/hugetlb_vmemmap.c                 | 2 +-
 mm/khugepaged.c                      | 2 +-
 mm/memory.c                          | 2 +-
 mm/mmu_gather.c                      | 2 +-
 mm/mremap.c                          | 2 +-
 mm/pgtable-generic.c                 | 2 +-
 mm/pt_reclaim.c                      | 2 +-
 16 files changed, 16 insertions(+), 17 deletions(-)

Hi Mike, thanks for review.

I wasn't really sure if there are certain rules for header inclusion (yeah, they are not very consistent across different files...) but now that you mention it I can see them, thanks!

Quoted 11 lines

drivers/firmware/efi/arm-runtime.c line 22

Quoted 9 lines
drivers/firmware/efi/arm-runtime.c +1 -0
index 83092d93f36a..2e3b5131df32 100644
@@ -19,11 +19,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>

Looks like here the includes are sorted alphabetically, please keep it.

Will do.

Quoted 5 lines
Quoted 5 lines
drivers/firmware/efi/arm-runtime.c +0 -1
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>
 
Quoted 13 lines

drivers/firmware/efi/riscv-runtime.c line 24

Quoted 11 lines
drivers/firmware/efi/arm-runtime.c +0 -0
 #if defined(CONFIG_PTDUMP_DEBUGFS) || defined(CONFIG_ARM_PTDUMP_DEBUGFS)
 #include <asm/ptdump.h>
drivers/firmware/efi/riscv-runtime.c +1 -0
index fa71cd898120..5b8d72885fee 100644
@@ -21,11 +21,11 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/pgtable.h>
+#include <linux/pgalloc.h>

And here as well.

Will do.

Quoted 15 lines
Quoted 4 lines
drivers/firmware/efi/riscv-runtime.c +0 -1
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
 #include <asm/mmu.h>
-#include <asm/pgalloc.h>

...

Quoted 8 lines
kernel/fork.c +0 -0
index 3da0f08615a9..9d48646e659f 100644
@@ -107,7 +107,7 @@
 #include <linux/tick.h>
 #include <linux/unwind_deferred.h>
 
Quoted 6 lines

kernel/fork.c line 111

Quoted 3 lines
kernel/fork.c +1 -1
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>
 #include <linux/uaccess.h>

I'd kill an empty line before include <linux/pgalloc.h> and add one here to separate include <asm/.

That looks good and will do.

Quoted 5 lines
Quoted 2 lines
kernel/fork.c +0 -0
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>

...

Quoted 12 lines

mm/pt_reclaim.c line 4

Quoted 10 lines
mm/pt_reclaim.c +1 -1
index 7e9455a18aae..ec6fe4eb2644 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
 #include <asm-generic/tlb.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>

Please move it before include <asm-generic/tlb.h>

Will do, and in this case no empty line between #include <asm*/*.h> and #include <linux/*.h>, right?

Quoted 5 lines

mm/pt_reclaim.c line 5

Quoted 1 line
mm/pt_reclaim.c +0 -0
 #include "internal.h"

With those fixed

Thanks a lot!

Quoted 3 lines
Signature · 2 lines
Sincerely yours,
Mike.
Signature · 2 lines
Cheers,
Harry / Hyeonggon
reviewer
#15 lore raw

Re: [PATCH V1 2/2] treewide: include linux/pgalloc.h instead of asm/pgalloc.h

Quoted 14 lines · Harry Yoo
Quoted 4 lines · Mike Rapoport
Quoted 4 lines
mm/pt_reclaim.c +0 -0
index 7e9455a18aae..ec6fe4eb2644 100644
Quoted 8 lines

mm/pt_reclaim.c line 4

Quoted 6 lines
mm/pt_reclaim.c +1 -1
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
 #include <asm-generic/tlb.h>
-#include <asm/pgalloc.h>
+#include <linux/pgalloc.h>

Please move it before include <asm-generic/tlb.h>

Quoted 2 lines

Will do, and in this case no empty line between #include <asm*/*.h> and #include <linux/*.h>, right?

Won't hurt :)

Signature · 2 lines
Sincerely yours,
Mike.