Skip to contentSkip to conversation

sched: __sched_setscheduler: read RLIMIT_RTPRIO lockless

PATCH In review Oleg Nesterov 1 participant 2 messages Jun 10, 2010 – Jun 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 sched: __sched_setscheduler: read RLIMIT_RTPRIO lockless

__sched_setscheduler() takes lock_task_sighand() to access task->signal. This is not needed since ea6d290c, ->signal can't go away.

---

 kernel/sched.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
kernel/sched.c renamed from kernel/sched.c~1_SETSCHED_NO_SIGLOCK +2 -6
@@ -4432,12 +4432,8 @@ recheck:
 	 */
 	if (user && !capable(CAP_SYS_NICE)) {
 		if (rt_policy(policy)) {
-			unsigned long rlim_rtprio;
-
-			if (!lock_task_sighand(p, &flags))
-				return -ESRCH;
-			rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO);
-			unlock_task_sighand(p, &flags);
+			unsigned long rlim_rtprio =
+					task_rlimit(p, RLIMIT_RTPRIO);
 
 			/* can't set/change the rt policy */
 			if (policy != p->policy && !rlim_rtprio)
#1 lore raw

[tip:sched/core] sched: __sched_setscheduler: Read the RLIMIT_RTPRIO value lockless

Commit-ID:  a44702e8858a071aa0f2365113ea4a2e51c8b575
Gitweb:     http://git.kernel.org/tip/a44702e8858a071aa0f2365113ea4a2e51c8b575
Author:     Oleg Nesterov <[email protected]>
AuthorDate: Fri, 11 Jun 2010 01:09:44 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 18 Jun 2010 10:46:55 +0200

sched: __sched_setscheduler: Read the RLIMIT_RTPRIO value lockless

__sched_setscheduler() takes lock_task_sighand() to access task->signal. This is not needed since ea6d290c, ->signal can't go away.

LKML-Reference: <[email protected]>

---
 kernel/sched.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
kernel/sched.c +2 -6
index 132950b..b4427cc 100644
@@ -4600,12 +4600,8 @@ recheck:
 	 */
 	if (user && !capable(CAP_SYS_NICE)) {
 		if (rt_policy(policy)) {
-			unsigned long rlim_rtprio;
-
-			if (!lock_task_sighand(p, &flags))
-				return -ESRCH;
-			rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO);
-			unlock_task_sighand(p, &flags);
+			unsigned long rlim_rtprio =
+					task_rlimit(p, RLIMIT_RTPRIO);
 
 			/* can't set/change the rt policy */
 			if (policy != p->policy && !rlim_rtprio)