diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4cae9b81a1f8..2127e959e0f4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -293,6 +293,9 @@ extern void sched_show_task(struct task_struct *p); | |||
| 293 | extern void softlockup_tick(void); | 293 | extern void softlockup_tick(void); |
| 294 | extern void touch_softlockup_watchdog(void); | 294 | extern void touch_softlockup_watchdog(void); |
| 295 | extern void touch_all_softlockup_watchdogs(void); | 295 | extern void touch_all_softlockup_watchdogs(void); |
| 296 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | ||
| 297 | struct file *filp, void __user *buffer, | ||
| 298 | size_t *lenp, loff_t *ppos); | ||
| 296 | extern unsigned int softlockup_panic; | 299 | extern unsigned int softlockup_panic; |
| 297 | extern unsigned long sysctl_hung_task_check_count; | 300 | extern unsigned long sysctl_hung_task_check_count; |
| 298 | extern unsigned long sysctl_hung_task_timeout_secs; | 301 | extern unsigned long sysctl_hung_task_timeout_secs; |
| @@ -440,6 +443,7 @@ struct pacct_struct { | |||
| 440 | * @utime: time spent in user mode, in &cputime_t units | 443 | * @utime: time spent in user mode, in &cputime_t units |
| 441 | * @stime: time spent in kernel mode, in &cputime_t units | 444 | * @stime: time spent in kernel mode, in &cputime_t units |
| 442 | * @sum_exec_runtime: total time spent on the CPU, in nanoseconds | 445 | * @sum_exec_runtime: total time spent on the CPU, in nanoseconds |
| 446 | * @lock: lock for fields in this struct | ||
| 443 | * | 447 | * |
| 444 | * This structure groups together three kinds of CPU time that are | 448 | * This structure groups together three kinds of CPU time that are |
| 445 | * tracked for threads and thread groups. Most things considering | 449 | * tracked for threads and thread groups. Most things considering |
| @@ -450,6 +454,7 @@ struct task_cputime { | |||
| 450 | cputime_t utime; | 454 | cputime_t utime; |
| 451 | cputime_t stime; | 455 | cputime_t stime; |
| 452 | unsigned long long sum_exec_runtime; | 456 | unsigned long long sum_exec_runtime; |
| 457 | spinlock_t lock; | ||
| 453 | }; | 458 | }; |
| 454 | /* Alternate field names when used to cache expirations. */ | 459 | /* Alternate field names when used to cache expirations. */ |
| 455 | #define prof_exp stime | 460 | #define prof_exp stime |
| @@ -465,7 +470,7 @@ struct task_cputime { | |||
| 465 | * used for thread group CPU clock calculations. | 470 | * used for thread group CPU clock calculations. |
| 466 | */ | 471 | */ |
| 467 | struct thread_group_cputime { | 472 | struct thread_group_cputime { |
| 468 | struct task_cputime *totals; | 473 | struct task_cputime totals; |
| 469 | }; | 474 | }; |
| 470 | 475 | ||
| 471 | /* | 476 | /* |
| @@ -626,7 +631,6 @@ struct user_struct { | |||
| 626 | atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ | 631 | atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ |
| 627 | #endif | 632 | #endif |
| 628 | #ifdef CONFIG_EPOLL | 633 | #ifdef CONFIG_EPOLL |
| 629 | atomic_t epoll_devs; /* The number of epoll descriptors currently open */ | ||
| 630 | atomic_t epoll_watches; /* The number of file descriptors currently watched */ | 634 | atomic_t epoll_watches; /* The number of file descriptors currently watched */ |
| 631 | #endif | 635 | #endif |
| 632 | #ifdef CONFIG_POSIX_MQUEUE | 636 | #ifdef CONFIG_POSIX_MQUEUE |
| @@ -2180,24 +2184,30 @@ static inline int spin_needbreak(spinlock_t *lock) | |||
| 2180 | * Thread group CPU time accounting. | 2184 | * Thread group CPU time accounting. |
| 2181 | */ | 2185 | */ |
| 2182 | 2186 | ||
| 2183 | extern int thread_group_cputime_alloc(struct task_struct *); | 2187 | static inline |
| 2184 | extern void thread_group_cputime(struct task_struct *, struct task_cputime *); | 2188 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) |
| 2185 | |||
| 2186 | static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
| 2187 | { | 2189 | { |
| 2188 | sig->cputime.totals = NULL; | 2190 | struct task_cputime *totals = &tsk->signal->cputime.totals; |
| 2191 | unsigned long flags; | ||
| 2192 | |||
| 2193 | spin_lock_irqsave(&totals->lock, flags); | ||
| 2194 | *times = *totals; | ||
| 2195 | spin_unlock_irqrestore(&totals->lock, flags); | ||
| 2189 | } | 2196 | } |
| 2190 | 2197 | ||
| 2191 | static inline int thread_group_cputime_clone_thread(struct task_struct *curr) | 2198 | static inline void thread_group_cputime_init(struct signal_struct *sig) |
| 2192 | { | 2199 | { |
| 2193 | if (curr->signal->cputime.totals) | 2200 | sig->cputime.totals = (struct task_cputime){ |
| 2194 | return 0; | 2201 | .utime = cputime_zero, |
| 2195 | return thread_group_cputime_alloc(curr); | 2202 | .stime = cputime_zero, |
| 2203 | .sum_exec_runtime = 0, | ||
| 2204 | }; | ||
| 2205 | |||
| 2206 | spin_lock_init(&sig->cputime.totals.lock); | ||
| 2196 | } | 2207 | } |
| 2197 | 2208 | ||
| 2198 | static inline void thread_group_cputime_free(struct signal_struct *sig) | 2209 | static inline void thread_group_cputime_free(struct signal_struct *sig) |
| 2199 | { | 2210 | { |
| 2200 | free_percpu(sig->cputime.totals); | ||
| 2201 | } | 2211 | } |
| 2202 | 2212 | ||
| 2203 | /* | 2213 | /* |
