diff options
author | Michal Hocko <mhocko@suse.com> | 2016-05-26 18:16:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-26 18:35:44 -0400 |
commit | 7ef949d77f95f0d129f0d404b336459a34a00101 (patch) | |
tree | 87279cbf52945c657504d17fa7fac2fcbf5414af | |
parent | 1ebab2db065e99eed9ab2304d3b7ad25c9568612 (diff) |
mm: oom_reaper: remove some bloat
mmput_async is currently used only from the oom_reaper which is defined
only for CONFIG_MMU. We can save work_struct in mm_struct for
!CONFIG_MMU.
[akpm@linux-foundation.org: fix typo, per Minchan]
Link: http://lkml.kernel.org/r/20160520061658.GB19172@dhcp22.suse.cz
Reported-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/mm_types.h | 2 | ||||
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | kernel/fork.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d553855503e6..ca3e517980a0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -514,7 +514,9 @@ struct mm_struct { | |||
514 | #ifdef CONFIG_HUGETLB_PAGE | 514 | #ifdef CONFIG_HUGETLB_PAGE |
515 | atomic_long_t hugetlb_usage; | 515 | atomic_long_t hugetlb_usage; |
516 | #endif | 516 | #endif |
517 | #ifdef CONFIG_MMU | ||
517 | struct work_struct async_put_work; | 518 | struct work_struct async_put_work; |
519 | #endif | ||
518 | }; | 520 | }; |
519 | 521 | ||
520 | static inline void mm_init_cpumask(struct mm_struct *mm) | 522 | static inline void mm_init_cpumask(struct mm_struct *mm) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 23e075dcdfe4..6e42ada26345 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2745,10 +2745,12 @@ static inline bool mmget_not_zero(struct mm_struct *mm) | |||
2745 | 2745 | ||
2746 | /* mmput gets rid of the mappings and all user-space */ | 2746 | /* mmput gets rid of the mappings and all user-space */ |
2747 | extern void mmput(struct mm_struct *); | 2747 | extern void mmput(struct mm_struct *); |
2748 | /* same as above but performs the slow path from the async kontext. Can | 2748 | #ifdef CONFIG_MMU |
2749 | /* same as above but performs the slow path from the async context. Can | ||
2749 | * be called from the atomic context as well | 2750 | * be called from the atomic context as well |
2750 | */ | 2751 | */ |
2751 | extern void mmput_async(struct mm_struct *); | 2752 | extern void mmput_async(struct mm_struct *); |
2753 | #endif | ||
2752 | 2754 | ||
2753 | /* Grab a reference to a task's mm, if it is not already going away */ | 2755 | /* Grab a reference to a task's mm, if it is not already going away */ |
2754 | extern struct mm_struct *get_task_mm(struct task_struct *task); | 2756 | extern struct mm_struct *get_task_mm(struct task_struct *task); |
diff --git a/kernel/fork.c b/kernel/fork.c index 47887bba944f..5c2c355aa97f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -736,6 +736,7 @@ void mmput(struct mm_struct *mm) | |||
736 | } | 736 | } |
737 | EXPORT_SYMBOL_GPL(mmput); | 737 | EXPORT_SYMBOL_GPL(mmput); |
738 | 738 | ||
739 | #ifdef CONFIG_MMU | ||
739 | static void mmput_async_fn(struct work_struct *work) | 740 | static void mmput_async_fn(struct work_struct *work) |
740 | { | 741 | { |
741 | struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work); | 742 | struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work); |
@@ -749,6 +750,7 @@ void mmput_async(struct mm_struct *mm) | |||
749 | schedule_work(&mm->async_put_work); | 750 | schedule_work(&mm->async_put_work); |
750 | } | 751 | } |
751 | } | 752 | } |
753 | #endif | ||
752 | 754 | ||
753 | /** | 755 | /** |
754 | * set_mm_exe_file - change a reference to the mm's executable file | 756 | * set_mm_exe_file - change a reference to the mm's executable file |