diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 16:19:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 16:19:56 -0400 |
commit | 99ebcf8285df28f32fd2d1c19a7166e70f00309c (patch) | |
tree | caf45f39a77026b2fae2413c145067a1e5164701 /include/linux/sched.h | |
parent | 72558dde738b06cc01e16b3247a9659ca739e22d (diff) | |
parent | c465a76af658b443075d6efee1c3131257643020 (diff) |
Merge branch 'v28-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'v28-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (36 commits)
fix documentation of sysrq-q really
Fix documentation of sysrq-q
timer_list: add base address to clock base
timer_list: print cpu number of clockevents device
timer_list: print real timer address
NOHZ: restart tick device from irq_enter()
NOHZ: split tick_nohz_restart_sched_tick()
NOHZ: unify the nohz function calls in irq_enter()
timers: fix itimer/many thread hang, fix
timers: fix itimer/many thread hang, v3
ntp: improve adjtimex frequency rounding
timekeeping: fix rounding problem during clock update
ntp: let update_persistent_clock() sleep
hrtimer: reorder struct hrtimer to save 8 bytes on 64bit builds
posix-timers: lock_timer: make it readable
posix-timers: lock_timer: kill the bogus ->it_id check
posix-timers: kill ->it_sigev_signo and ->it_sigev_value
posix-timers: sys_timer_create: cleanup the error handling
posix-timers: move the initialization of timer->sigq from send to create path
posix-timers: sys_timer_create: simplify and s/tasklist/rcu/
...
Fix trivial conflicts due to sysrq-q description clahes in
Documentation/sysrq.txt and drivers/char/sysrq.c
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 84 |
1 files changed, 71 insertions, 13 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index f52dbd3587a7..5c38db536e07 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -434,6 +434,39 @@ struct pacct_struct { | |||
434 | unsigned long ac_minflt, ac_majflt; | 434 | unsigned long ac_minflt, ac_majflt; |
435 | }; | 435 | }; |
436 | 436 | ||
437 | /** | ||
438 | * struct task_cputime - collected CPU time counts | ||
439 | * @utime: time spent in user mode, in &cputime_t units | ||
440 | * @stime: time spent in kernel mode, in &cputime_t units | ||
441 | * @sum_exec_runtime: total time spent on the CPU, in nanoseconds | ||
442 | * | ||
443 | * This structure groups together three kinds of CPU time that are | ||
444 | * tracked for threads and thread groups. Most things considering | ||
445 | * CPU time want to group these counts together and treat all three | ||
446 | * of them in parallel. | ||
447 | */ | ||
448 | struct task_cputime { | ||
449 | cputime_t utime; | ||
450 | cputime_t stime; | ||
451 | unsigned long long sum_exec_runtime; | ||
452 | }; | ||
453 | /* Alternate field names when used to cache expirations. */ | ||
454 | #define prof_exp stime | ||
455 | #define virt_exp utime | ||
456 | #define sched_exp sum_exec_runtime | ||
457 | |||
458 | /** | ||
459 | * struct thread_group_cputime - thread group interval timer counts | ||
460 | * @totals: thread group interval timers; substructure for | ||
461 | * uniprocessor kernel, per-cpu for SMP kernel. | ||
462 | * | ||
463 | * This structure contains the version of task_cputime, above, that is | ||
464 | * used for thread group CPU clock calculations. | ||
465 | */ | ||
466 | struct thread_group_cputime { | ||
467 | struct task_cputime *totals; | ||
468 | }; | ||
469 | |||
437 | /* | 470 | /* |
438 | * NOTE! "signal_struct" does not have it's own | 471 | * NOTE! "signal_struct" does not have it's own |
439 | * locking, because a shared signal_struct always | 472 | * locking, because a shared signal_struct always |
@@ -479,6 +512,17 @@ struct signal_struct { | |||
479 | cputime_t it_prof_expires, it_virt_expires; | 512 | cputime_t it_prof_expires, it_virt_expires; |
480 | cputime_t it_prof_incr, it_virt_incr; | 513 | cputime_t it_prof_incr, it_virt_incr; |
481 | 514 | ||
515 | /* | ||
516 | * Thread group totals for process CPU clocks. | ||
517 | * See thread_group_cputime(), et al, for details. | ||
518 | */ | ||
519 | struct thread_group_cputime cputime; | ||
520 | |||
521 | /* Earliest-expiration cache. */ | ||
522 | struct task_cputime cputime_expires; | ||
523 | |||
524 | struct list_head cpu_timers[3]; | ||
525 | |||
482 | /* job control IDs */ | 526 | /* job control IDs */ |
483 | 527 | ||
484 | /* | 528 | /* |
@@ -509,7 +553,7 @@ struct signal_struct { | |||
509 | * Live threads maintain their own counters and add to these | 553 | * Live threads maintain their own counters and add to these |
510 | * in __exit_signal, except for the group leader. | 554 | * in __exit_signal, except for the group leader. |
511 | */ | 555 | */ |
512 | cputime_t utime, stime, cutime, cstime; | 556 | cputime_t cutime, cstime; |
513 | cputime_t gtime; | 557 | cputime_t gtime; |
514 | cputime_t cgtime; | 558 | cputime_t cgtime; |
515 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 559 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
@@ -518,14 +562,6 @@ struct signal_struct { | |||
518 | struct task_io_accounting ioac; | 562 | struct task_io_accounting ioac; |
519 | 563 | ||
520 | /* | 564 | /* |
521 | * Cumulative ns of scheduled CPU time for dead threads in the | ||
522 | * group, not including a zombie group leader. (This only differs | ||
523 | * from jiffies_to_ns(utime + stime) if sched_clock uses something | ||
524 | * other than jiffies.) | ||
525 | */ | ||
526 | unsigned long long sum_sched_runtime; | ||
527 | |||
528 | /* | ||
529 | * We don't bother to synchronize most readers of this at all, | 565 | * We don't bother to synchronize most readers of this at all, |
530 | * because there is no reader checking a limit that actually needs | 566 | * because there is no reader checking a limit that actually needs |
531 | * to get both rlim_cur and rlim_max atomically, and either one | 567 | * to get both rlim_cur and rlim_max atomically, and either one |
@@ -536,8 +572,6 @@ struct signal_struct { | |||
536 | */ | 572 | */ |
537 | struct rlimit rlim[RLIM_NLIMITS]; | 573 | struct rlimit rlim[RLIM_NLIMITS]; |
538 | 574 | ||
539 | struct list_head cpu_timers[3]; | ||
540 | |||
541 | /* keep the process-shared keyrings here so that they do the right | 575 | /* keep the process-shared keyrings here so that they do the right |
542 | * thing in threads created with CLONE_THREAD */ | 576 | * thing in threads created with CLONE_THREAD */ |
543 | #ifdef CONFIG_KEYS | 577 | #ifdef CONFIG_KEYS |
@@ -1146,8 +1180,7 @@ struct task_struct { | |||
1146 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ | 1180 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ |
1147 | unsigned long min_flt, maj_flt; | 1181 | unsigned long min_flt, maj_flt; |
1148 | 1182 | ||
1149 | cputime_t it_prof_expires, it_virt_expires; | 1183 | struct task_cputime cputime_expires; |
1150 | unsigned long long it_sched_expires; | ||
1151 | struct list_head cpu_timers[3]; | 1184 | struct list_head cpu_timers[3]; |
1152 | 1185 | ||
1153 | /* process credentials */ | 1186 | /* process credentials */ |
@@ -1597,6 +1630,7 @@ extern unsigned long long cpu_clock(int cpu); | |||
1597 | 1630 | ||
1598 | extern unsigned long long | 1631 | extern unsigned long long |
1599 | task_sched_runtime(struct task_struct *task); | 1632 | task_sched_runtime(struct task_struct *task); |
1633 | extern unsigned long long thread_group_sched_runtime(struct task_struct *task); | ||
1600 | 1634 | ||
1601 | /* sched_exec is called by processes performing an exec */ | 1635 | /* sched_exec is called by processes performing an exec */ |
1602 | #ifdef CONFIG_SMP | 1636 | #ifdef CONFIG_SMP |
@@ -2094,6 +2128,30 @@ static inline int spin_needbreak(spinlock_t *lock) | |||
2094 | } | 2128 | } |
2095 | 2129 | ||
2096 | /* | 2130 | /* |
2131 | * Thread group CPU time accounting. | ||
2132 | */ | ||
2133 | |||
2134 | extern int thread_group_cputime_alloc(struct task_struct *); | ||
2135 | extern void thread_group_cputime(struct task_struct *, struct task_cputime *); | ||
2136 | |||
2137 | static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
2138 | { | ||
2139 | sig->cputime.totals = NULL; | ||
2140 | } | ||
2141 | |||
2142 | static inline int thread_group_cputime_clone_thread(struct task_struct *curr) | ||
2143 | { | ||
2144 | if (curr->signal->cputime.totals) | ||
2145 | return 0; | ||
2146 | return thread_group_cputime_alloc(curr); | ||
2147 | } | ||
2148 | |||
2149 | static inline void thread_group_cputime_free(struct signal_struct *sig) | ||
2150 | { | ||
2151 | free_percpu(sig->cputime.totals); | ||
2152 | } | ||
2153 | |||
2154 | /* | ||
2097 | * Reevaluate whether the task has signals pending delivery. | 2155 | * Reevaluate whether the task has signals pending delivery. |
2098 | * Wake the task if so. | 2156 | * Wake the task if so. |
2099 | * This is required every time the blocked sigset_t changes. | 2157 | * This is required every time the blocked sigset_t changes. |