diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-26 15:32:00 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-26 15:32:00 +0100 |
commit | 36e9f7203e05090031a5356be043a9be342e383c (patch) | |
tree | 27877737c3bb3c00ee9caeece7d671f65cf91252 /include/linux/sched/mm.h | |
parent | 721dfe4133a9a41e4b4a74e5b41089b7dac8f539 (diff) | |
parent | 4a3928c6f8a53fa1aed28ccba227742486e8ddcb (diff) |
Merge 4.16-rc3 into staging-next
We want the IIO/Staging fixes in here, and to resolve a merge problem
with the move of the fsl-mc code.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/sched/mm.h')
-rw-r--r-- | include/linux/sched/mm.h | 13 |
1 files changed, 12 insertions, 1 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) atomic_inc(&mm->mm_count); } -extern void mmdrop(struct mm_struct *mm); +extern void __mmdrop(struct mm_struct *mm); + +static inline void mmdrop(struct mm_struct *mm) +{ + /* + * The implicit full barrier implied by atomic_dec_and_test() is + * required by the membarrier system call before returning to + * user-space, after storing to rq->curr. + */ + if (unlikely(atomic_dec_and_test(&mm->mm_count))) + __mmdrop(mm); +} /** * mmget() - Pin the address space associated with a &struct mm_struct. |