After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 518145 - Uncorrect parsing of smaps with linux kernels >= 2.6.25
Uncorrect parsing of smaps with linux kernels >= 2.6.25
Status: RESOLVED FIXED
Product: libgtop
Classification: Core
Component: linux
2.21.x
Other All
: High critical
: ---
Assigned To: libgtop maintainers
libgtop maintainers
Depends on:
Blocks: 518568
 
 
Reported: 2008-02-22 22:16 UTC by Eric Piel
Modified: 2008-04-29 09:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24



Description Eric Piel 2008-02-22 22:16:35 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 :-)
Comment 1 Benoît Dejean 2008-02-23 08:43:59 UTC
Thanks for the commit id
Comment 2 Benoît Dejean 2008-02-23 08:49:16 UTC
Maybe it's time for regex. But main issue is speed, even with the current simple&stupid implementation :/
Comment 3 Benoît Dejean 2008-02-24 17:58:19 UTC
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.
Comment 4 Benoît Dejean 2008-02-25 09:18:10 UTC
Implementing pss will be easy but requires ABI breakage.
Comment 5 Eric Piel 2008-02-26 11:47:11 UTC
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.