Commit d70f2a14 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

include/linux/sched/mm.h: uninline mmdrop_async(), etc

mmdrop_async() is only used in fork.c.  Move that and its support
functions into fork.c, uninline it all.

Quite a lot of code gets moved around to avoid forward declarations.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0d2d5d40
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
/* /*
* Routines for handling mm_structs * Routines for handling mm_structs
*/ */
extern struct mm_struct * mm_alloc(void); extern struct mm_struct *mm_alloc(void);
/** /**
* mmgrab() - Pin a &struct mm_struct. * mmgrab() - Pin a &struct mm_struct.
...@@ -35,27 +35,7 @@ static inline void mmgrab(struct mm_struct *mm) ...@@ -35,27 +35,7 @@ static inline void mmgrab(struct mm_struct *mm)
atomic_inc(&mm->mm_count); atomic_inc(&mm->mm_count);
} }
/* mmdrop drops the mm and the page tables */ extern void mmdrop(struct mm_struct *mm);
extern void __mmdrop(struct mm_struct *);
static inline void mmdrop(struct mm_struct *mm)
{
if (unlikely(atomic_dec_and_test(&mm->mm_count)))
__mmdrop(mm);
}
static inline void mmdrop_async_fn(struct work_struct *work)
{
struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work);
__mmdrop(mm);
}
static inline void mmdrop_async(struct mm_struct *mm)
{
if (unlikely(atomic_dec_and_test(&mm->mm_count))) {
INIT_WORK(&mm->async_put_work, mmdrop_async_fn);
schedule_work(&mm->async_put_work);
}
}
/** /**
* mmget() - Pin the address space associated with a &struct mm_struct. * mmget() - Pin the address space associated with a &struct mm_struct.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment