diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-02-01 13:08:20 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-03-02 19:43:28 -0500 |
commit | 68e21be2916b359fd8afb536c1911dc014cfd03e (patch) | |
tree | 91c679b74678eb398878aaf227d7d4a99c211fcb | |
parent | de8f1c77313d8c908b2897f268d466c13df161d4 (diff) |
sched/headers: Move task->mm handling methods to <linux/sched/mm.h>
Move the following task->mm helper APIs into a new header file,
<linux/sched/mm.h>, to further reduce the size and complexity
of <linux/sched.h>.
Here are how the APIs are used in various kernel files:
# mm_alloc():
arch/arm/mach-rpc/ecard.c
fs/exec.c
include/linux/sched/mm.h
kernel/fork.c
# __mmdrop():
arch/arc/include/asm/mmu_context.h
include/linux/sched/mm.h
kernel/fork.c
# mmdrop():
arch/arm/mach-rpc/ecard.c
arch/m68k/sun3/mmu_emu.c
arch/x86/mm/tlb.c
drivers/gpu/drm/amd/amdkfd/kfd_process.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/infiniband/hw/hfi1/file_ops.c
drivers/vfio/vfio_iommu_spapr_tce.c
fs/exec.c
fs/proc/base.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
fs/userfaultfd.c
include/linux/mmu_notifier.h
include/linux/sched/mm.h
kernel/fork.c
kernel/futex.c
kernel/sched/core.c
mm/khugepaged.c
mm/ksm.c
mm/mmu_context.c
mm/mmu_notifier.c
mm/oom_kill.c
virt/kvm/kvm_main.c
# mmdrop_async_fn():
include/linux/sched/mm.h
# mmdrop_async():
include/linux/sched/mm.h
kernel/fork.c
# mmget_not_zero():
fs/userfaultfd.c
include/linux/sched/mm.h
mm/oom_kill.c
# mmput():
arch/arc/include/asm/mmu_context.h
arch/arc/kernel/troubleshoot.c
arch/frv/mm/mmu-context.c
arch/powerpc/platforms/cell/spufs/context.c
arch/sparc/include/asm/mmu_context_32.h
drivers/android/binder.c
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/infiniband/core/umem.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/iommu/amd_iommu_v2.c
drivers/iommu/intel-svm.c
drivers/lguest/lguest_user.c
drivers/misc/cxl/fault.c
drivers/misc/mic/scif/scif_rma.c
drivers/oprofile/buffer_sync.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/vhost.c
drivers/xen/gntdev.c
fs/exec.c
fs/proc/array.c
fs/proc/base.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
fs/userfaultfd.c
include/linux/sched/mm.h
kernel/cpuset.c
kernel/events/core.c
kernel/events/uprobes.c
kernel/exit.c
kernel/fork.c
kernel/ptrace.c
kernel/sys.c
kernel/trace/trace_output.c
kernel/tsacct.c
mm/memcontrol.c
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/mmu_notifier.c
mm/nommu.c
mm/oom_kill.c
mm/process_vm_access.c
mm/rmap.c
mm/swapfile.c
mm/util.c
virt/kvm/async_pf.c
# mmput_async():
include/linux/sched/mm.h
kernel/fork.c
mm/oom_kill.c
# get_task_mm():
arch/arc/kernel/troubleshoot.c
arch/powerpc/platforms/cell/spufs/context.c
drivers/android/binder.c
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/infiniband/core/umem.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/iommu/amd_iommu_v2.c
drivers/iommu/intel-svm.c
drivers/lguest/lguest_user.c
drivers/misc/cxl/fault.c
drivers/misc/mic/scif/scif_rma.c
drivers/oprofile/buffer_sync.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/vhost.c
drivers/xen/gntdev.c
fs/proc/array.c
fs/proc/base.c
fs/proc/task_mmu.c
include/linux/sched/mm.h
kernel/cpuset.c
kernel/events/core.c
kernel/exit.c
kernel/fork.c
kernel/ptrace.c
kernel/sys.c
kernel/trace/trace_output.c
kernel/tsacct.c
mm/memcontrol.c
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/mmu_notifier.c
mm/nommu.c
mm/util.c
# mm_access():
fs/proc/base.c
include/linux/sched/mm.h
kernel/fork.c
mm/process_vm_access.c
# mm_release():
arch/arc/include/asm/mmu_context.h
fs/exec.c
include/linux/sched/mm.h
include/uapi/linux/sched.h
kernel/exit.c
kernel/fork.c
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/alpha/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/arc/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/arm/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-common/smp.c | 2 | ||||
-rw-r--r-- | arch/hexagon/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/m32r/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/metag/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/parisc/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/processor.c | 2 | ||||
-rw-r--r-- | arch/score/kernel/traps.c | 1 | ||||
-rw-r--r-- | arch/sh/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_smp.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/smp_64.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4d_smp.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4m_smp.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/traps_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/traps_64.c | 2 | ||||
-rw-r--r-- | arch/tile/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/xtensa/kernel/smp.c | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 95 | ||||
-rw-r--r-- | include/linux/sched/mm.h | 95 |
26 files changed, 120 insertions, 116 deletions
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index acb4b146a607..9fc560459ebd 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/kernel_stat.h> | 15 | #include <linux/kernel_stat.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/sched.h> | 17 | #include <linux/sched/mm.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/threads.h> | 20 | #include <linux/threads.h> |
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index b8e8d3944481..f46267153ec2 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched/mm.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/profile.h> | 18 | #include <linux/profile.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index b724cff7ad60..572a8df1b766 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched/mm.h> |
15 | #include <linux/sched/hotplug.h> | 15 | #include <linux/sched/hotplug.h> |
16 | #include <linux/sched/task_stack.h> | 16 | #include <linux/sched/task_stack.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 83c0a839a6ad..ef1caae02110 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched/mm.h> |
25 | #include <linux/sched/hotplug.h> | 25 | #include <linux/sched/hotplug.h> |
26 | #include <linux/sched/task_stack.h> | 26 | #include <linux/sched/task_stack.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c index 3ac98252d299..b32ddab7966c 100644 --- a/arch/blackfin/mach-common/smp.c +++ b/arch/blackfin/mach-common/smp.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched/mm.h> |
15 | #include <linux/sched/task_stack.h> | 15 | #include <linux/sched/task_stack.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/cache.h> | 17 | #include <linux/cache.h> |
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c index 1f63e91a353b..5dbc15549e01 100644 --- a/arch/hexagon/kernel/smp.c +++ b/arch/hexagon/kernel/smp.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/percpu.h> | 27 | #include <linux/percpu.h> |
28 | #include <linux/sched.h> | 28 | #include <linux/sched/mm.h> |
29 | #include <linux/smp.h> | 29 | #include <linux/smp.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/cpu.h> | 31 | #include <linux/cpu.h> |
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 63bef6fc0f3e..23e3fd61e335 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched/mm.h> |
36 | #include <linux/sched/clock.h> | 36 | #include <linux/sched/clock.h> |
37 | #include <linux/sched/task_stack.h> | 37 | #include <linux/sched/task_stack.h> |
38 | #include <linux/seq_file.h> | 38 | #include <linux/seq_file.h> |
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c index b18bc0bd6544..1a9e977287e6 100644 --- a/arch/m32r/kernel/setup.c +++ b/arch/m32r/kernel/setup.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/stddef.h> | 12 | #include <linux/stddef.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched/mm.h> |
15 | #include <linux/ioport.h> | 15 | #include <linux/ioport.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c index cab2aa64ca82..232a12bf3f99 100644 --- a/arch/metag/kernel/smp.c +++ b/arch/metag/kernel/smp.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched/mm.h> |
16 | #include <linux/sched/hotplug.h> | 16 | #include <linux/sched/hotplug.h> |
17 | #include <linux/sched/task_stack.h> | 17 | #include <linux/sched/task_stack.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 1a9366a157cb..c7d17cfb32f6 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/extable.h> | 24 | #include <linux/extable.h> |
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <linux/sched.h> | 26 | #include <linux/sched/mm.h> |
27 | #include <linux/sched/debug.h> | 27 | #include <linux/sched/debug.h> |
28 | #include <linux/smp.h> | 28 | #include <linux/smp.h> |
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 67b452b41ff6..63365106ea19 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched/mm.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/smp.h> | 27 | #include <linux/smp.h> |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index fce17789c675..46f89e66a273 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/export.h> | 21 | #include <linux/export.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched/mm.h> |
23 | #include <linux/sched/topology.h> | 23 | #include <linux/sched/topology.h> |
24 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index bf7854523831..928b929a6261 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c | |||
@@ -8,11 +8,13 @@ | |||
8 | 8 | ||
9 | #include <linux/cpufeature.h> | 9 | #include <linux/cpufeature.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/sched/mm.h> | ||
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <linux/seq_file.h> | 13 | #include <linux/seq_file.h> |
13 | #include <linux/mm_types.h> | 14 | #include <linux/mm_types.h> |
14 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
15 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
17 | |||
16 | #include <asm/diag.h> | 18 | #include <asm/diag.h> |
17 | #include <asm/facility.h> | 19 | #include <asm/facility.h> |
18 | #include <asm/elf.h> | 20 | #include <asm/elf.h> |
diff --git a/arch/score/kernel/traps.c b/arch/score/kernel/traps.c index fe68de6c746c..e359ec675869 100644 --- a/arch/score/kernel/traps.c +++ b/arch/score/kernel/traps.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/extable.h> | 26 | #include <linux/extable.h> |
27 | #include <linux/sched/mm.h> | ||
27 | #include <linux/sched/signal.h> | 28 | #include <linux/sched/signal.h> |
28 | #include <linux/sched/debug.h> | 29 | #include <linux/sched/debug.h> |
29 | #include <linux/mm_types.h> | 30 | #include <linux/mm_types.h> |
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 4abf119c129c..c483422ea4d0 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/cpu.h> | 21 | #include <linux/cpu.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched/mm.h> |
24 | #include <linux/sched/hotplug.h> | 24 | #include <linux/sched/hotplug.h> |
25 | #include <linux/atomic.h> | 25 | #include <linux/atomic.h> |
26 | #include <linux/clockchips.h> | 26 | #include <linux/clockchips.h> |
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index b99d33797e1d..db7acf27bea2 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <asm/head.h> | 9 | #include <asm/head.h> |
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched/mm.h> |
13 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
14 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 15052d364e04..b3bc0ac757cc 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | #include <linux/export.h> | 6 | #include <linux/export.h> |
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched/mm.h> |
9 | #include <linux/sched/hotplug.h> | 9 | #include <linux/sched/hotplug.h> |
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 7b55c50eabe5..af93b50e3ce4 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/profile.h> | 11 | #include <linux/profile.h> |
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched/mm.h> |
14 | #include <linux/cpu.h> | 14 | #include <linux/cpu.h> |
15 | 15 | ||
16 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 633c4cf6fdb0..5547fcb1d72d 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
9 | #include <linux/profile.h> | 9 | #include <linux/profile.h> |
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | #include <linux/sched.h> | 11 | #include <linux/sched/mm.h> |
12 | #include <linux/cpu.h> | 12 | #include <linux/cpu.h> |
13 | 13 | ||
14 | #include <asm/cacheflush.h> | 14 | #include <asm/cacheflush.h> |
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 2de72a49308a..466d4aed06c7 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * I hate traps on the sparc, grrr... | 9 | * I hate traps on the sparc, grrr... |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/sched.h> /* for jiffies */ | 12 | #include <linux/sched/mm.h> |
13 | #include <linux/sched/debug.h> | 13 | #include <linux/sched/debug.h> |
14 | #include <linux/mm_types.h> | 14 | #include <linux/mm_types.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 4ff4c35f76b2..196ee5eb4d48 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
@@ -9,7 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/extable.h> | 11 | #include <linux/extable.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched/mm.h> |
13 | #include <linux/sched/debug.h> | 13 | #include <linux/sched/debug.h> |
14 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c index f3fdd0c39b12..869c22e57561 100644 --- a/arch/tile/kernel/smpboot.c +++ b/arch/tile/kernel/smpboot.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/sched.h> | 19 | #include <linux/sched/mm.h> |
20 | #include <linux/sched/task.h> | 20 | #include <linux/sched/task.h> |
21 | #include <linux/kernel_stat.h> | 21 | #include <linux/kernel_stat.h> |
22 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index f2fd8fefc589..b11b38c3b0bd 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <linux/ctype.h> | 8 | #include <linux/ctype.h> |
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <linux/sched.h> | 10 | #include <linux/sched/mm.h> |
11 | #include <linux/sched/clock.h> | 11 | #include <linux/sched/clock.h> |
12 | #include <linux/sched/task.h> | 12 | #include <linux/sched/task.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c index fd894eaa63f3..932d64689bac 100644 --- a/arch/xtensa/kernel/smp.c +++ b/arch/xtensa/kernel/smp.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/kdebug.h> | 22 | #include <linux/kdebug.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/sched/mm.h> | ||
24 | #include <linux/sched/hotplug.h> | 25 | #include <linux/sched/hotplug.h> |
25 | #include <linux/sched/task_stack.h> | 26 | #include <linux/sched/task_stack.h> |
26 | #include <linux/reboot.h> | 27 | #include <linux/reboot.h> |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 042620729230..d29bbe0ee41f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2379,101 +2379,6 @@ static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig) | |||
2379 | return sp; | 2379 | return sp; |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | /* | ||
2383 | * Routines for handling mm_structs | ||
2384 | */ | ||
2385 | extern struct mm_struct * mm_alloc(void); | ||
2386 | |||
2387 | /** | ||
2388 | * mmgrab() - Pin a &struct mm_struct. | ||
2389 | * @mm: The &struct mm_struct to pin. | ||
2390 | * | ||
2391 | * Make sure that @mm will not get freed even after the owning task | ||
2392 | * exits. This doesn't guarantee that the associated address space | ||
2393 | * will still exist later on and mmget_not_zero() has to be used before | ||
2394 | * accessing it. | ||
2395 | * | ||
2396 | * This is a preferred way to to pin @mm for a longer/unbounded amount | ||
2397 | * of time. | ||
2398 | * | ||
2399 | * Use mmdrop() to release the reference acquired by mmgrab(). | ||
2400 | * | ||
2401 | * See also <Documentation/vm/active_mm.txt> for an in-depth explanation | ||
2402 | * of &mm_struct.mm_count vs &mm_struct.mm_users. | ||
2403 | */ | ||
2404 | static inline void mmgrab(struct mm_struct *mm) | ||
2405 | { | ||
2406 | atomic_inc(&mm->mm_count); | ||
2407 | } | ||
2408 | |||
2409 | /* mmdrop drops the mm and the page tables */ | ||
2410 | extern void __mmdrop(struct mm_struct *); | ||
2411 | static inline void mmdrop(struct mm_struct *mm) | ||
2412 | { | ||
2413 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) | ||
2414 | __mmdrop(mm); | ||
2415 | } | ||
2416 | |||
2417 | static inline void mmdrop_async_fn(struct work_struct *work) | ||
2418 | { | ||
2419 | struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work); | ||
2420 | __mmdrop(mm); | ||
2421 | } | ||
2422 | |||
2423 | static inline void mmdrop_async(struct mm_struct *mm) | ||
2424 | { | ||
2425 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) { | ||
2426 | INIT_WORK(&mm->async_put_work, mmdrop_async_fn); | ||
2427 | schedule_work(&mm->async_put_work); | ||
2428 | } | ||
2429 | } | ||
2430 | |||
2431 | /** | ||
2432 | * mmget() - Pin the address space associated with a &struct mm_struct. | ||
2433 | * @mm: The address space to pin. | ||
2434 | * | ||
2435 | * Make sure that the address space of the given &struct mm_struct doesn't | ||
2436 | * go away. This does not protect against parts of the address space being | ||
2437 | * modified or freed, however. | ||
2438 | * | ||
2439 | * Never use this function to pin this address space for an | ||
2440 | * unbounded/indefinite amount of time. | ||
2441 | * | ||
2442 | * Use mmput() to release the reference acquired by mmget(). | ||
2443 | * | ||
2444 | * See also <Documentation/vm/active_mm.txt> for an in-depth explanation | ||
2445 | * of &mm_struct.mm_count vs &mm_struct.mm_users. | ||
2446 | */ | ||
2447 | static inline void mmget(struct mm_struct *mm) | ||
2448 | { | ||
2449 | atomic_inc(&mm->mm_users); | ||
2450 | } | ||
2451 | |||
2452 | static inline bool mmget_not_zero(struct mm_struct *mm) | ||
2453 | { | ||
2454 | return atomic_inc_not_zero(&mm->mm_users); | ||
2455 | } | ||
2456 | |||
2457 | /* mmput gets rid of the mappings and all user-space */ | ||
2458 | extern void mmput(struct mm_struct *); | ||
2459 | #ifdef CONFIG_MMU | ||
2460 | /* same as above but performs the slow path from the async context. Can | ||
2461 | * be called from the atomic context as well | ||
2462 | */ | ||
2463 | extern void mmput_async(struct mm_struct *); | ||
2464 | #endif | ||
2465 | |||
2466 | /* Grab a reference to a task's mm, if it is not already going away */ | ||
2467 | extern struct mm_struct *get_task_mm(struct task_struct *task); | ||
2468 | /* | ||
2469 | * Grab a reference to a task's mm, if it is not already going away | ||
2470 | * and ptrace_may_access with the mode parameter passed to it | ||
2471 | * succeeds. | ||
2472 | */ | ||
2473 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); | ||
2474 | /* Remove the current tasks stale references to the old mm_struct */ | ||
2475 | extern void mm_release(struct task_struct *, struct mm_struct *); | ||
2476 | |||
2477 | #ifdef CONFIG_HAVE_COPY_THREAD_TLS | 2382 | #ifdef CONFIG_HAVE_COPY_THREAD_TLS |
2478 | extern int copy_thread_tls(unsigned long, unsigned long, unsigned long, | 2383 | extern int copy_thread_tls(unsigned long, unsigned long, unsigned long, |
2479 | struct task_struct *, unsigned long); | 2384 | struct task_struct *, unsigned long); |
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index d32e3932b2e3..be1ae55f5ab9 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h | |||
@@ -5,4 +5,99 @@ | |||
5 | #include <linux/mm_types.h> | 5 | #include <linux/mm_types.h> |
6 | #include <linux/gfp.h> | 6 | #include <linux/gfp.h> |
7 | 7 | ||
8 | /* | ||
9 | * Routines for handling mm_structs | ||
10 | */ | ||
11 | extern struct mm_struct * mm_alloc(void); | ||
12 | |||
13 | /** | ||
14 | * mmgrab() - Pin a &struct mm_struct. | ||
15 | * @mm: The &struct mm_struct to pin. | ||
16 | * | ||
17 | * Make sure that @mm will not get freed even after the owning task | ||
18 | * exits. This doesn't guarantee that the associated address space | ||
19 | * will still exist later on and mmget_not_zero() has to be used before | ||
20 | * accessing it. | ||
21 | * | ||
22 | * This is a preferred way to to pin @mm for a longer/unbounded amount | ||
23 | * of time. | ||
24 | * | ||
25 | * Use mmdrop() to release the reference acquired by mmgrab(). | ||
26 | * | ||
27 | * See also <Documentation/vm/active_mm.txt> for an in-depth explanation | ||
28 | * of &mm_struct.mm_count vs &mm_struct.mm_users. | ||
29 | */ | ||
30 | static inline void mmgrab(struct mm_struct *mm) | ||
31 | { | ||
32 | atomic_inc(&mm->mm_count); | ||
33 | } | ||
34 | |||
35 | /* mmdrop drops the mm and the page tables */ | ||
36 | extern void __mmdrop(struct mm_struct *); | ||
37 | static inline void mmdrop(struct mm_struct *mm) | ||
38 | { | ||
39 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) | ||
40 | __mmdrop(mm); | ||
41 | } | ||
42 | |||
43 | static inline void mmdrop_async_fn(struct work_struct *work) | ||
44 | { | ||
45 | struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work); | ||
46 | __mmdrop(mm); | ||
47 | } | ||
48 | |||
49 | static inline void mmdrop_async(struct mm_struct *mm) | ||
50 | { | ||
51 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) { | ||
52 | INIT_WORK(&mm->async_put_work, mmdrop_async_fn); | ||
53 | schedule_work(&mm->async_put_work); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * mmget() - Pin the address space associated with a &struct mm_struct. | ||
59 | * @mm: The address space to pin. | ||
60 | * | ||
61 | * Make sure that the address space of the given &struct mm_struct doesn't | ||
62 | * go away. This does not protect against parts of the address space being | ||
63 | * modified or freed, however. | ||
64 | * | ||
65 | * Never use this function to pin this address space for an | ||
66 | * unbounded/indefinite amount of time. | ||
67 | * | ||
68 | * Use mmput() to release the reference acquired by mmget(). | ||
69 | * | ||
70 | * See also <Documentation/vm/active_mm.txt> for an in-depth explanation | ||
71 | * of &mm_struct.mm_count vs &mm_struct.mm_users. | ||
72 | */ | ||
73 | static inline void mmget(struct mm_struct *mm) | ||
74 | { | ||
75 | atomic_inc(&mm->mm_users); | ||
76 | } | ||
77 | |||
78 | static inline bool mmget_not_zero(struct mm_struct *mm) | ||
79 | { | ||
80 | return atomic_inc_not_zero(&mm->mm_users); | ||
81 | } | ||
82 | |||
83 | /* mmput gets rid of the mappings and all user-space */ | ||
84 | extern void mmput(struct mm_struct *); | ||
85 | #ifdef CONFIG_MMU | ||
86 | /* same as above but performs the slow path from the async context. Can | ||
87 | * be called from the atomic context as well | ||
88 | */ | ||
89 | extern void mmput_async(struct mm_struct *); | ||
90 | #endif | ||
91 | |||
92 | /* Grab a reference to a task's mm, if it is not already going away */ | ||
93 | extern struct mm_struct *get_task_mm(struct task_struct *task); | ||
94 | /* | ||
95 | * Grab a reference to a task's mm, if it is not already going away | ||
96 | * and ptrace_may_access with the mode parameter passed to it | ||
97 | * succeeds. | ||
98 | */ | ||
99 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); | ||
100 | /* Remove the current tasks stale references to the old mm_struct */ | ||
101 | extern void mm_release(struct task_struct *, struct mm_struct *); | ||
102 | |||
8 | #endif /* _LINUX_SCHED_MM_H */ | 103 | #endif /* _LINUX_SCHED_MM_H */ |