[RFC] mm: why cat /proc/pid/smaps | grep Rss is different from cat /proc/pid/statm?

From: Xishi Qiu
Date: Tue Mar 22 2016 - 09:56:29 EST


[root@localhost c_test]# cat /proc/3948/smaps | grep Rss
Rss: 4 kB
Rss: 4 kB
Rss: 4 kB
Rss: 796 kB
Rss: 0 kB
Rss: 16 kB
Rss: 8 kB
Rss: 12 kB
Rss: 132 kB
Rss: 12 kB
Rss: 4 kB
Rss: 4 kB
Rss: 4 kB
Rss: 4 kB
Rss: 12 kB
Rss: 0 kB
Rss: 4 kB
Rss: 0 kB
[root@localhost c_test]# cat /proc/3948/statm
1042 173 154 1 0 48 0

173 means Rss is 173*4kb=692kb, right?
so why it is different from the sum(1020kb) of "cat /proc/pid/smaps | grep Rss"?

my test code is
...
int main()
{
sleep(1000);
return 0;
}

the kernel version is v4.1

Thanks,
Xishi Qiu