diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-07-25 12:56:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-09-13 05:11:55 -0400 |
commit | ee30a7b2fc072f139dac44826860d2c1f422137c (patch) | |
tree | 4f11173879b25cc31822cb0a8d9dbd48395e74bc | |
parent | 07354eb1a74d1e1ece29f8bafe0b46e8c77a95ef (diff) |
locking, sched: Annotate thread_group_cputimer as raw
The thread_group_cputimer lock can be taken in atomic context and therefore
cannot be preempted on -rt - annotate it.
In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/init_task.h | 2 | ||||
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | kernel/posix-cpu-timers.c | 12 | ||||
-rw-r--r-- | kernel/sched_stats.h | 12 |
4 files changed, 15 insertions, 15 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index d14e058aaee..08ffab01e76 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -42,7 +42,7 @@ extern struct fs_struct init_fs; | |||
42 | .cputimer = { \ | 42 | .cputimer = { \ |
43 | .cputime = INIT_CPUTIME, \ | 43 | .cputime = INIT_CPUTIME, \ |
44 | .running = 0, \ | 44 | .running = 0, \ |
45 | .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \ | 45 | .lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \ |
46 | }, \ | 46 | }, \ |
47 | .cred_guard_mutex = \ | 47 | .cred_guard_mutex = \ |
48 | __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ | 48 | __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4ac2c0578e0..e672236c08e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -510,7 +510,7 @@ struct task_cputime { | |||
510 | struct thread_group_cputimer { | 510 | struct thread_group_cputimer { |
511 | struct task_cputime cputime; | 511 | struct task_cputime cputime; |
512 | int running; | 512 | int running; |
513 | spinlock_t lock; | 513 | raw_spinlock_t lock; |
514 | }; | 514 | }; |
515 | 515 | ||
516 | #include <linux/rwsem.h> | 516 | #include <linux/rwsem.h> |
@@ -2566,7 +2566,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times); | |||
2566 | 2566 | ||
2567 | static inline void thread_group_cputime_init(struct signal_struct *sig) | 2567 | static inline void thread_group_cputime_init(struct signal_struct *sig) |
2568 | { | 2568 | { |
2569 | spin_lock_init(&sig->cputimer.lock); | 2569 | raw_spin_lock_init(&sig->cputimer.lock); |
2570 | } | 2570 | } |
2571 | 2571 | ||
2572 | /* | 2572 | /* |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 58f405b581e..41440cca55a 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -274,7 +274,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) | |||
274 | struct task_cputime sum; | 274 | struct task_cputime sum; |
275 | unsigned long flags; | 275 | unsigned long flags; |
276 | 276 | ||
277 | spin_lock_irqsave(&cputimer->lock, flags); | 277 | raw_spin_lock_irqsave(&cputimer->lock, flags); |
278 | if (!cputimer->running) { | 278 | if (!cputimer->running) { |
279 | cputimer->running = 1; | 279 | cputimer->running = 1; |
280 | /* | 280 | /* |
@@ -287,7 +287,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) | |||
287 | update_gt_cputime(&cputimer->cputime, &sum); | 287 | update_gt_cputime(&cputimer->cputime, &sum); |
288 | } | 288 | } |
289 | *times = cputimer->cputime; | 289 | *times = cputimer->cputime; |
290 | spin_unlock_irqrestore(&cputimer->lock, flags); | 290 | raw_spin_unlock_irqrestore(&cputimer->lock, flags); |
291 | } | 291 | } |
292 | 292 | ||
293 | /* | 293 | /* |
@@ -997,9 +997,9 @@ static void stop_process_timers(struct signal_struct *sig) | |||
997 | struct thread_group_cputimer *cputimer = &sig->cputimer; | 997 | struct thread_group_cputimer *cputimer = &sig->cputimer; |
998 | unsigned long flags; | 998 | unsigned long flags; |
999 | 999 | ||
1000 | spin_lock_irqsave(&cputimer->lock, flags); | 1000 | raw_spin_lock_irqsave(&cputimer->lock, flags); |
1001 | cputimer->running = 0; | 1001 | cputimer->running = 0; |
1002 | spin_unlock_irqrestore(&cputimer->lock, flags); | 1002 | raw_spin_unlock_irqrestore(&cputimer->lock, flags); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | static u32 onecputick; | 1005 | static u32 onecputick; |
@@ -1289,9 +1289,9 @@ static inline int fastpath_timer_check(struct task_struct *tsk) | |||
1289 | if (sig->cputimer.running) { | 1289 | if (sig->cputimer.running) { |
1290 | struct task_cputime group_sample; | 1290 | struct task_cputime group_sample; |
1291 | 1291 | ||
1292 | spin_lock(&sig->cputimer.lock); | 1292 | raw_spin_lock(&sig->cputimer.lock); |
1293 | group_sample = sig->cputimer.cputime; | 1293 | group_sample = sig->cputimer.cputime; |
1294 | spin_unlock(&sig->cputimer.lock); | 1294 | raw_spin_unlock(&sig->cputimer.lock); |
1295 | 1295 | ||
1296 | if (task_cputime_expired(&group_sample, &sig->cputime_expires)) | 1296 | if (task_cputime_expired(&group_sample, &sig->cputime_expires)) |
1297 | return 1; | 1297 | return 1; |
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h index 331e01bcd02..87f9e36ea56 100644 --- a/kernel/sched_stats.h +++ b/kernel/sched_stats.h | |||
@@ -282,10 +282,10 @@ static inline void account_group_user_time(struct task_struct *tsk, | |||
282 | if (!cputimer->running) | 282 | if (!cputimer->running) |
283 | return; | 283 | return; |
284 | 284 | ||
285 | spin_lock(&cputimer->lock); | 285 | raw_spin_lock(&cputimer->lock); |
286 | cputimer->cputime.utime = | 286 | cputimer->cputime.utime = |
287 | cputime_add(cputimer->cputime.utime, cputime); | 287 | cputime_add(cputimer->cputime.utime, cputime); |
288 | spin_unlock(&cputimer->lock); | 288 | raw_spin_unlock(&cputimer->lock); |
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
@@ -306,10 +306,10 @@ static inline void account_group_system_time(struct task_struct *tsk, | |||
306 | if (!cputimer->running) | 306 | if (!cputimer->running) |
307 | return; | 307 | return; |
308 | 308 | ||
309 | spin_lock(&cputimer->lock); | 309 | raw_spin_lock(&cputimer->lock); |
310 | cputimer->cputime.stime = | 310 | cputimer->cputime.stime = |
311 | cputime_add(cputimer->cputime.stime, cputime); | 311 | cputime_add(cputimer->cputime.stime, cputime); |
312 | spin_unlock(&cputimer->lock); | 312 | raw_spin_unlock(&cputimer->lock); |
313 | } | 313 | } |
314 | 314 | ||
315 | /** | 315 | /** |
@@ -330,7 +330,7 @@ static inline void account_group_exec_runtime(struct task_struct *tsk, | |||
330 | if (!cputimer->running) | 330 | if (!cputimer->running) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | spin_lock(&cputimer->lock); | 333 | raw_spin_lock(&cputimer->lock); |
334 | cputimer->cputime.sum_exec_runtime += ns; | 334 | cputimer->cputime.sum_exec_runtime += ns; |
335 | spin_unlock(&cputimer->lock); | 335 | raw_spin_unlock(&cputimer->lock); |
336 | } | 336 | } |