Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1184404

[PATCH v10 5/7] sched: Remove task and group entity load when they are dead

From Yuyang Du <yuyang.du@intel.com>
Newsgroups linux.kernel
Subject [PATCH v10 5/7] sched: Remove task and group entity load when they are dead
Date 2015-07-15 10:00 +0200
Message-ID <pMpLI-18z-13@gated-at.bofh.it> (permalink)
References <pMpLH-18z-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When task exits or group is destroyed, the entity's load should be
removed from its parent cfs_rq's load. Otherwise, it will take time
for the parent cfs_rq to decay the dead entity's load to 0, which
is not desired.

Signed-off-by: Yuyang Du <yuyang.du@intel.com>
---
 kernel/sched/fair.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index edc404c..19f1199 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4919,6 +4919,11 @@ static void migrate_task_rq_fair(struct task_struct *p, int next_cpu)
 	/* We have migrated, no longer consider this task hot */
 	p->se.exec_start = 0;
 }
+
+static void task_dead_fair(struct task_struct *p)
+{
+	remove_entity_load_avg(&p->se);
+}
 #endif /* CONFIG_SMP */
 
 static unsigned long
@@ -8027,8 +8032,11 @@ void free_fair_sched_group(struct task_group *tg)
 	for_each_possible_cpu(i) {
 		if (tg->cfs_rq)
 			kfree(tg->cfs_rq[i]);
-		if (tg->se)
+		if (tg->se) {
+			if (tg->se[i])
+				remove_entity_load_avg(tg->se[i]);
 			kfree(tg->se[i]);
+		}
 	}
 
 	kfree(tg->cfs_rq);
@@ -8215,6 +8223,7 @@ const struct sched_class fair_sched_class = {
 	.rq_offline		= rq_offline_fair,
 
 	.task_waking		= task_waking_fair,
+	.task_dead			= task_dead_fair,
 #endif
 
 	.set_curr_task          = set_curr_task_fair,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v10 0/7] sched: Rewrite runnable load and utilization average tracking  Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 7/7] sched: Clean up load average references Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 1/7] sched: Remove rq's runnable avg Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 4/7] sched: Init cfs_rq's sched_entity load average Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 5/7] sched: Remove task and group entity load when they are dead Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200
  [PATCH v10 3/7] sched: Implement update_blocked_averages() for CONFIG_FAIR_GROUP_SCHED=n Yuyang Du <yuyang.du@intel.com> - 2015-07-15 10:00 +0200

csiph-web