Skip to contentSkip to conversation

Module removal to use kthread

PATCH New Rusty Russell 1 participant 1 message Jan 30, 2004 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Module removal to use kthread

[ -mm tree only, since it needs kthread ]

module.c currently spawns threads directly to stop the machine, s a module can be atomically tested for removal.

Unfortunately, this means that the current task is manipulated (which races with set_cpus_allowed, for example), and it can't set its priority artificially high. Using a kernel thread can solve this cleanly, and with kthread_run, it's simple.

Name: Use Kthread in module.c
Author: Rusty Russell
Status: Tested on 2.6.2-rc2-mm1
Depends: Hotcpu/kthread-simple.patch.gz
Depends: Hotcpu/cpucontrol_macros.patch.gz

D: module.c currently spawns threads directly to stop the machine, s
D: a module can be atomically tested for removal.
D:
D: Unfortunately, this means that the current task is manipulated
D: (which races with set_cpus_allowed, for example), and it can't set
D: its priority artificially high. Using a kernel thread can solve
D: this cleanly, and with kthread_run, it's simple.

include/linux/sched.h +2 -0
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4985-linux-2.6.1-bk5/include/linux/sched.h .4985-linux-2.6.1-bk5.updated/include/linux/sched.h
@@ -706,6 +706,8 @@ extern task_t *child_reaper;
 extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
 extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
 extern struct task_struct * copy_process(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
+extern asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
+					      struct sched_param __user *parm);
 
 #ifdef CONFIG_SMP
 extern void wait_task_inactive(task_t * p);
kernel/module.c +80 -71

221 lines not on this page · raw message

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.