[PATCH] introduce is_rt_policy() helper

Imho, makes the code a bit easier to read.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: 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]>
This commit is contained in:
Oleg Nesterov 2006-09-29 02:00:49 -07:00 • committed by Linus Torvalds
commit 57a6f51c42
2 changed files with 4 additions and 5 deletions

View file

@ -4109,8 +4109,7 @@ recheck:
(p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
(!p->mm && param->sched_priority > MAX_RT_PRIO-1))
return -EINVAL;
if ((policy == SCHED_NORMAL || policy == SCHED_BATCH)
!= (param->sched_priority == 0))
if (is_rt_policy(policy) != (param->sched_priority != 0))
return -EINVAL;
/*
@ -4134,7 +4133,7 @@ recheck:
!rlim_rtprio)
return -EPERM;
/* can't increase priority */
if ((policy != SCHED_NORMAL && policy != SCHED_BATCH) &&
if (is_rt_policy(policy) &&
param->sched_priority > p->rt_priority &&
param->sched_priority > rlim_rtprio)
return -EPERM;