aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-27 06:01:51 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-27 06:01:51 -0500
commit3ddeb51d9c83931c1ca6abf76a38934c5a1ed918 (patch)
treefc2efb59d627135ea2199a8a68415b162646b121 /include/linux/sched.h
parent5a611268b69f05262936dd177205acbce4471358 (diff)
parent5ee810072175042775e39bdd3eaaa68884c27805 (diff)
Merge branch 'linus' into core/percpu
Conflicts: arch/x86/kernel/setup_percpu.c
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 a85b0cec7d12..681394f3a0cf 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/*
@@ -2192,24 +2196,30 @@ static inline int spin_needbreak(spinlock_t *lock)
2192 * Thread group CPU time accounting. 2196 * Thread group CPU time accounting.
2193 */ 2197 */
2194 2198
2195extern int thread_group_cputime_alloc(struct task_struct *); 2199static inline
2196extern void thread_group_cputime(struct task_struct *, struct task_cputime *); 2200void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
2197
2198static inline void thread_group_cputime_init(struct signal_struct *sig)
2199{ 2201{
2200 sig->cputime.totals = NULL; 2202 struct task_cputime *totals = &tsk->signal->cputime.totals;
2203 unsigned long flags;
2204
2205 spin_lock_irqsave(&totals->lock, flags);
2206 *times = *totals;
2207 spin_unlock_irqrestore(&totals->lock, flags);
2201} 2208}
2202 2209
2203static inline int thread_group_cputime_clone_thread(struct task_struct *curr) 2210static inline void thread_group_cputime_init(struct signal_struct *sig)
2204{ 2211{
2205 if (curr->signal->cputime.totals) 2212 sig->cputime.totals = (struct task_cputime){
2206 return 0; 2213 .utime = cputime_zero,
2207 return thread_group_cputime_alloc(curr); 2214 .stime = cputime_zero,
2215 .sum_exec_runtime = 0,
2216 };
2217
2218 spin_lock_init(&sig->cputime.totals.lock);
2208} 2219}
2209 2220
2210static inline void thread_group_cputime_free(struct signal_struct *sig) 2221static inline void thread_group_cputime_free(struct signal_struct *sig)
2211{ 2222{
2212 free_percpu(sig->cputime.totals);
2213} 2223}
2214 2224
2215/* 2225/*