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-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
"Misc fixes: two NUMA fixes, two cputime fixes and an RCU/lockdep fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/cputime: Fix clock_nanosleep()/clock_gettime() inconsistency
sched/cputime: Fix cpu_timer_sample_group() double accounting
sched/numa: Avoid selecting oneself as swap target
sched/numa: Fix out of bounds read in sched_init_numa()
sched: Remove lockdep check in sched_move_task()

+42 -48
-5
include/linux/kernel_stat.h
··· 77 77 return kstat_cpu(cpu).irqs_sum; 78 78 } 79 79 80 - /* 81 - * Lock/unlock the current runqueue - to extract task statistics: 82 - */ 83 - extern unsigned long long task_delta_exec(struct task_struct *); 84 - 85 80 extern void account_user_time(struct task_struct *, cputime_t, cputime_t); 86 81 extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); 87 82 extern void account_steal_time(cputime_t);
+21 -42
kernel/sched/core.c
··· 2475 2475 EXPORT_PER_CPU_SYMBOL(kernel_cpustat); 2476 2476 2477 2477 /* 2478 - * Return any ns on the sched_clock that have not yet been accounted in 2479 - * @p in case that task is currently running. 2480 - * 2481 - * Called with task_rq_lock() held on @rq. 2482 - */ 2483 - static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq) 2484 - { 2485 - u64 ns = 0; 2486 - 2487 - /* 2488 - * Must be ->curr _and_ ->on_rq. If dequeued, we would 2489 - * project cycles that may never be accounted to this 2490 - * thread, breaking clock_gettime(). 2491 - */ 2492 - if (task_current(rq, p) && task_on_rq_queued(p)) { 2493 - update_rq_clock(rq); 2494 - ns = rq_clock_task(rq) - p->se.exec_start; 2495 - if ((s64)ns < 0) 2496 - ns = 0; 2497 - } 2498 - 2499 - return ns; 2500 - } 2501 - 2502 - unsigned long long task_delta_exec(struct task_struct *p) 2503 - { 2504 - unsigned long flags; 2505 - struct rq *rq; 2506 - u64 ns = 0; 2507 - 2508 - rq = task_rq_lock(p, &flags); 2509 - ns = do_task_delta_exec(p, rq); 2510 - task_rq_unlock(rq, p, &flags); 2511 - 2512 - return ns; 2513 - } 2514 - 2515 - /* 2516 2478 * Return accounted runtime for the task. 2517 2479 * In case the task is currently running, return the runtime plus current's 2518 2480 * pending runtime that have not been accounted yet. ··· 2483 2521 { 2484 2522 unsigned long flags; 2485 2523 struct rq *rq; 2486 - u64 ns = 0; 2524 + u64 ns; 2487 2525 2488 2526 #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) 2489 2527 /* ··· 2502 2540 #endif 2503 2541 2504 2542 rq = task_rq_lock(p, &flags); 2505 - ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); 2543 + /* 2544 + * Must be ->curr _and_ ->on_rq. If dequeued, we would 2545 + * project cycles that may never be accounted to this 2546 + * thread, breaking clock_gettime(). 2547 + */ 2548 + if (task_current(rq, p) && task_on_rq_queued(p)) { 2549 + update_rq_clock(rq); 2550 + p->sched_class->update_curr(rq); 2551 + } 2552 + ns = p->se.sum_exec_runtime; 2506 2553 task_rq_unlock(rq, p, &flags); 2507 2554 2508 2555 return ns; ··· 6339 6368 if (!sched_debug()) 6340 6369 break; 6341 6370 } 6371 + 6372 + if (!level) 6373 + return; 6374 + 6342 6375 /* 6343 6376 * 'level' contains the number of unique distances, excluding the 6344 6377 * identity distance node_distance(i,i). ··· 7419 7444 if (unlikely(running)) 7420 7445 put_prev_task(rq, tsk); 7421 7446 7422 - tg = container_of(task_css_check(tsk, cpu_cgrp_id, 7423 - lockdep_is_held(&tsk->sighand->siglock)), 7447 + /* 7448 + * All callers are synchronized by task_rq_lock(); we do not use RCU 7449 + * which is pointless here. Thus, we pass "true" to task_css_check() 7450 + * to prevent lockdep warnings. 7451 + */ 7452 + tg = container_of(task_css_check(tsk, cpu_cgrp_id, true), 7424 7453 struct task_group, css); 7425 7454 tg = autogroup_task_group(tsk, tg); 7426 7455 tsk->sched_task_group = tg;
+2
kernel/sched/deadline.c
··· 1701 1701 .prio_changed = prio_changed_dl, 1702 1702 .switched_from = switched_from_dl, 1703 1703 .switched_to = switched_to_dl, 1704 + 1705 + .update_curr = update_curr_dl, 1704 1706 };
+14
kernel/sched/fair.c
··· 726 726 account_cfs_rq_runtime(cfs_rq, delta_exec); 727 727 } 728 728 729 + static void update_curr_fair(struct rq *rq) 730 + { 731 + update_curr(cfs_rq_of(&rq->curr->se)); 732 + } 733 + 729 734 static inline void 730 735 update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) 731 736 { ··· 1183 1178 if ((cur->flags & PF_EXITING) || is_idle_task(cur)) 1184 1179 cur = NULL; 1185 1180 raw_spin_unlock_irq(&dst_rq->lock); 1181 + 1182 + /* 1183 + * Because we have preemption enabled we can get migrated around and 1184 + * end try selecting ourselves (current == env->p) as a swap candidate. 1185 + */ 1186 + if (cur == env->p) 1187 + goto unlock; 1186 1188 1187 1189 /* 1188 1190 * "imp" is the fault differential for the source task between the ··· 7960 7948 .switched_to = switched_to_fair, 7961 7949 7962 7950 .get_rr_interval = get_rr_interval_fair, 7951 + 7952 + .update_curr = update_curr_fair, 7963 7953 7964 7954 #ifdef CONFIG_FAIR_GROUP_SCHED 7965 7955 .task_move_group = task_move_group_fair,
+2
kernel/sched/rt.c
··· 2128 2128 2129 2129 .prio_changed = prio_changed_rt, 2130 2130 .switched_to = switched_to_rt, 2131 + 2132 + .update_curr = update_curr_rt, 2131 2133 }; 2132 2134 2133 2135 #ifdef CONFIG_SCHED_DEBUG
+2
kernel/sched/sched.h
··· 1135 1135 unsigned int (*get_rr_interval) (struct rq *rq, 1136 1136 struct task_struct *task); 1137 1137 1138 + void (*update_curr) (struct rq *rq); 1139 + 1138 1140 #ifdef CONFIG_FAIR_GROUP_SCHED 1139 1141 void (*task_move_group) (struct task_struct *p, int on_rq); 1140 1142 #endif
+1 -1
kernel/time/posix-cpu-timers.c
··· 553 553 *sample = cputime_to_expires(cputime.utime); 554 554 break; 555 555 case CPUCLOCK_SCHED: 556 - *sample = cputime.sum_exec_runtime + task_delta_exec(p); 556 + *sample = cputime.sum_exec_runtime; 557 557 break; 558 558 } 559 559 return 0;