diff options
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 31 |
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) | |||
760 | static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup) | 760 | static 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) | |||
779 | static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep) | 790 | static 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 | /* |