summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Levon <levon@movementarian.org>2002-07-23 20:48:18 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-07-23 20:48:18 -0700
commit3b89dbbd78bb638c2691c5752ed0d54fd1a73fa1 (patch)
tree88f26e1fc6a475d408e87d4366a5c1ad38846880 /include
parentd4ea8ebe21a50da6876c45d0259259d498d13eaf (diff)
[PATCH] consolidate task->mm code + fix
The patch below consolidates some duplicate code, reduces some indentation, and adds a freeing of a page in mem_read() that could be left unfreed, as far as I can see.
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h21
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
*/