sched:
Hi,
sched: Maintain only task entities in cfs_rq->tasks list.
cfs_rq->tasks list is used by the load balancer to iterate over all the tasks. Currently it holds all the entities (both task and group entities) because of which there is a need to check for group entities explicitly during load balancing. This patch changes the cfs_rq->tasks list to hold only task entities.
--- kernel/sched_fair.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
kernel/sched_fair.c +9 -17
@@ -586,11 +586,12 @@ account_entity_enqueue(struct cfs_rq *cfupdate_load_add (&cfs_rq->load, se->load.weight);if (!parent_entity (se))inc_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, se->load.weight); +list_add (&se->group_node, &cfs_rq->tasks); + } cfs_rq->nr_running++; se->on_rq =1 ; -list_add (&se->group_node, &cfs_rq->tasks); } static void
@@ -599,11 +600,12 @@ account_entity_dequeue(struct cfs_rq *cfupdate_load_sub (&cfs_rq->load, se->load.weight);if (!parent_entity (se))dec_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, -se->load.weight); +list_del_init (&se->group_node); + } cfs_rq->nr_running--; se->on_rq =0 ; -list_del_init (&se->group_node); }static void enqueue_sleeper (struct cfs_rq *cfs_rq,struct sched_entity *se)
@@ -1445,19 +1447,9 @@ __load_balance_iterator(struct cfs_rq *cif (next == &cfs_rq->tasks)return NULL ; -/* Skip over entities that are not tasks */ -do { - se = list_entry(next, struct sched_entity, group_node); - next = next->next; - }while (next != &cfs_rq->tasks && !entity_is_task (se)); - -if (next == &cfs_rq->tasks) -return NULL ; - - cfs_rq->balance_iterator = next; - -if (entity_is_task (se)) - p =task_of (se); + se = list_entry(next, struct sched_entity, group_node); + p =task_of (se); + cfs_rq->balance_iterator = next->next;return p; }
Regards,
Bharata.
sched: Maintain only task entities in cfs_rq->tasks list.
Oops, missed the subject line in the last post :(
[repost]
sched: Maintain only task entities in cfs_rq->tasks list.
cfs_rq->tasks list is used by the load balancer to iterate over all the tasks. Currently it holds all the entities (both task and group entities) because of which there is a need to check for group entities explicitly during load balancing. This patch changes the cfs_rq->tasks list to hold only task entities.
--- kernel/sched_fair.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
kernel/sched_fair.c +9 -17
@@ -586,11 +586,12 @@ account_entity_enqueue(struct cfs_rq *cfupdate_load_add (&cfs_rq->load, se->load.weight);if (!parent_entity (se))inc_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, se->load.weight); +list_add (&se->group_node, &cfs_rq->tasks); + } cfs_rq->nr_running++; se->on_rq =1 ; -list_add (&se->group_node, &cfs_rq->tasks); } static void
@@ -599,11 +600,12 @@ account_entity_dequeue(struct cfs_rq *cfupdate_load_sub (&cfs_rq->load, se->load.weight);if (!parent_entity (se))dec_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, -se->load.weight); +list_del_init (&se->group_node); + } cfs_rq->nr_running--; se->on_rq =0 ; -list_del_init (&se->group_node); }static void enqueue_sleeper (struct cfs_rq *cfs_rq,struct sched_entity *se)
@@ -1445,19 +1447,9 @@ __load_balance_iterator(struct cfs_rq *cif (next == &cfs_rq->tasks)return NULL ; -/* Skip over entities that are not tasks */ -do { - se = list_entry(next, struct sched_entity, group_node); - next = next->next; - }while (next != &cfs_rq->tasks && !entity_is_task (se)); - -if (next == &cfs_rq->tasks) -return NULL ; - - cfs_rq->balance_iterator = next; - -if (entity_is_task (se)) - p =task_of (se); + se = list_entry(next, struct sched_entity, group_node); + p =task_of (se); + cfs_rq->balance_iterator = next->next;return p; }
Quoted 10 lines · Bharata B Rao
Hi,
sched: Maintain only task entities in
cfs_rq->taskslist.
cfs_rq->taskslist is used by the load balancer to iterate over all the tasks. Currently it holds all the entities (both task and group entities) because of which there is a need to check for group entities explicitly during load balancing. This patch changes thecfs_rq->taskslist to hold only task entities.
Looks fine. Thanks Bharata!
Quoted 66 lines
Signed-off-by Bharata B Rao <[email protected]>CC Srivatsa Vaddagiri <[email protected]>CC Peter Zijlstra <[email protected]>CC Ingo Molnar <[email protected]>--- kernel/sched_fair.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)kernel/sched_fair.c +9
-17@@ -586,11 +586,12 @@ account_entity_enqueue(struct cfs_rq *cfupdate_load_add (&cfs_rq->load, se->load.weight);if (!parent_entity (se))inc_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, se->load.weight); +list_add (&se->group_node, &cfs_rq->tasks); + } cfs_rq->nr_running++; se->on_rq =1 ; -list_add (&se->group_node, &cfs_rq->tasks); } static void@@ -599,11 +600,12 @@ account_entity_dequeue(struct cfs_rq *cfupdate_load_sub (&cfs_rq->load, se->load.weight);if (!parent_entity (se))dec_cpu_load (rq_of (cfs_rq), se->load.weight); -if (entity_is_task (se)) +if (entity_is_task (se)) {add_cfs_task_weight (cfs_rq, -se->load.weight); +list_del_init (&se->group_node); + } cfs_rq->nr_running--; se->on_rq =0 ; -list_del_init (&se->group_node); }static void enqueue_sleeper (struct cfs_rq *cfs_rq,struct sched_entity *se)@@ -1445,19 +1447,9 @@ __load_balance_iterator(struct cfs_rq *cif (next == &cfs_rq->tasks)return NULL ; -/* Skip over entities that are not tasks */ -do { - se = list_entry(next, struct sched_entity, group_node); - next = next->next; - }while (next != &cfs_rq->tasks && !entity_is_task (se)); - -if (next == &cfs_rq->tasks) -return NULL ; - - cfs_rq->balance_iterator = next; - -if (entity_is_task (se)) - p =task_of (se); + se = list_entry(next, struct sched_entity, group_node); + p =task_of (se); + cfs_rq->balance_iterator = next->next;return p; }Regards,
Bharata.
Ingo Molnar
AppliedQuoted 5 lines · Peter Zijlstra
Quoted 4 lines · Bharata B Rao
Hi,
sched: Maintain only task entities in
cfs_rq->taskslist.
Quoted 8 lines
Quoted 6 lines
cfs_rq->taskslist is used by the load balancer to iterate over all the tasks. Currently it holds all the entities (both task and group entities) because of which there is a need to check for group entities explicitly during load balancing. This patch changes thecfs_rq->taskslist to hold only task entities.Looks fine. Thanks Bharata!
applied to tip/sched/devel, thanks!
Ingo