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