diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2018-02-21 17:45:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-21 18:35:42 -0500 |
commit | d34bc48f8275b6ce0da44f639d68344891268ee9 (patch) | |
tree | 4004ff5aceb19f3bbfb5c395e9a5df0f13a7f376 | |
parent | 7ed1c1901fe52e6c5828deb155920b44b0adabb1 (diff) |
include/linux/sched/mm.h: re-inline mmdrop()
As Peter points out, Doing a CALL+RET for just the decrement is a bit silly.
Fixes: d70f2a14b72a4bc ("include/linux/sched/mm.h: uninline mmdrop_async(), etc")
Acked-by: Peter Zijlstra (Intel) <peterz@infraded.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/sched/mm.h | 13 | ||||
-rw-r--r-- | kernel/fork.c | 15 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 1149533aa2fa..9806184bb3d5 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h | |||
@@ -36,7 +36,18 @@ static inline void mmgrab(struct mm_struct *mm) | |||
36 | atomic_inc(&mm->mm_count); | 36 | atomic_inc(&mm->mm_count); |
37 | } | 37 | } |
38 | 38 | ||
39 | extern void mmdrop(struct mm_struct *mm); | 39 | extern void __mmdrop(struct mm_struct *mm); |
40 | |||
41 | static inline void mmdrop(struct mm_struct *mm) | ||
42 | { | ||
43 | /* | ||
44 | * The implicit full barrier implied by atomic_dec_and_test() is | ||
45 | * required by the membarrier system call before returning to | ||
46 | * user-space, after storing to rq->curr. | ||
47 | */ | ||
48 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) | ||
49 | __mmdrop(mm); | ||
50 | } | ||
40 | 51 | ||
41 | /** | 52 | /** |
42 | * mmget() - Pin the address space associated with a &struct mm_struct. | 53 | * mmget() - Pin the address space associated with a &struct mm_struct. |
diff --git a/kernel/fork.c b/kernel/fork.c index be8aa5b98666..e5d9d405ae4e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -592,7 +592,7 @@ static void check_mm(struct mm_struct *mm) | |||
592 | * is dropped: either by a lazy thread or by | 592 | * is dropped: either by a lazy thread or by |
593 | * mmput. Free the page directory and the mm. | 593 | * mmput. Free the page directory and the mm. |
594 | */ | 594 | */ |
595 | static void __mmdrop(struct mm_struct *mm) | 595 | void __mmdrop(struct mm_struct *mm) |
596 | { | 596 | { |
597 | BUG_ON(mm == &init_mm); | 597 | BUG_ON(mm == &init_mm); |
598 | mm_free_pgd(mm); | 598 | mm_free_pgd(mm); |
@@ -603,18 +603,7 @@ static void __mmdrop(struct mm_struct *mm) | |||
603 | put_user_ns(mm->user_ns); | 603 | put_user_ns(mm->user_ns); |
604 | free_mm(mm); | 604 | free_mm(mm); |
605 | } | 605 | } |
606 | 606 | EXPORT_SYMBOL_GPL(__mmdrop); | |
607 | void mmdrop(struct mm_struct *mm) | ||
608 | { | ||
609 | /* | ||
610 | * The implicit full barrier implied by atomic_dec_and_test() is | ||
611 | * required by the membarrier system call before returning to | ||
612 | * user-space, after storing to rq->curr. | ||
613 | */ | ||
614 | if (unlikely(atomic_dec_and_test(&mm->mm_count))) | ||
615 | __mmdrop(mm); | ||
616 | } | ||
617 | EXPORT_SYMBOL_GPL(mmdrop); | ||
618 | 607 | ||
619 | static void mmdrop_async_fn(struct work_struct *work) | 608 | static void mmdrop_async_fn(struct work_struct *work) |
620 | { | 609 | { |