sched-2.5.24-D3, batch/idle priority scheduling, SCHED_BATCH
Hello.
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
And users of
__KERNEL_SYSCALLS__andkernel_thread()should not have policy ==SCHED_BATCH.well, there's one security consequence here - module loading (
request_module()), which spawns a kernel thread must not run asSCHED_BATCH. I think the right solution for that path is to set the policy toSCHED_OTHERupon entry, and restore it to the previous one afterwards - this way the helper thread hasSCHED_OTHERpriority.i've solved this problem by making
kernel_thread()spawned threads drop back toSCHED_NORMAL:
Note that request_module() also does waitpid(). So it's better to change policy upon entry, as You suggested.
Quoted 2 lines
I believe this is the secure way of doing it - independently of
SCHED_BATCH- a RT task should not spawn a RT kernel thread 'unwillingly'.
Yes, but this semantic change should be ported to all archs independently of
low level microoptimizations, for consistency. Rename all definitions to arch_kernel_thread() ?
Btw, how about this tiny bit of cleanup:
asmlinkage void schedule_userspace(void)
{
/*
* Only handle batch tasks that are runnable.
*/
if (current->policy == SCHED_BATCH &&
current->state == TASK_RUNNING) {
runqueue_t *rq = this_rq_lock();
deactivate_batch_task(current, rq);
// we can keep irqs disabled:
spin_unlock(&rq->lock);
}
schedule();
}Oleg.