KOSAKI Motohiro
1c2499ae87
/proc/pid/smaps: fix dirty pages accounting
...
Currently, /proc/<pid>/smaps has wrong dirty pages accounting.
Shared_Dirty and Private_Dirty output only pte dirty pages and ignore
PG_dirty page flag. It is difference against documentation, but also
inconsistent against Referenced field. (Referenced checks both pte and
page flags)
This patch fixes it.
Test program:
large-array.c
---------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char array[1*1024*1024*1024L];
int main(void)
{
memset(array, 1, sizeof(array));
pause();
return 0;
}
---------------------------------------------------
Test case:
1. run ./large-array
2. cat /proc/`pidof large-array`/smaps
3. swapoff -a
4. cat /proc/`pidof large-array`/smaps again
Test result:
<before patch>
00601000-40601000 rw-p 00000000 00:00 0
Size: 1048576 kB
Rss: 1048576 kB
Pss: 1048576 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 218992 kB <-- showed pages as clean incorrectly
Private_Dirty: 829584 kB
Referenced: 388364 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
<after patch>
00601000-40601000 rw-p 00000000 00:00 0
Size: 1048576 kB
Rss: 1048576 kB
Pss: 1048576 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 1048576 kB <-- fixed
Referenced: 388480 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-09-22 17:22:39 -07:00
..
2010-07-29 15:16:17 -07:00
2010-08-11 00:29:47 -04:00
2008-10-23 14:29:04 +04:00
2008-10-23 15:05:11 +04:00
2008-10-23 15:02:18 +04:00
2010-08-09 16:47:37 -04:00
2010-08-14 00:24:24 +02:00
2009-12-16 07:19:57 -08:00
2008-10-23 15:15:46 +04:00
2008-10-10 04:18:57 +04:00
2010-05-27 09:12:47 -07:00
2010-04-09 16:35:41 +02:00
2009-05-15 15:32:45 +02:00
2010-08-11 08:59:20 -07:00
2009-10-29 07:39:25 -07:00
2007-10-17 08:42:48 -07:00
2010-03-30 22:02:32 +09:00
2010-09-09 18:57:23 -07:00
2010-06-13 18:12:24 -06:00
2010-03-30 22:02:32 +09:00
2010-08-09 16:47:37 -04:00
2009-04-01 08:59:10 -07:00
2010-05-27 09:12:47 -07:00
2009-06-18 13:03:41 -07:00
2010-03-30 22:02:32 +09:00
2010-09-22 17:22:39 -07:00
2010-06-29 15:29:30 -07:00
2009-09-24 10:16:24 +02:00
2008-10-23 14:19:58 +04:00
2010-09-22 17:22:38 -07:00