All of lore.kernel.org
 help / color / mirror / Atom feed
* cpumask: fix compat getaffinity
@ 2010-05-07 12:45 Arnd Bergmann
  2010-05-08  8:30 ` Rusty Russell
  0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2010-05-07 12:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: stable, Rusty Russell, Andi Kleen, Ken Werner

Commit a45185d2d "cpumask: convert kernel/compat.c" broke
libnuma, which abuses sched_getaffinity to find out NR_CPUS
in order to parse /sys/devices/system/node/node*/cpumap.

On NUMA systems with less than 32 possibly CPUs, the
current compat_sys_sched_getaffinity now returns '4'
instead of the actual NR_CPUS/8, which makes libnuma
bail out when parsing the cpumap.

This restores the original return value for now.
If we ever get around to changing cpumask_size
to return only possibly CPUs, we will also need to
make the format of the cpumap file.

We should probably also make libnuma able to deal with
the modified kernel interface, so it can operate on
all kernels.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Ken Werner <ken.werner@web.de>
Cc: stable@kernel.org
Cc: Andi Kleen <andi@firstfloor.org>

--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -497,7 +497,7 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
 	unsigned long *k;
 	unsigned int min_length = cpumask_size();
 
-	if (nr_cpu_ids <= BITS_PER_COMPAT_LONG)
+	if (NR_CPUS <= BITS_PER_COMPAT_LONG)
 		min_length = sizeof(compat_ulong_t);
 
 	if (len < min_length)

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-12-15 14:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 12:45 cpumask: fix compat getaffinity Arnd Bergmann
2010-05-08  8:30 ` Rusty Russell
2010-05-08  9:11   ` Arnd Bergmann
2010-05-10 23:43     ` Rusty Russell
2010-05-11  1:47       ` KOSAKI Motohiro
2010-05-11  3:13         ` [stable] " Greg KH
2010-05-11  5:51           ` Rusty Russell
2010-05-11  6:25             ` KOSAKI Motohiro
2010-05-11  6:20           ` KOSAKI Motohiro
2010-05-11 15:20             ` Greg KH
2010-05-11 18:13               ` Arnd Bergmann
2010-05-11 21:36                 ` Greg KH
2010-05-12  8:30                 ` Milton Miller
2010-05-14 12:39                   ` Rusty Russell
2010-05-17  6:04                     ` KOSAKI Motohiro
2010-05-17 18:58                       ` Arnd Bergmann
2010-05-18  0:57                       ` Rusty Russell
2010-12-14 16:59                       ` Josh Hunt
2010-12-15 14:40                         ` Arnd Bergmann
2010-06-22 23:30                   ` Rusty Russell
2010-05-11  9:05       ` Arnd Bergmann
2010-05-12  0:52         ` KOSAKI Motohiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.