diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-26 12:47:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-26 12:47:43 -0500 |
commit | 1e70c7f7a9d4a3d2cc78b40e1d7768d99cd79899 (patch) | |
tree | 1218c32008412e57314f8f9db8d3b4912e2ecb25 /include | |
parent | 810ee58de26c9c1255d716b1db7344c4a1093fec (diff) | |
parent | 1d4a7f1c4faf53eb9e822743ec8a70b3019a26d2 (diff) |
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
hrtimers: fix inconsistent lock state on resume in hres_timers_resume
time-sched.c: tick_nohz_update_jiffies should be static
locking, hpet: annotate false positive warning
kernel/fork.c: unused variable 'ret'
itimers: remove the per-cpu-ish-ness
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/init_task.h | 6 | ||||
-rw-r--r-- | include/linux/sched.h | 29 | ||||
-rw-r--r-- | include/linux/workqueue.h | 6 |
3 files changed, 30 insertions, 11 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 2f3c2d4ef73b..ea0ea1a4c36f 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -48,6 +48,12 @@ extern struct fs_struct init_fs; | |||
48 | .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ | 48 | .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ |
49 | .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ | 49 | .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ |
50 | .rlim = INIT_RLIMITS, \ | 50 | .rlim = INIT_RLIMITS, \ |
51 | .cputime = { .totals = { \ | ||
52 | .utime = cputime_zero, \ | ||
53 | .stime = cputime_zero, \ | ||
54 | .sum_exec_runtime = 0, \ | ||
55 | .lock = __SPIN_LOCK_UNLOCKED(sig.cputime.totals.lock), \ | ||
56 | }, }, \ | ||
51 | } | 57 | } |
52 | 58 | ||
53 | extern struct nsproxy init_nsproxy; | 59 | extern struct nsproxy init_nsproxy; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4cae9b81a1f8..c20943eabb4c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -450,6 +450,7 @@ struct task_cputime { | |||
450 | cputime_t utime; | 450 | cputime_t utime; |
451 | cputime_t stime; | 451 | cputime_t stime; |
452 | unsigned long long sum_exec_runtime; | 452 | unsigned long long sum_exec_runtime; |
453 | spinlock_t lock; | ||
453 | }; | 454 | }; |
454 | /* Alternate field names when used to cache expirations. */ | 455 | /* Alternate field names when used to cache expirations. */ |
455 | #define prof_exp stime | 456 | #define prof_exp stime |
@@ -465,7 +466,7 @@ struct task_cputime { | |||
465 | * used for thread group CPU clock calculations. | 466 | * used for thread group CPU clock calculations. |
466 | */ | 467 | */ |
467 | struct thread_group_cputime { | 468 | struct thread_group_cputime { |
468 | struct task_cputime *totals; | 469 | struct task_cputime totals; |
469 | }; | 470 | }; |
470 | 471 | ||
471 | /* | 472 | /* |
@@ -2180,24 +2181,30 @@ static inline int spin_needbreak(spinlock_t *lock) | |||
2180 | * Thread group CPU time accounting. | 2181 | * Thread group CPU time accounting. |
2181 | */ | 2182 | */ |
2182 | 2183 | ||
2183 | extern int thread_group_cputime_alloc(struct task_struct *); | 2184 | static inline |
2184 | extern void thread_group_cputime(struct task_struct *, struct task_cputime *); | 2185 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) |
2185 | |||
2186 | static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
2187 | { | 2186 | { |
2188 | sig->cputime.totals = NULL; | 2187 | struct task_cputime *totals = &tsk->signal->cputime.totals; |
2188 | unsigned long flags; | ||
2189 | |||
2190 | spin_lock_irqsave(&totals->lock, flags); | ||
2191 | *times = *totals; | ||
2192 | spin_unlock_irqrestore(&totals->lock, flags); | ||
2189 | } | 2193 | } |
2190 | 2194 | ||
2191 | static inline int thread_group_cputime_clone_thread(struct task_struct *curr) | 2195 | static inline void thread_group_cputime_init(struct signal_struct *sig) |
2192 | { | 2196 | { |
2193 | if (curr->signal->cputime.totals) | 2197 | sig->cputime.totals = (struct task_cputime){ |
2194 | return 0; | 2198 | .utime = cputime_zero, |
2195 | return thread_group_cputime_alloc(curr); | 2199 | .stime = cputime_zero, |
2200 | .sum_exec_runtime = 0, | ||
2201 | }; | ||
2202 | |||
2203 | spin_lock_init(&sig->cputime.totals.lock); | ||
2196 | } | 2204 | } |
2197 | 2205 | ||
2198 | static inline void thread_group_cputime_free(struct signal_struct *sig) | 2206 | static inline void thread_group_cputime_free(struct signal_struct *sig) |
2199 | { | 2207 | { |
2200 | free_percpu(sig->cputime.totals); | ||
2201 | } | 2208 | } |
2202 | 2209 | ||
2203 | /* | 2210 | /* |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index b36291130f22..47151c8495aa 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -118,6 +118,12 @@ struct execute_work { | |||
118 | init_timer(&(_work)->timer); \ | 118 | init_timer(&(_work)->timer); \ |
119 | } while (0) | 119 | } while (0) |
120 | 120 | ||
121 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | ||
122 | do { \ | ||
123 | INIT_WORK(&(_work)->work, (_func)); \ | ||
124 | init_timer_on_stack(&(_work)->timer); \ | ||
125 | } while (0) | ||
126 | |||
121 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ | 127 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ |
122 | do { \ | 128 | do { \ |
123 | INIT_WORK(&(_work)->work, (_func)); \ | 129 | INIT_WORK(&(_work)->work, (_func)); \ |