All of lore.kernel.org
 help / color / mirror / Atom feed
From: liyu <liyu@ccoss.com.cn>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [Question]How to restrict some kind of task?
Date: Tue, 15 Nov 2005 18:18:19 +0800	[thread overview]
Message-ID: <4379B5EB.40709@ccoss.com.cn> (raw)

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

   
   
 


             reply	other threads:[~2005-11-15 10:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-15 10:18 liyu [this message]
2005-11-15 10:21 ` [Question]How to restrict some kind of task? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4379B5EB.40709@ccoss.com.cn \
    --to=liyu@ccoss.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.