私は宿題を持っているので、Linuxカーネルにいくつかの機能を追加する必要があります。また、Red Hat 2.4.18に取り組んでいます。 私は、sched.cに機能set_user_nice見えた:Linuxカーネルの機能set_user_nice
p->static_prio = NICE_TO_PRIO(nice);
を:それは上記の数行は、我々はこのラインを持っているので、私は最後で正確にどのようなコードをチェック声明、 あれば理解していない
void set_user_nice(task_t *p, long nice)
{
unsigned long flags;
prio_array_t *array;
runqueue_t *rq;
if (TASK_NICE(p) == nice || nice < -20 || nice > 19)
return;
/*
* We have to be careful, if called from sys_setpriority(),
* the task might be in the middle of scheduling on another CPU.
*/
rq = task_rq_lock(p, &flags);
if (rt_task(p)) {
p->static_prio = NICE_TO_PRIO(nice);
goto out_unlock;
}
array = p->array;
if (array)
dequeue_task(p, array);
p->static_prio = NICE_TO_PRIO(nice);
p->prio = NICE_TO_PRIO(nice);
if (array) {
enqueue_task(p, array);
/*
* If the task is running and lowered its priority,
* or increased its priority then reschedule its CPU:
*/
if ((NICE_TO_PRIO(nice) < p->static_prio) || (p == rq->curr))
resched_task(rq->curr);
}
out_unlock:
task_rq_unlock(rq, &flags);
}
を
、その後、我々はチェックif文で:
(NICE_TO_PRIO(nice) < p->static_prio)
私は何かが足りないのですか? ありがとう
そうではないと思います。それは私のバグのようだ。私はこの部分の新しいソースコードを私の答えに加えました –