Skip to contentSkip to conversation

updated 2.5 task affinity syscalls

PATCH New Robert Love 1 participant 1 message Mar 12, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 updated 2.5 task affinity syscalls

Here is a resync of the task affinity syscalls against 2.5.7-pre1; futex() is now using one of the syscall numbers the previous patch used.

This patch implements two new syscalls:

int sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *new_mask_ptr)

int sched_getaffinity(pid_t pid, unsigned int *user_len_ptr,
unsigned long *user_mask_ptr)

which set and get a task's CPU affinity (task->cpus_allowed).

They provide forward-compatibility with cpus_allowed changes, implement security, and use the existing set_cpus_allowed function in the new scheduler.

The implementation is based on my proc-based code and Ingo Molnar's previous syscall affinity patch for 2.4.

Well-tested on both UP and SMP.

Robert Love

arch/i386/kernel/entry.S +2 -0
diff -urN linux-2.5.7-pre1/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S
@@ -718,6 +718,8 @@
 	.long SYMBOL_NAME(sys_tkill)
 	.long SYMBOL_NAME(sys_sendfile64)
 	.long SYMBOL_NAME(sys_futex)		/* 240 */
+	.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 +2 -0
diff -urN linux-2.5.7-pre1/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h
@@ -245,6 +245,8 @@
 #define __NR_tkill		238
 #define __NR_sendfile64		239
 #define __NR_futex		240
+#define __NR_sched_setaffinity	241
+#define __NR_sched_getaffinity	242
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
kernel/sched.c +90 -0

96 lines not on this page · raw message