summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-03-02 20:52:17 +0100
committerRichard Braun <rbraun@sceen.net>2013-03-02 20:52:17 +0100
commit600ef79895e9ff28ffaa35ce58da46b2c5be313f (patch)
tree43292807b85aa53c0d2cf6d718afeda480868b01 /kern/thread.c
parent9734aaaf782c3ca013a040d009228cb240fe41e1 (diff)
kern/thread: fix group work scaling
The scaled work isn't relative to the thread weight being added or removed, it's actually the new group work.
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 8d5f47bb..b1574f35 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -395,10 +395,8 @@ thread_sched_ts_add(struct thread_runq *runq, struct thread *thread)
thread->ts_ctx.weight)
: thread_sched_ts_add_scale_group(group->work, group->weight,
group_weight);
-
- assert(work <= thread->ts_ctx.weight);
- ts_runq->work += work;
- group->work += work;
+ ts_runq->work += work - group->work;
+ group->work = work;
}
ts_runq->weight = total_weight;
@@ -438,13 +436,10 @@ thread_sched_ts_remove(struct thread_runq *runq, struct thread *thread)
group_weight = group->weight - thread->ts_ctx.weight;
work = thread_sched_ts_remove_scale(group->work, group->weight,
group_weight);
- assert(work <= thread->ts_ctx.weight);
- group->weight -= thread->ts_ctx.weight;
- assert(work <= group->work);
- group->work -= work;
+ ts_runq->work -= group->work - work;
+ group->work = work;
ts_runq->weight -= thread->ts_ctx.weight;
- assert(work <= ts_runq->work);
- ts_runq->work -= work;
+ group->weight -= thread->ts_ctx.weight;
if (ts_runq->weight == 0)
ts_runq->current = NULL;