aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
authorSrivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>2008-01-25 15:08:00 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-25 15:08:00 -0500
commit58e2d4ca581167c2a079f4ee02be2f0bc52e8729 (patch)
tree9a8c8324785800f3577fb897ca3e2ae21ad8c55a /kernel/sched_fair.c
parentec2c507fe8c8fa3c04fc6cb99a382a965c477379 (diff)
sched: group scheduling, change how cpu load is calculated
This patch changes how the cpu load exerted by fair_sched_class tasks is calculated. Load exerted by fair_sched_class tasks on a cpu is now a summation of the group weights, rather than summation of task weights. Weight exerted by a group on a cpu is dependent on the shares allocated to it. This version of patch has a minor impact on code size, but should have no runtime/functional impact for !CONFIG_FAIR_GROUP_SCHED. Signed-off-by: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 0c5fdce67228..30ae9c2a2861 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -760,15 +760,26 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se)
760static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup) 760static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
761{ 761{
762 struct cfs_rq *cfs_rq; 762 struct cfs_rq *cfs_rq;
763 struct sched_entity *se = &p->se; 763 struct sched_entity *se = &p->se,
764 *topse = NULL; /* Highest schedulable entity */
765 int incload = 1;
764 766
765 for_each_sched_entity(se) { 767 for_each_sched_entity(se) {
766 if (se->on_rq) 768 topse = se;
769 if (se->on_rq) {
770 incload = 0;
767 break; 771 break;
772 }
768 cfs_rq = cfs_rq_of(se); 773 cfs_rq = cfs_rq_of(se);
769 enqueue_entity(cfs_rq, se, wakeup); 774 enqueue_entity(cfs_rq, se, wakeup);
770 wakeup = 1; 775 wakeup = 1;
771 } 776 }
777 /* Increment cpu load if we just enqueued the first task of a group on
778 * 'rq->cpu'. 'topse' represents the group to which task 'p' belongs
779 * at the highest grouping level.
780 */
781 if (incload)
782 inc_cpu_load(rq, topse->load.weight);
772} 783}
773 784
774/* 785/*
@@ -779,16 +790,28 @@ static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
779static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep) 790static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
780{ 791{
781 struct cfs_rq *cfs_rq; 792 struct cfs_rq *cfs_rq;
782 struct sched_entity *se = &p->se; 793 struct sched_entity *se = &p->se,
794 *topse = NULL; /* Highest schedulable entity */
795 int decload = 1;
783 796
784 for_each_sched_entity(se) { 797 for_each_sched_entity(se) {
798 topse = se;
785 cfs_rq = cfs_rq_of(se); 799 cfs_rq = cfs_rq_of(se);
786 dequeue_entity(cfs_rq, se, sleep); 800 dequeue_entity(cfs_rq, se, sleep);
787 /* Don't dequeue parent if it has other entities besides us */ 801 /* Don't dequeue parent if it has other entities besides us */
788 if (cfs_rq->load.weight) 802 if (cfs_rq->load.weight) {
803 if (parent_entity(se))
804 decload = 0;
789 break; 805 break;
806 }
790 sleep = 1; 807 sleep = 1;
791 } 808 }
809 /* Decrement cpu load if we just dequeued the last task of a group on
810 * 'rq->cpu'. 'topse' represents the group to which task 'p' belongs
811 * at the highest grouping level.
812 */
813 if (decload)
814 dec_cpu_load(rq, topse->load.weight);
792} 815}
793 816
794/* 817/*