diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1d288587e44d..004d2a129ca4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -810,6 +810,27 @@ static inline char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt, return res; } + +/** + * get_task_mm - acquire a reference to the task's mm + * + * Returns %NULL if the task has no mm. User must release + * the mm via mmput() after use. + */ +static inline struct mm_struct * get_task_mm(struct task_struct * task) +{ + struct mm_struct * mm; + + task_lock(task); + mm = task->mm; + if (mm) + atomic_inc(&mm->mm_users); + task_unlock(task); + + return mm; +} + + /* set thread flags in other task's structures * - see asm/thread_info.h for TIF_xxxx flags available */ |
