[PATCH] Drop tasklist lock in do_sched_setscheduler
authorThomas Gleixner <[email protected]>
Tue, 27 Jun 2006 09:55:00 +0000 (02:55 -0700)
committerLinus Torvalds <[email protected]>
Wed, 28 Jun 2006 00:32:47 +0000 (17:32 -0700)
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 <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Nick Piggin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/sched.c

index 08431f07a999f56e7be0f2f685f19df7119264ac..7a30addfd235f73195fca9943c7e9d80bba617f2 100644 (file)
@@ -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;
 }