From: Thomas Gleixner Date: Tue, 27 Jun 2006 09:55:00 +0000 (-0700) Subject: [PATCH] Drop tasklist lock in do_sched_setscheduler X-Git-Tag: v2.6.18-rc1~488 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e74c69f46d93d29eea0ad8647863d1c6488f0f55;p=linux-2.6 [PATCH] Drop tasklist lock in do_sched_setscheduler There is no need to hold tasklist_lock across the setscheduler call, when we pin the task structure with get_task_struct(). Interrupts are disabled in setscheduler anyway and the permission checks do not need interrupts disabled. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Cc: Steven Rostedt Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched.c b/kernel/sched.c index 08431f07a9..7a30addfd2 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4091,8 +4091,10 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) read_unlock_irq(&tasklist_lock); return -ESRCH; } - retval = sched_setscheduler(p, policy, &lparam); + get_task_struct(p); read_unlock_irq(&tasklist_lock); + retval = sched_setscheduler(p, policy, &lparam); + put_task_struct(p); return retval; }