Skip to content

Commit

Permalink
procfs: use proper units for noMMU statm
Browse files Browse the repository at this point in the history
On no-MMU systems, sizes reported in /proc/n/statm have units of bytes.
Per Documentation/filesystems/proc.txt, these values should be in pages.

Signed-off-by: Steven J. Magnani <[email protected]>
Cc: Greg Ungerer <[email protected]>
Cc: David Howells <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
smagnani authored and torvalds committed Dec 15, 2009
1 parent ea63763 commit 7e1e0ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/proc/task_nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
}
}

size += (*text = mm->end_code - mm->start_code);
size += (*data = mm->start_stack - mm->start_data);
*text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK))
>> PAGE_SHIFT;
*data = (PAGE_ALIGN(mm->start_stack) - (mm->start_data & PAGE_MASK))
>> PAGE_SHIFT;
up_read(&mm->mmap_sem);
size >>= PAGE_SHIFT;
size += *text + *data;
*resident = size;
return size;
}
Expand Down

0 comments on commit 7e1e0ef

Please sign in to comment.