diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:15:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:15:21 -0400 |
commit | f9e8e07e074a880e110922759dcdb369fecdf07c (patch) | |
tree | 61bc9a61e0a0546a81d699047d9e001c50b52d50 /kernel/sched.c | |
parent | e9886ca3a93d7d041d3de8e5acebe213da777d59 (diff) | |
parent | 066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff) |
Merge branch 'linus' into sched-devel
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 07d5472dee99..554de4009803 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -315,12 +315,15 @@ static DEFINE_SPINLOCK(task_group_lock); | |||
315 | #endif /* CONFIG_USER_SCHED */ | 315 | #endif /* CONFIG_USER_SCHED */ |
316 | 316 | ||
317 | /* | 317 | /* |
318 | * A weight of 0, 1 or ULONG_MAX can cause arithmetics problems. | 318 | * A weight of 0 or 1 can cause arithmetics problems. |
319 | * A weight of a cfs_rq is the sum of weights of which entities | ||
320 | * are queued on this cfs_rq, so a weight of a entity should not be | ||
321 | * too large, so as the shares value of a task group. | ||
319 | * (The default weight is 1024 - so there's no practical | 322 | * (The default weight is 1024 - so there's no practical |
320 | * limitation from this.) | 323 | * limitation from this.) |
321 | */ | 324 | */ |
322 | #define MIN_SHARES 2 | 325 | #define MIN_SHARES 2 |
323 | #define MAX_SHARES (ULONG_MAX - 1) | 326 | #define MAX_SHARES (1UL << 18) |
324 | 327 | ||
325 | static int init_task_group_load = INIT_TASK_GROUP_LOAD; | 328 | static int init_task_group_load = INIT_TASK_GROUP_LOAD; |
326 | #endif | 329 | #endif |
@@ -1346,8 +1349,13 @@ calc_delta_mine(unsigned long delta_exec, unsigned long weight, | |||
1346 | { | 1349 | { |
1347 | u64 tmp; | 1350 | u64 tmp; |
1348 | 1351 | ||
1349 | if (!lw->inv_weight) | 1352 | if (!lw->inv_weight) { |
1350 | lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)/(lw->weight+1); | 1353 | if (BITS_PER_LONG > 32 && unlikely(lw->weight >= WMULT_CONST)) |
1354 | lw->inv_weight = 1; | ||
1355 | else | ||
1356 | lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2) | ||
1357 | / (lw->weight+1); | ||
1358 | } | ||
1351 | 1359 | ||
1352 | tmp = (u64)delta_exec * weight; | 1360 | tmp = (u64)delta_exec * weight; |
1353 | /* | 1361 | /* |
@@ -4166,12 +4174,10 @@ need_resched_nonpreemptible: | |||
4166 | clear_tsk_need_resched(prev); | 4174 | clear_tsk_need_resched(prev); |
4167 | 4175 | ||
4168 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { | 4176 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { |
4169 | if (unlikely((prev->state & TASK_INTERRUPTIBLE) && | 4177 | if (unlikely(signal_pending_state(prev->state, prev))) |
4170 | signal_pending(prev))) { | ||
4171 | prev->state = TASK_RUNNING; | 4178 | prev->state = TASK_RUNNING; |
4172 | } else { | 4179 | else |
4173 | deactivate_task(rq, prev, 1); | 4180 | deactivate_task(rq, prev, 1); |
4174 | } | ||
4175 | switch_count = &prev->nvcsw; | 4181 | switch_count = &prev->nvcsw; |
4176 | } | 4182 | } |
4177 | 4183 | ||