diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index f18300eddfcb..dc8871295a5a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -513,6 +513,7 @@ struct thread_group_cputimer { | |||
513 | spinlock_t lock; | 513 | spinlock_t lock; |
514 | }; | 514 | }; |
515 | 515 | ||
516 | #include <linux/rwsem.h> | ||
516 | struct autogroup; | 517 | struct autogroup; |
517 | 518 | ||
518 | /* | 519 | /* |
@@ -632,6 +633,16 @@ struct signal_struct { | |||
632 | unsigned audit_tty; | 633 | unsigned audit_tty; |
633 | struct tty_audit_buf *tty_audit_buf; | 634 | struct tty_audit_buf *tty_audit_buf; |
634 | #endif | 635 | #endif |
636 | #ifdef CONFIG_CGROUPS | ||
637 | /* | ||
638 | * The threadgroup_fork_lock prevents threads from forking with | ||
639 | * CLONE_THREAD while held for writing. Use this for fork-sensitive | ||
640 | * threadgroup-wide operations. It's taken for reading in fork.c in | ||
641 | * copy_process(). | ||
642 | * Currently only needed write-side by cgroups. | ||
643 | */ | ||
644 | struct rw_semaphore threadgroup_fork_lock; | ||
645 | #endif | ||
635 | 646 | ||
636 | int oom_adj; /* OOM kill score adjustment (bit shift) */ | 647 | int oom_adj; /* OOM kill score adjustment (bit shift) */ |
637 | int oom_score_adj; /* OOM kill score adjustment */ | 648 | int oom_score_adj; /* OOM kill score adjustment */ |
@@ -2323,6 +2334,31 @@ static inline void unlock_task_sighand(struct task_struct *tsk, | |||
2323 | spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); | 2334 | spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); |
2324 | } | 2335 | } |
2325 | 2336 | ||
2337 | /* See the declaration of threadgroup_fork_lock in signal_struct. */ | ||
2338 | #ifdef CONFIG_CGROUPS | ||
2339 | static inline void threadgroup_fork_read_lock(struct task_struct *tsk) | ||
2340 | { | ||
2341 | down_read(&tsk->signal->threadgroup_fork_lock); | ||
2342 | } | ||
2343 | static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) | ||
2344 | { | ||
2345 | up_read(&tsk->signal->threadgroup_fork_lock); | ||
2346 | } | ||
2347 | static inline void threadgroup_fork_write_lock(struct task_struct *tsk) | ||
2348 | { | ||
2349 | down_write(&tsk->signal->threadgroup_fork_lock); | ||
2350 | } | ||
2351 | static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) | ||
2352 | { | ||
2353 | up_write(&tsk->signal->threadgroup_fork_lock); | ||
2354 | } | ||
2355 | #else | ||
2356 | static inline void threadgroup_fork_read_lock(struct task_struct *tsk) {} | ||
2357 | static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) {} | ||
2358 | static inline void threadgroup_fork_write_lock(struct task_struct *tsk) {} | ||
2359 | static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) {} | ||
2360 | #endif | ||
2361 | |||
2326 | #ifndef __HAVE_THREAD_FUNCTIONS | 2362 | #ifndef __HAVE_THREAD_FUNCTIONS |
2327 | 2363 | ||
2328 | #define task_thread_info(task) ((struct thread_info *)(task)->stack) | 2364 | #define task_thread_info(task) ((struct thread_info *)(task)->stack) |