summaryrefslogtreecommitdiff
path: root/fs/proc/array.c
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 /fs/proc/array.c
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 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index e0b09b3ced45..8001f3faed1b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -277,15 +277,11 @@ static inline char *task_cap(struct task_struct *p, char *buffer)
int proc_pid_status(struct task_struct *task, char * buffer)
{
char * orig = buffer;
- struct mm_struct *mm;
+ struct mm_struct *mm = get_task_mm(task);
buffer = task_name(task, buffer);
buffer = task_state(task, buffer);
- task_lock(task);
- mm = task->mm;
- if(mm)
- atomic_inc(&mm->mm_users);
- task_unlock(task);
+
if (mm) {
buffer = task_mem(mm, buffer);
mmput(mm);
@@ -481,14 +477,9 @@ static void statm_pgd_range(pgd_t * pgd, unsigned long address, unsigned long en
int proc_pid_statm(struct task_struct *task, char * buffer)
{
- struct mm_struct *mm;
int size=0, resident=0, share=0, trs=0, lrs=0, drs=0, dt=0;
+ struct mm_struct *mm = get_task_mm(task);
- task_lock(task);
- mm = task->mm;
- if(mm)
- atomic_inc(&mm->mm_users);
- task_unlock(task);
if (mm) {
struct vm_area_struct * vma;
down_read(&mm->mmap_sem);
@@ -626,11 +617,8 @@ ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char *
if (!tmp)
goto out_free1;
- task_lock(task);
- mm = task->mm;
- if (mm)
- atomic_inc(&mm->mm_users);
- task_unlock(task);
+ mm = get_task_mm(task);
+
retval = 0;
if (!mm)
goto out_free2;