Skip to content

Commit

Permalink
include/linux/sched/mm.h: uninline mmdrop_async(), etc
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
akpm00 authored and torvalds committed Feb 1, 2018
1 parent 0d2d5d4 commit d70f2a1
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 234 deletions.
24 changes: 2 additions & 22 deletions include/linux/sched/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/*
* 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.
Expand All @@ -35,27 +35,7 @@ static inline void mmgrab(struct mm_struct *mm)
atomic_inc(&mm->mm_count);
}

/* mmdrop drops the mm and the page tables */
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);
}
}
extern void mmdrop(struct mm_struct *mm);

/**
* mmget() - Pin the address space associated with a &struct mm_struct.
Expand Down
Loading

0 comments on commit d70f2a1

Please sign in to comment.