2.4: affinity syscalls from 2.5
PATCH 1/1 2.4: affinity syscalls from 2.5
The following patch implements
int sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr)
int sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr)
which are the task cpu affinity syscalls I wrote for 2.5 (and merged as-of 2.5.8-pre3). While the interfaces are the same, the scheduling behavior of 2.4 and 2.5 is greatly different due to differing schedules and such, so the implementation is different. This patch, thus, borrows a lot from Ingo Molnar's 2.4 affinity syscalls he posted awhile back. The interface, syscall numbers, and behavior, however, are the same as what is in 2.5.
This patch is not intended for merging into 2.4 yet, I would like to see the 2.5 syscall see more use and make sure we agree on its behavior and interface before accepting a backport into 2.4. This is intended for additional testing.
At
ftp://ftp.kernel.org/pub/linux/kernel/people/rml/cpu-affinity
I have some documentation and sample programs for those interested.
The following is against 2.4.19-pre6 .... enjoy.
Robert Love
arch/i386/kernel/entry.S +4 -0
@@ -635,6 +635,10 @@ .long SYMBOL_NAME(sys_ni_syscall) /* reserved for lremovexattr */ .long SYMBOL_NAME(sys_ni_syscall) /* reserved for fremovexattr */ .long SYMBOL_NAME(sys_tkill) + .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sendfile64 */ + .long SYMBOL_NAME(sys_ni_syscall) /* 240 reserved for futex */ + .long SYMBOL_NAME(sys_sched_setaffinity) + .long SYMBOL_NAME(sys_sched_getaffinity) .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall)
include/asm-i386/unistd.h +5 -0
@@ -242,6 +242,11 @@#define __NR_removexattr 235#define __NR_lremovexattr 236#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242#define __NR_tkill 238
include/linux/capability.h +1 -0
@@ -243,6 +243,7 @@/* Allow use of FIFO and round-robin (realtime) scheduling on own processes and setting the scheduling algorithm used by another process. */ +/* Allow setting cpu affinity on other processes */ #define CAP_SYS_NICE 23
kernel/sched.c +100 -0
106 lines not on this page · raw message