GNOME Bugzilla – Bug 518145
Uncorrect parsing of smaps with linux kernels >= 2.6.25
Last modified: 2008-04-29 09:03:13 UTC
Please describe the problem: In the Linux kernel 2.6.25 an additional field has been added to the smaps proc file: Pss. This leads to add_smaps() in sysdeps/linux/procmap.c to fail parsing the entry: it generates error messages like "Could not read smaps value Shared_Clean: ". Here is an example of entry in /proc/self/smaps: 2ac8df322000-2ac8df406000 r--p 00000000 03:05 334328 /usr/share/locale/UTF-8/LC_COLLATE Size: 912 kB Rss: 12 kB Pss: 0 kB Shared_Clean: 12 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 0 kB Referenced: 12 kB Steps to reproduce: 1. gnome-system-monitor (do it in the console for more fun) Actual results: Lots and lots of messages like "Could not read smaps value Shared_Clean:: Success" are displayed on the console. The Memory field in g-s-m has huge values (something like 4GB on x86, even quite a lot more on x86_64). Expected results: No error message. The correct amount of memory is displayed in g-s-m (in the order of 100MB) Does this happen every time? Always, with a Linux kernel 2.6.25-rc2 Other information: Probably the best way to solve it would be to have a more clever parser in add_smaps() which just skip field (that is, lines which starts with no whitespace and then a colon) which are unknown. For more info on PSS: see commit ec4dd3eb35759f9fbeb5c1abb01403b2fde64cc9 . BTW, it is specifically made to represent the memory usage of a task, so it might be worth reading it :-)
Thanks for the commit id
Maybe it's time for regex. But main issue is speed, even with the current simple&stupid implementation :/
I've commited http://svn.gnome.org/viewvc/libgtop?view=revision&revision=2713 , it will be in 2.21.92. If everything goes fine, i'll backport it to 2.20.x.
Implementing pss will be easy but requires ABI breakage.
I confirm 2.21.92 works fine with kernel 2.6.25-rc3 :-) So the bug is in my opinion fixed. I let you close the ticket, or keep it opened if you need it to also track the full support of Pss.