Chinaunix首页 | 论坛 | 博客
  • 博客访问: 437486
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-09-10 14:58:14

 KERNEL_VERSION:linux-2.6.34

deactivate_task() ----remove a task from the run queue



static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
{

/* check if p->state is uninterruptible */
    if (task_contributes_to_load(p))
        rq->nr_uninterruptible++;


/* it will call dequeue_task in specific schedule class */
    dequeue_task(rq, p, sleep);

/* rq->nr_running-- */
    dec_nr_running(rq);
}




dequeue_task --- called by deactivate_task

static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
{
    if (sleep) {

/* current task had been wake up last time */
        if (p->se.last_wakeup) {
            update_avg(&p->se.avg_overlap,
                p->se.sum_exec_runtime - p->se.last_wakeup);
            p->se.last_wakeup = 0;
        } else {
            update_avg(&p->se.avg_wakeup,
                sysctl_sched_wakeup_granularity);
        }
    }

    sched_info_dequeued(p);
    p->sched_class->dequeue_task(rq, p, sleep);
    p->se.on_rq = 0;
}


阅读(1608) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~