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.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c37c5141037b..61d9b6c1ebc9 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;
@@ -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 */
467struct thread_group_cputime { 472struct 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
@@ -1032,6 +1036,10 @@ struct sched_entity {
1032 u64 last_wakeup; 1036 u64 last_wakeup;
1033 u64 avg_overlap; 1037 u64 avg_overlap;
1034 1038
1039 u64 start_runtime;
1040 u64 avg_wakeup;
1041 u64 nr_migrations;
1042
1035#ifdef CONFIG_SCHEDSTATS 1043#ifdef CONFIG_SCHEDSTATS
1036 u64 wait_start; 1044 u64 wait_start;
1037 u64 wait_max; 1045 u64 wait_max;
@@ -1047,7 +1055,6 @@ struct sched_entity {
1047 u64 exec_max; 1055 u64 exec_max;
1048 u64 slice_max; 1056 u64 slice_max;
1049 1057
1050 u64 nr_migrations;
1051 u64 nr_migrations_cold; 1058 u64 nr_migrations_cold;
1052 u64 nr_failed_migrations_affine; 1059 u64 nr_failed_migrations_affine;
1053 u64 nr_failed_migrations_running; 1060 u64 nr_failed_migrations_running;
@@ -2182,24 +2189,30 @@ static inline int spin_needbreak(spinlock_t *lock)
2182 * Thread group CPU time accounting. 2189 * Thread group CPU time accounting.
2183 */ 2190 */
2184 2191
2185extern int thread_group_cputime_alloc(struct task_struct *); 2192static inline
2186extern void thread_group_cputime(struct task_struct *, struct task_cputime *); 2193void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
2187
2188static inline void thread_group_cputime_init(struct signal_struct *sig)
2189{ 2194{
2190 sig->cputime.totals = NULL; 2195 struct task_cputime *totals = &tsk->signal->cputime.totals;
2196 unsigned long flags;
2197
2198 spin_lock_irqsave(&totals->lock, flags);
2199 *times = *totals;
2200 spin_unlock_irqrestore(&totals->lock, flags);
2191} 2201}
2192 2202
2193static inline int thread_group_cputime_clone_thread(struct task_struct *curr) 2203static inline void thread_group_cputime_init(struct signal_struct *sig)
2194{ 2204{
2195 if (curr->signal->cputime.totals) 2205 sig->cputime.totals = (struct task_cputime){
2196 return 0; 2206 .utime = cputime_zero,
2197 return thread_group_cputime_alloc(curr); 2207 .stime = cputime_zero,
2208 .sum_exec_runtime = 0,
2209 };
2210
2211 spin_lock_init(&sig->cputime.totals.lock);
2198} 2212}
2199 2213
2200static inline void thread_group_cputime_free(struct signal_struct *sig) 2214static inline void thread_group_cputime_free(struct signal_struct *sig)
2201{ 2215{
2202 free_percpu(sig->cputime.totals);
2203} 2216}
2204 2217
2205/* 2218/*