[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140317125541.17043cxzmlnxa0ys@intranet.cs.hku.hk>
Date: Mon, 17 Mar 2014 12:55:41 +0800
From: lwcheng@...hku.hk
To: linux-kernel@...r.kernel.org
Subject: [Question] Linux CFS sched_entity
Hi,
I am studying Linux CFS recently. After numerous searches, I am still
unable to get rid of the following question. Finally I decide to bother
this group for the answer.
In group scheduling, sched_entity can represent both "task group" and "task",
indicated by "se->my_q".
When CFS tries to pick a new task, it first selects a "task group" and then
selects a "task" from that "task group":
--------------
static struct task_struct *pick_next_task_fair(struct rq *rq)
{
struct task_struct *p;
struct cfs_rq *cfs_rq = &rq->cfs;
struct sched_entity *se;
... ...
do {
se = pick_next_entity(cfs_rq);
set_next_entity(cfs_rq, se);
cfs_rq = group_cfs_rq(se);
} while (cfs_rq);
p = task_of(se);
... ...
}
--------------
Therefore, cfs_rq->curr should *always* represent a "task" here, right?
However, cfs_rq->curr seems *not* to be a "task" sometimes:
--------------
static void update_curr(struct cfs_rq *cfs_rq)
{
struct sched_entity *curr = cfs_rq->curr;
... ...
if (entity_is_task(curr)) { /* WHY? */
struct task_struct *curtask = task_of(curr);
trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
cpuacct_charge(curtask, delta_exec);
account_group_exec_runtime(curtask, delta_exec);
}
... ...
}
--------------
My question is:
In what situations does cfs_rq->curr point to a task_group?
What's the sense? I thought it should always contain a "real" task.
Appreciated for anyone who is able to help. Thanks in advance!
Regards,
Luwei Cheng
--
CS Student
The University of Hong Kong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists