task cpu affinity syscalls for 2.4
PATCH 1/1 task cpu affinity syscalls for 2.4
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. Thus, this patch borrows a lot from Ingo Molnar's 2.4 affinity syscalls he posted awhile back. The interface, syscall numbers, and behavior are the same as what is in 2.5 however.
This patch is not intended for merging into 2.4 yet, I would like to see the 2.5 syscalls 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. I am reposting this since the previous patch no longer applies to pre7.
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-pre7 .... enjoy.
Robert Love
arch/i386/kernel/entry.S +2 -2
@@ -637,8 +637,8 @@ .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_ni_syscall) /* reserved for sched_setaffinity */ - .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sched_getaffinity */ + .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/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