Fixed set_affinity/get_affinity syscalls
PATCH 1/1 Fixed set_affinity/get_affinity syscalls
It's a little more kernel code, but it allows userspace to do:
unsigned int mask = (1 << cpu);
sys_setaffinity(getpid(), LINUX_AFFINITY_INCLUDE, mask, sizeof(mask));And it will always do the Right Thing.
Applies on top of last patch.
Comments?
Name: Modified set_affinity/get_affinity syscalls
Author: Rusty Russell
Status: Experimental
Depends: Hotcpu/cpumask.patch.gz
D: This allows userspace to have cpu affinity control without needing
D: to know the size of kernel datastructures and allows them to
D: control what happens when new CPUs are brought online. It also
D: means that in the future we can sanely interpret affinity in
D: HyperThreading.
include/linux/affinity.h +9 -0
@@ -0,0 +1,9 @@ +#ifndef _LINUX_AFFINITY_H +#define _LINUX_AFFINITY_H +enum { +/* Set affinity to these processors */ +LINUX_AFFINITY_INCLUDE , +/* Set affinity to all *but* these processors */ +LINUX_AFFINITY_EXCLUDE , +}; +#endif
kernel/sched.c +52 -31
126 lines not on this page · raw message
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.