public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Question]How to restrict some kind of task?
@ 2005-11-15 10:18 liyu
  2005-11-15 10:21 ` Con Kolivas
  0 siblings, 1 reply; 8+ messages in thread
From: liyu @ 2005-11-15 10:18 UTC (permalink / raw)
  To: LKML

Hi, All.

    I want to restrict some kind of task.
   
    For example, for some task have one schedule policy SCHED_XYZ, when 
it reach beyond
40% CPU time, we force it yield CPU.
   
    I inserted some code in scheduler_tick(), like this:

>         if (check_task_overload(rq)) {
>                 if (xyz_task(p) && yield_cpu(p, rq)) {
>                         set_tsk_need_resched(p);
>                         p->prio = effective_prio(p);
>                         p->time_slice = task_timeslice(p);
>                         p->first_time_slice = 0;
>                         goto out_unlock;
>                 }
>         }


    Of course, before these code, we hold our rq->lock first, so we should
go to 'out_unlock'.
    The function xyz_task(p) just is macro (p->policy == SCHED_XYZ), and
yield_cpu() also is simple, it just move the task to expired array,

int yield_cpu(task_t *p, runqueue_t *rq)
{
    dequeue_task(p, p->array);
    requeue_task(p, rq->expired);
    return 1;
}

    These code are so simple, but is make system crash, if I create some
XYZ policy task.
   
    I tried the more radical idea (remove these tasks from runqueue to 
our one
list_head that spin_lock protected), but crash again and again.

    if need, I can paste my global patch.
   
    Thanks in advanced.

-liyu

   
   
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-11-21  1:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-15 10:18 [Question]How to restrict some kind of task? liyu
2005-11-15 10:21 ` Con Kolivas
2005-11-16  1:16   ` liyu
2005-11-17  6:20     ` liyu
2005-11-17  9:57       ` Con Kolivas
2005-11-18  8:37         ` [Question] spin_lock in interrupt handler liyu
2005-11-18 22:44           ` Steven Rostedt
2005-11-21  1:13             ` liyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox