From 47bcd423b5e58210d0283b09951ea3a68f54bb7e Mon Sep 17 00:00:00 2001 From: Robert Roth Date: Mon, 9 Dec 2013 04:02:38 +0200 Subject: [PATCH] Linux cpuinfo count fixed for SMP PPC processors (bgo #621831) libgtop processor count has been simply determined by the number of sections in /proc/cpuinfo split by \n\n. On PPC processors supporting SMP after the per-cpu description for each core a new section is listed (after \n\n) with the common attributes of the cores [1]. Work around this by only counting a section as describing a CPU if it contains "processor" to fix bug #621831 [0] [0] https://bugzilla.gnome.org/show_bug.cgi?id=621831 [1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/powerpc/kernel/setup-common.c?id=9fc2105aeaaf56b0cf75296a84702d0f9e64437b#n319 --- sysdeps/linux/sysinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysdeps/linux/sysinfo.c b/sysdeps/linux/sysinfo.c index 01821aa4..3ae96312 100644 --- a/sysdeps/linux/sysinfo.c +++ b/sysdeps/linux/sysinfo.c @@ -51,7 +51,8 @@ init_sysinfo (glibtop *server) sysinfo.ncpu++) { gchar **parts, **p; - + if (g_strrstr (processors[sysinfo.ncpu], "processor" ) == NULL) + continue; glibtop_entry * const cpuinfo = &sysinfo.cpuinfo[sysinfo.ncpu]; cpuinfo->labels = g_ptr_array_new ();