Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: 64-bit: fix arithmetics overflow
sched: fair group: fix overflow(was: fix divide by zero)
sched: fix TASK_WAKEKILL vs SIGKILL race

+27 -8
+13
include/linux/sched.h
··· 2026 2026 return signal_pending(p) && __fatal_signal_pending(p); 2027 2027 } 2028 2028 2029 + static inline int signal_pending_state(long state, struct task_struct *p) 2030 + { 2031 + if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL))) 2032 + return 0; 2033 + if (!signal_pending(p)) 2034 + return 0; 2035 + 2036 + if (state & (__TASK_STOPPED | __TASK_TRACED)) 2037 + return 0; 2038 + 2039 + return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); 2040 + } 2041 + 2029 2042 static inline int need_resched(void) 2030 2043 { 2031 2044 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
+14 -8
kernel/sched.c
··· 312 312 #endif 313 313 314 314 /* 315 - * A weight of 0, 1 or ULONG_MAX can cause arithmetics problems. 315 + * A weight of 0 or 1 can cause arithmetics problems. 316 + * A weight of a cfs_rq is the sum of weights of which entities 317 + * are queued on this cfs_rq, so a weight of a entity should not be 318 + * too large, so as the shares value of a task group. 316 319 * (The default weight is 1024 - so there's no practical 317 320 * limitation from this.) 318 321 */ 319 322 #define MIN_SHARES 2 320 - #define MAX_SHARES (ULONG_MAX - 1) 323 + #define MAX_SHARES (1UL << 18) 321 324 322 325 static int init_task_group_load = INIT_TASK_GROUP_LOAD; 323 326 #endif ··· 1340 1337 { 1341 1338 u64 tmp; 1342 1339 1343 - if (!lw->inv_weight) 1344 - lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)/(lw->weight+1); 1340 + if (!lw->inv_weight) { 1341 + if (BITS_PER_LONG > 32 && unlikely(lw->weight >= WMULT_CONST)) 1342 + lw->inv_weight = 1; 1343 + else 1344 + lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2) 1345 + / (lw->weight+1); 1346 + } 1345 1347 1346 1348 tmp = (u64)delta_exec * weight; 1347 1349 /* ··· 4167 4159 clear_tsk_need_resched(prev); 4168 4160 4169 4161 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { 4170 - if (unlikely((prev->state & TASK_INTERRUPTIBLE) && 4171 - signal_pending(prev))) { 4162 + if (unlikely(signal_pending_state(prev->state, prev))) 4172 4163 prev->state = TASK_RUNNING; 4173 - } else { 4164 + else 4174 4165 deactivate_task(rq, prev, 1); 4175 - } 4176 4166 switch_count = &prev->nvcsw; 4177 4167 } 4178 4168