Harvard Business School of Echec

Aller au contenu | Aller au menu | Aller à la recherche

mardi, 22 avril 2008

ABI vs. API compatibility

glibtop_get_proc_mem

libgtop has a function glibtop_get_proc_mem to retrieve basic memory usage of a process. It fills a struct glibtop_proc_mem which looks like:

struct _glibtop_proc_mem
{
	guint64	flags;
	guint64 size;	
	guint64 vsize;
	guint64 resident;
	guint64 share;
	guint64 rss;
	guint64 rss_rlim;
};

Yes, size/vsize and resident/rss look like duplicate. At least on the linux implementation, even if size/vsize and resident/rss come from /proc/self/stat and /proc/self/statm, you can see in linux/fs/proc/{array,task_mmu}.c that they have the same values. So, it seems to me that the only unique members of struct glibtop_proc_mem are size, resident and share (ok there are also flags which flags which members are filled and rss_lim).

linux proportional set size

Linux 2.6.25 comes with a new stat in /proc/self/smaps called pss which is even smarter/accurate than private_dirty. There's glibtop_get_proc_map which currently have all the smaps member but not this new pss. So what is the smarter way to get this new pss in libgtop without breaking everything ?

- break the ABI ?

I could simply extend struct glibtop_proc_map. That would break the ABI, which i'm allowed to because libgtop is desktop. But that's bad practice since packagers have to rebuild everything. That's a painful migration that may delay the adoption of newer versions of the library.

- break the API ?

What about cleaning up the glibtop_proc_mem duplicate members, mark unused some of them and rename rss to pss while keeping it binary compatible ? That would make the API a bit more sensible. I've scanned the Debian/unstable archive and that would break the build 3-6 packages but i would be able to submit trivial patches to fix glibtop_get_proc_mem usage. (And also add glibtop_init(); which are missing everywhere).

- hide pss inside rss ?


So what's best ?

mercredi, 13 juin 2007

Indiana patches

Dear Sun Microsystems, I think your patches are bullshit. Please drop them or as already suggested, do fork.
As the maintainer of system-monitor and libgtop, i have already rejected stupid patches from you. They contain unkown API changes and a lot of dead code. The libgtop patch is the most scary. Here's a tip: libgtop code is OS specific (linux, bsd, solaris, etc have their own separate implementation) so copying linux code to solaris is obviously NOT going to work.
I can see that some of your patches are actually OK, but your people don't seem to understand how we work.
This reminds me of that private mail where you asked me to re-license libgtop to LGPL because you had some kind of packaging issues ... because you wanted to install libgtop in /foo/bar and instead of /foo/baz. Bad for you.

lundi, 12 février 2007

signedness fun

3 years ago, i deleted code that i didn't understand in libgtop. It was a mess about bitwise shift and xor. Then came these bugs about system-monitor displaying 17179869184.0 GiB. This is about available disk space (you know, the 10% reservation for root, etc). On *BSD, available disk space can be negative... so you can get df to reports negative capacity :

$ df -h /
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/ad10s1a    496M    457M   -514K   100%    /

(This reminds me of mfs fun with OpenBSD ;)

libgtop uses statvfs/statfs functions to get disk space usage : struct statvfs members' type is fsblkcnt_t which is an unsigned integer. This means that some kernels store signed values as unsigned integers. Hence the old fun code i deleted. glibtop_fsusage members are guint64 so there is not signedness mismatch between libgtop and the system.

As I was unable to get negative values with linux 2.6.20 and ext3, I dig into GNU df code and found the very same code that was in libgtop, i guess someone copy&pasted it into libgtop a long time ago. This code does funny things to handle integers with the top bit set as negative integers.

I ended to this madness by ensuring available disk space is <= to free disk space.

lundi, 15 janvier 2007

écrasement de pile dans libgtop < 2.14.6

Enfin un bug à me mettre sous la dent, histoire de changer de la soupe bugbuddy. Bon c'est pas très glorieux pour moi mais c'est du logiciel libre, et en moins de 24H, j'ai pris le problème en charge et fait tourner un nouveau tarball 2.14.6. Il s'agissait d'un vilain écrasement de pile présent depuis toujours mais plus susceptible de se produire dans les vers > 2.6. Ça m'a un peu stressé mais je pense que j'ai bien corrigé le problème.

J'ai transmis l'info à Loic Minier de Debian pour voir ce qu'il peut faire pour etch (le freeze est déjà en vigueur). Il a lancé tout une procédure pour gérer ça. Merci à lui.

mardi, 5 décembre 2006

Bugzilla tags

I've recently commited many patches that i forgot about. They were all in "Accepted Commit-Now" state but nobody spotted them. The new patch symbol is great to find bugs with patches but it doesn't help to find "Accepted Commit-Now" patches. There was for a long time a kFreeBSD patch for libgtop on bugzilla, i tagged it "Accepted Commit-Now" but it was never commited and i forgot about it. But last week, i got a new patch from Debian adding kFreeBSD support and commited it, then i found the old patch. What a waste of work :/

I also often use the HELPWANTED tag but without success. And there's a GNOME love bug for system-monitor :)

dimanche, 3 décembre 2006

libgtop 2.14.5

What's new in libgtop 2.14.5 :

  • Added kfreebsd support (Petr Salinger).
  • Added solaris glibtop_get_proc_open_files (Henry Zhang).
  • Migrated to gtk-doc (Germán Poó-Caamaño).
  • glibtop_get_mountlist can now ignore nsfd FS.

Thanks everyone.