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.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4cae9b81a1f8..02e16d207304 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;
@@ -450,6 +453,7 @@ struct task_cputime {
450 cputime_t utime; 453 cputime_t utime;
451 cputime_t stime; 454 cputime_t stime;
452 unsigned long long sum_exec_runtime; 455 unsigned long long sum_exec_runtime;
456 spinlock_t lock;
453}; 457};
454/* Alternate field names when used to cache expirations. */ 458/* Alternate field names when used to cache expirations. */
455#define prof_exp stime 459#define prof_exp stime
@@ -465,7 +469,7 @@ struct task_cputime {
465 * used for thread group CPU clock calculations. 469 * used for thread group CPU clock calculations.
466 */ 470 */
467struct thread_group_cputime { 471struct thread_group_cputime {
468 struct task_cputime *totals; 472 struct task_cputime totals;
469}; 473};
470 474
471/* 475/*
@@ -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
2183extern int thread_group_cputime_alloc(struct task_struct *); 2187static inline
2184extern void thread_group_cputime(struct task_struct *, struct task_cputime *); 2188void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
2185
2186static 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
2191static inline int thread_group_cputime_clone_thread(struct task_struct *curr) 2198static 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
2198static inline void thread_group_cputime_free(struct signal_struct *sig) 2209static inline void thread_group_cputime_free(struct signal_struct *sig)
2199{ 2210{
2200 free_percpu(sig->cputime.totals);
2201} 2211}
2202 2212
2203/* 2213/*