Drop tasklist lock in do_sched_setscheduler
Quoted 8 lines · Thomas Gleixner
There is no need to hold
tasklist_lockacross the setscheduler call, when we pin the task structure withget_task_struct(). Interrupts are disabled in setscheduler anyway and the permission checks do not need interrupts disabled.
kernel/sched.c line 4148
Quoted 10 lines
kernel/sched.c +3
-1@@ -4140,8 +4140,10 @@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; }
But we don't need read_lock(tasklist) and get_task_struct(p) at all?
rcu_read_lock/rcu_read_unlock is enough, no?
Oleg.
Quoted 22 lines · Oleg Nesterov
Quoted 8 lines · Thomas Gleixner
There is no need to hold
tasklist_lockacross the setscheduler call, when we pin the task structure withget_task_struct(). Interrupts are disabled in setscheduler anyway and the permission checks do not need interrupts disabled.kernel/sched.c line 4148
Quoted 10 lines
kernel/sched.c +3
-1@@ -4140,8 +4140,10 @@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; }But we don't need
read_lock(tasklist)andget_task_struct(p)at all?
Quoted 1 line
rcu_read_lock/rcu_read_unlock is enough, no?
Probably yes, did not think about that
tglx