Package: libnuma1
Version: 0.7pre2-4
Severity: normal
Tags: patch

Hi,

Currently, when NUMA is not available, libnuma assumes one CPU per
node.  This assumption is problematic on non-NUMA SMP of multicore of
hyperthreaded CPUs: in that case the NUMA layout would separate logical
CPUs while they are in the same core.

Here is a patch to assume only one node holding all cpus, which makes
more sense.

Regards,
Samuel

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages libnuma1 depends on:
ii  libc6                         2.3.5-8    GNU C Library: Shared libraries an

libnuma1 recommends no packages.

-- no debconf information
diff -ur numactl-orig/libnuma.c numactl-0.7pre2/libnuma.c
--- numactl-orig/libnuma.c      2004-07-06 10:02:29.000000000 +0200
+++ numactl-0.7pre2/libnuma.c   2005-12-15 17:18:54.000000000 +0100
@@ -181,9 +181,9 @@
 
 static int fallback_max_node(void)
 {
-       numa_warn_int(W_nosysfs, "/sys not mounted or no numa system. Assuming 
one node per CPU: %s",
+       numa_warn_int(W_nosysfs, "/sys not mounted or no numa system. Assuming 
one node : %s",
                  strerror(errno));
-       maxnode = number_of_cpus();     
+       maxnode = 0;    
        return maxnode;
 }
 
@@ -471,9 +471,10 @@
        f = fopen(fn, "r"); 
        if (!f || getdelim(&line, &len, '\n', f) < 1) { 
                numa_warn_int(W_nosysfs2,
-                  "/sys not mounted or invalid. Assuming nodes equal CPU: %s",
+                               "/sys not mounted or invalid. Assuming node 0 
holds all CPUs: %s",
                          strerror(errno)); 
-               set_bit(node, (unsigned long *)mask);
+               for (n = 0; n < ncpus; n++)
+                       set_bit(n, (unsigned long *)mask);
                goto out;
        } 
        n = 0;

Reply via email to