mm: move anon_vma declarations to linux/mm_inline.h
Subsystems (14)
PATCH v2 1/2 mm: move anon_vma declarations to linux/mm_inline.h
From: Arnd Bergmann <[email protected]>
The patch to add anonymous vma names causes a build failure in some configurations:
include/linux/mm_types.h: In function 'is_same_vma_anon_name':include/linux/mm_types.h:924:37: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
924 | return name && vma_name && !strcmp(name, vma_name);
| ^~~~~~include/linux/mm_types.h:22:1: note: 'strcmp' is defined in header '<string.h>'; did you forget to '#include <string.h>'?
This should not really be part of linux/mm_types.h in the first place, as that header is meant to only contain structure defintions and need a minimum set of indirect includes itself. While the header clearly includes more than it should at this point, let's not make it worse by including string.h as well, which would pull in the expensive (compile-speed wise) fortify-string logic.
Move the new functions into a separate header that only needs to be included in a couple of locations.
--- fs/proc/task_mmu.c | 1 + fs/userfaultfd.c | 1 + include/linux/mm_inline.h | 50 +++++++++++++++++++++++++++++++++++++++ include/linux/mm_types.h | 48 ------------------------------------- kernel/fork.c | 1 + mm/madvise.c | 1 + mm/mmap.c | 1 + 7 files changed, 55 insertions(+), 48 deletions(-)
fs/proc/task_mmu.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/pagewalk.h> #include <linux/vmacache.h> +#include <linux/mm_inline.h> #include <linux/hugetlb.h> #include <linux/huge_mm.h> #include <linux/mount.h>
fs/userfaultfd.c +1 -0
@@ -15,6 +15,7 @@#include <linux/sched/signal.h> #include <linux/sched/mm.h> #include <linux/mm.h> +#include <linux/mm_inline.h> #include <linux/mmu_notifier.h> #include <linux/poll.h> #include <linux/slab.h>
include/linux/mm_inline.h +50 -0
60 lines not on this page · raw message
include/linux/mm_types.h +0 -48
52 lines not on this page · raw message
kernel/fork.c +1 -0
@@ -42,6 +42,7 @@#include <linux/mmu_notifier.h> #include <linux/fs.h> #include <linux/mm.h> +#include <linux/mm_inline.h> #include <linux/vmacache.h> #include <linux/nsproxy.h> #include <linux/capability.h>
mm/madvise.c +1 -0
@@ -18,6 +18,7 @@#include <linux/fadvise.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/mm_inline.h> #include <linux/string.h> #include <linux/uio.h> #include <linux/ksm.h>
mm/mmap.c +1 -0
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/backing-dev.h> #include <linux/mm.h> +#include <linux/mm_inline.h> #include <linux/vmacache.h> #include <linux/shm.h> #include <linux/mman.h>
Signature · 1 line
2.29.2
PATCH 2/2 mm: move tlb_flush_pending inline helpers to mm_inline.h
From: Arnd Bergmann <[email protected]>
linux/mm_types.h should only define structure definitions, to make it cheap to include elsewhere. The atomic_t helper function definitions are particularly large, so it's better to move the helpers using those into the existing linux/mm_inline.h and only include that where needed.
As a follow-up, we may want to go through all the indirect includes in mm_types.h and reduce them as much as possible.
---
Bonus patch: unlike the previous one, this does not fix an urgent bug, but rather cleans up the code along the same lines, preparing for possible follow-up patches
--- arch/x86/include/asm/pgtable.h | 2 +- include/linux/mm.h | 45 ------------ include/linux/mm_inline.h | 86 ++++++++++++++++++++++ include/linux/mm_types.h | 129 ++++++++++++--------------------- mm/ksm.c | 1 + mm/mapping_dirty_helpers.c | 1 + mm/memory.c | 1 + mm/mmu_gather.c | 1 + mm/pgtable-generic.c | 1 + 9 files changed, 137 insertions(+), 130 deletions(-)
arch/x86/include/asm/pgtable.h +1 -1
@@ -753,7 +753,7 @@ static inline bool pte_accessible(struct mm_struct *mm, pte_t a)return true;if ((pte_flags (a) & _PAGE_PROTNONE) && -mm_tlb_flush_pending (mm)) +atomic_read (&mm->tlb_flush_pending))return true;return false;
include/linux/mm.h +0 -45
51 lines not on this page · raw message
include/linux/mm_inline.h +86 -0
96 lines not on this page · raw message
include/linux/mm_types.h +45 -84
139 lines not on this page · raw message
mm/ksm.c +1 -0
@@ -15,6 +15,7 @@#include <linux/errno.h> #include <linux/mm.h> +#include <linux/mm_inline.h> #include <linux/fs.h> #include <linux/mman.h> #include <linux/sched.h>
mm/mapping_dirty_helpers.c +1 -0
@@ -3,6 +3,7 @@#include <linux/hugetlb.h> #include <linux/bitops.h> #include <linux/mmu_notifier.h> +#include <linux/mm_inline.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h>
mm/memory.c +1 -0
@@ -41,6 +41,7 @@#include <linux/kernel_stat.h> #include <linux/mm.h> +#include <linux/mm_inline.h> #include <linux/sched/mm.h> #include <linux/sched/coredump.h> #include <linux/sched/numa_balancing.h>
mm/mmu_gather.c +1 -0
@@ -3,6 +3,7 @@#include <linux/kernel.h> #include <linux/mmdebug.h> #include <linux/mm_types.h> +#include <linux/mm_inline.h> #include <linux/pagemap.h> #include <linux/rcupdate.h> #include <linux/smp.h>
mm/pgtable-generic.c +1 -0
@@ -10,6 +10,7 @@#include <linux/pagemap.h> #include <linux/hugetlb.h> #include <linux/pgtable.h> +#include <linux/mm_inline.h> #include <asm/tlb.h> /*
Signature · 1 line
2.29.2