Here's the patch again to fix the code to handle if the values between MAX_USER_RT_PRIO and MAX_RT_PRIO are different. Without this patch, an SMP system will crash if the values are different.
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) · 3485 unmodified lines | ||
| 3486 | 3486 | p->policy = policy; |
| 3487 | 3487 | p->rt_priority = prio; |
| 3488 | 3488 | if (policy != SCHED_NORMAL) |
| 3489 | − p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority; | |
| 3489 | + p->prio = MAX_RT_PRIO-1 - p->rt_priority; | |
| 3490 | 3490 | else |
| 3491 | 3491 | p->prio = p->static_prio; |
| 3492 | 3492 | } |
| @@ -3518,7 +3518,8 @@ recheck: · 25 unmodified lines | ||
| 3518 | 3518 | * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0. |
| 3519 | 3519 | */ |
| 3520 | 3520 | if (param->sched_priority < 0 || |
| 3521 | − param->sched_priority > MAX_USER_RT_PRIO-1) | |
| 3521 | + (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || | |
| 3522 | + (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) | |
| 3522 | 3523 | return -EINVAL; |
| 3523 | 3524 | if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) |
| 3524 | 3525 | return -EINVAL; |