aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-11 03:22:04 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-11 03:22:04 -0500
commit95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c (patch)
treeaa2aac22a5b329b778a6771a87bbf1945ad49bbd /include/linux/sched.h
parentd278c48435625cb6b7edcf6a547620768b175709 (diff)
parent8e4921515c1a379539607eb443d51c30f4f7f338 (diff)
Merge commit 'v2.6.29-rc4' into perfcounters/core
Conflicts: arch/x86/kernel/setup_percpu.c arch/x86/mm/fault.c drivers/acpi/processor_idle.c kernel/irq/handle.c
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 1e5f70062a9c..7200c1bb8dde 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -296,6 +296,9 @@ extern void sched_show_task(struct task_struct *p);
296extern void softlockup_tick(void); 296extern void softlockup_tick(void);
297extern void touch_softlockup_watchdog(void); 297extern void touch_softlockup_watchdog(void);
298extern void touch_all_softlockup_watchdogs(void); 298extern void touch_all_softlockup_watchdogs(void);
299extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
300 struct file *filp, void __user *buffer,
301 size_t *lenp, loff_t *ppos);
299extern unsigned int softlockup_panic; 302extern unsigned int softlockup_panic;
300extern unsigned long sysctl_hung_task_check_count; 303extern unsigned long sysctl_hung_task_check_count;
301extern unsigned long sysctl_hung_task_timeout_secs; 304extern unsigned long sysctl_hung_task_timeout_secs;
@@ -443,6 +446,7 @@ struct pacct_struct {
443 * @utime: time spent in user mode, in &cputime_t units 446 * @utime: time spent in user mode, in &cputime_t units
444 * @stime: time spent in kernel mode, in &cputime_t units 447 * @stime: time spent in kernel mode, in &cputime_t units
445 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds 448 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds
449 * @lock: lock for fields in this struct
446 * 450 *
447 * This structure groups together three kinds of CPU time that are 451 * This structure groups together three kinds of CPU time that are
448 * tracked for threads and thread groups. Most things considering 452 * tracked for threads and thread groups. Most things considering
@@ -453,6 +457,7 @@ struct task_cputime {
453 cputime_t utime; 457 cputime_t utime;
454 cputime_t stime; 458 cputime_t stime;
455 unsigned long long sum_exec_runtime; 459 unsigned long long sum_exec_runtime;
460 spinlock_t lock;
456}; 461};
457/* Alternate field names when used to cache expirations. */ 462/* Alternate field names when used to cache expirations. */
458#define prof_exp stime 463#define prof_exp stime
@@ -468,7 +473,7 @@ struct task_cputime {
468 * used for thread group CPU clock calculations. 473 * used for thread group CPU clock calculations.
469 */ 474 */
470struct thread_group_cputime { 475struct thread_group_cputime {
471 struct task_cputime *totals; 476 struct task_cputime totals;
472}; 477};
473 478
474/* 479/*
@@ -629,7 +634,6 @@ struct user_struct {
629 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ 634 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
630#endif 635#endif
631#ifdef CONFIG_EPOLL 636#ifdef CONFIG_EPOLL
632 atomic_t epoll_devs; /* The number of epoll descriptors currently open */
633 atomic_t epoll_watches; /* The number of file descriptors currently watched */ 637 atomic_t epoll_watches; /* The number of file descriptors currently watched */
634#endif 638#endif
635#ifdef CONFIG_POSIX_MQUEUE 639#ifdef CONFIG_POSIX_MQUEUE
@@ -2197,24 +2201,30 @@ static inline int spin_needbreak(spinlock_t *lock)
2197 * Thread group CPU time accounting. 2201 * Thread group CPU time accounting.
2198 */ 2202 */
2199 2203
2200extern int thread_group_cputime_alloc(struct task_struct *); 2204static inline
2201extern void thread_group_cputime(struct task_struct *, struct task_cputime *); 2205void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
2202
2203static inline void thread_group_cputime_init(struct signal_struct *sig)
2204{ 2206{
2205 sig->cputime.totals = NULL; 2207 struct task_cputime *totals = &tsk->signal->cputime.totals;
2208 unsigned long flags;
2209
2210 spin_lock_irqsave(&totals->lock, flags);
2211 *times = *totals;
2212 spin_unlock_irqrestore(&totals->lock, flags);
2206} 2213}
2207 2214
2208static inline int thread_group_cputime_clone_thread(struct task_struct *curr) 2215static inline void thread_group_cputime_init(struct signal_struct *sig)
2209{ 2216{
2210 if (curr->signal->cputime.totals) 2217 sig->cputime.totals = (struct task_cputime){
2211 return 0; 2218 .utime = cputime_zero,
2212 return thread_group_cputime_alloc(curr); 2219 .stime = cputime_zero,
2220 .sum_exec_runtime = 0,
2221 };
2222
2223 spin_lock_init(&sig->cputime.totals.lock);
2213} 2224}
2214 2225
2215static inline void thread_group_cputime_free(struct signal_struct *sig) 2226static inline void thread_group_cputime_free(struct signal_struct *sig)
2216{ 2227{
2217 free_percpu(sig->cputime.totals);
2218} 2228}
2219 2229
2220/* 2230/*