diff options
author | James Morris <jmorris@namei.org> | 2009-05-08 03:56:47 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-05-08 03:56:47 -0400 |
commit | d254117099d711f215e62427f55dfb8ebd5ad011 (patch) | |
tree | 0848ff8dd74314fec14a86497f8d288c86ba7c65 /include/linux/sched.h | |
parent | 07ff7a0b187f3951788f64ae1f30e8109bc8e9eb (diff) | |
parent | 8c9ed899b44c19e81859fbb0e9d659fe2f8630fc (diff) |
Merge branch 'master' into next
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 120 |
1 files changed, 68 insertions, 52 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index d3b787c7aef3..3fa82b353c98 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -68,7 +68,7 @@ struct sched_param { | |||
68 | #include <linux/smp.h> | 68 | #include <linux/smp.h> |
69 | #include <linux/sem.h> | 69 | #include <linux/sem.h> |
70 | #include <linux/signal.h> | 70 | #include <linux/signal.h> |
71 | #include <linux/fs_struct.h> | 71 | #include <linux/path.h> |
72 | #include <linux/compiler.h> | 72 | #include <linux/compiler.h> |
73 | #include <linux/completion.h> | 73 | #include <linux/completion.h> |
74 | #include <linux/pid.h> | 74 | #include <linux/pid.h> |
@@ -97,6 +97,7 @@ struct futex_pi_state; | |||
97 | struct robust_list_head; | 97 | struct robust_list_head; |
98 | struct bio; | 98 | struct bio; |
99 | struct bts_tracer; | 99 | struct bts_tracer; |
100 | struct fs_struct; | ||
100 | 101 | ||
101 | /* | 102 | /* |
102 | * List of flags we want to share for kernel threads, | 103 | * List of flags we want to share for kernel threads, |
@@ -137,6 +138,8 @@ extern unsigned long nr_uninterruptible(void); | |||
137 | extern unsigned long nr_active(void); | 138 | extern unsigned long nr_active(void); |
138 | extern unsigned long nr_iowait(void); | 139 | extern unsigned long nr_iowait(void); |
139 | 140 | ||
141 | extern unsigned long get_parent_ip(unsigned long addr); | ||
142 | |||
140 | struct seq_file; | 143 | struct seq_file; |
141 | struct cfs_rq; | 144 | struct cfs_rq; |
142 | struct task_group; | 145 | struct task_group; |
@@ -202,7 +205,8 @@ extern unsigned long long time_sync_thresh; | |||
202 | #define task_is_stopped_or_traced(task) \ | 205 | #define task_is_stopped_or_traced(task) \ |
203 | ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) | 206 | ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) |
204 | #define task_contributes_to_load(task) \ | 207 | #define task_contributes_to_load(task) \ |
205 | ((task->state & TASK_UNINTERRUPTIBLE) != 0) | 208 | ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ |
209 | (task->flags & PF_FROZEN) == 0) | ||
206 | 210 | ||
207 | #define __set_task_state(tsk, state_value) \ | 211 | #define __set_task_state(tsk, state_value) \ |
208 | do { (tsk)->state = (state_value); } while (0) | 212 | do { (tsk)->state = (state_value); } while (0) |
@@ -297,17 +301,11 @@ extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | |||
297 | struct file *filp, void __user *buffer, | 301 | struct file *filp, void __user *buffer, |
298 | size_t *lenp, loff_t *ppos); | 302 | size_t *lenp, loff_t *ppos); |
299 | extern unsigned int softlockup_panic; | 303 | extern unsigned int softlockup_panic; |
300 | extern unsigned long sysctl_hung_task_check_count; | ||
301 | extern unsigned long sysctl_hung_task_timeout_secs; | ||
302 | extern unsigned long sysctl_hung_task_warnings; | ||
303 | extern int softlockup_thresh; | 304 | extern int softlockup_thresh; |
304 | #else | 305 | #else |
305 | static inline void softlockup_tick(void) | 306 | static inline void softlockup_tick(void) |
306 | { | 307 | { |
307 | } | 308 | } |
308 | static inline void spawn_softlockup_task(void) | ||
309 | { | ||
310 | } | ||
311 | static inline void touch_softlockup_watchdog(void) | 309 | static inline void touch_softlockup_watchdog(void) |
312 | { | 310 | { |
313 | } | 311 | } |
@@ -316,6 +314,15 @@ static inline void touch_all_softlockup_watchdogs(void) | |||
316 | } | 314 | } |
317 | #endif | 315 | #endif |
318 | 316 | ||
317 | #ifdef CONFIG_DETECT_HUNG_TASK | ||
318 | extern unsigned int sysctl_hung_task_panic; | ||
319 | extern unsigned long sysctl_hung_task_check_count; | ||
320 | extern unsigned long sysctl_hung_task_timeout_secs; | ||
321 | extern unsigned long sysctl_hung_task_warnings; | ||
322 | extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, | ||
323 | struct file *filp, void __user *buffer, | ||
324 | size_t *lenp, loff_t *ppos); | ||
325 | #endif | ||
319 | 326 | ||
320 | /* Attach to any functions which should be ignored in wchan output. */ | 327 | /* Attach to any functions which should be ignored in wchan output. */ |
321 | #define __sched __attribute__((__section__(".sched.text"))) | 328 | #define __sched __attribute__((__section__(".sched.text"))) |
@@ -331,7 +338,9 @@ extern signed long schedule_timeout(signed long timeout); | |||
331 | extern signed long schedule_timeout_interruptible(signed long timeout); | 338 | extern signed long schedule_timeout_interruptible(signed long timeout); |
332 | extern signed long schedule_timeout_killable(signed long timeout); | 339 | extern signed long schedule_timeout_killable(signed long timeout); |
333 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 340 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
341 | asmlinkage void __schedule(void); | ||
334 | asmlinkage void schedule(void); | 342 | asmlinkage void schedule(void); |
343 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | ||
335 | 344 | ||
336 | struct nsproxy; | 345 | struct nsproxy; |
337 | struct user_namespace; | 346 | struct user_namespace; |
@@ -389,8 +398,15 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
389 | (mm)->hiwater_vm = (mm)->total_vm; \ | 398 | (mm)->hiwater_vm = (mm)->total_vm; \ |
390 | } while (0) | 399 | } while (0) |
391 | 400 | ||
392 | #define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm)) | 401 | static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) |
393 | #define get_mm_hiwater_vm(mm) max((mm)->hiwater_vm, (mm)->total_vm) | 402 | { |
403 | return max(mm->hiwater_rss, get_mm_rss(mm)); | ||
404 | } | ||
405 | |||
406 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | ||
407 | { | ||
408 | return max(mm->hiwater_vm, mm->total_vm); | ||
409 | } | ||
394 | 410 | ||
395 | extern void set_dumpable(struct mm_struct *mm, int value); | 411 | extern void set_dumpable(struct mm_struct *mm, int value); |
396 | extern int get_dumpable(struct mm_struct *mm); | 412 | extern int get_dumpable(struct mm_struct *mm); |
@@ -538,25 +554,8 @@ struct signal_struct { | |||
538 | 554 | ||
539 | struct list_head cpu_timers[3]; | 555 | struct list_head cpu_timers[3]; |
540 | 556 | ||
541 | /* job control IDs */ | ||
542 | |||
543 | /* | ||
544 | * pgrp and session fields are deprecated. | ||
545 | * use the task_session_Xnr and task_pgrp_Xnr routines below | ||
546 | */ | ||
547 | |||
548 | union { | ||
549 | pid_t pgrp __deprecated; | ||
550 | pid_t __pgrp; | ||
551 | }; | ||
552 | |||
553 | struct pid *tty_old_pgrp; | 557 | struct pid *tty_old_pgrp; |
554 | 558 | ||
555 | union { | ||
556 | pid_t session __deprecated; | ||
557 | pid_t __session; | ||
558 | }; | ||
559 | |||
560 | /* boolean value for session group leader */ | 559 | /* boolean value for session group leader */ |
561 | int leader; | 560 | int leader; |
562 | 561 | ||
@@ -1260,9 +1259,8 @@ struct task_struct { | |||
1260 | /* ipc stuff */ | 1259 | /* ipc stuff */ |
1261 | struct sysv_sem sysvsem; | 1260 | struct sysv_sem sysvsem; |
1262 | #endif | 1261 | #endif |
1263 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 1262 | #ifdef CONFIG_DETECT_HUNG_TASK |
1264 | /* hung task detection */ | 1263 | /* hung task detection */ |
1265 | unsigned long last_switch_timestamp; | ||
1266 | unsigned long last_switch_count; | 1264 | unsigned long last_switch_count; |
1267 | #endif | 1265 | #endif |
1268 | /* CPU-specific state of this task */ | 1266 | /* CPU-specific state of this task */ |
@@ -1299,6 +1297,11 @@ struct task_struct { | |||
1299 | /* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ | 1297 | /* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ |
1300 | spinlock_t alloc_lock; | 1298 | spinlock_t alloc_lock; |
1301 | 1299 | ||
1300 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
1301 | /* IRQ handler threads */ | ||
1302 | struct irqaction *irqaction; | ||
1303 | #endif | ||
1304 | |||
1302 | /* Protection of the PI data structures: */ | 1305 | /* Protection of the PI data structures: */ |
1303 | spinlock_t pi_lock; | 1306 | spinlock_t pi_lock; |
1304 | 1307 | ||
@@ -1334,6 +1337,7 @@ struct task_struct { | |||
1334 | int lockdep_depth; | 1337 | int lockdep_depth; |
1335 | unsigned int lockdep_recursion; | 1338 | unsigned int lockdep_recursion; |
1336 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | 1339 | struct held_lock held_locks[MAX_LOCK_DEPTH]; |
1340 | gfp_t lockdep_reclaim_gfp; | ||
1337 | #endif | 1341 | #endif |
1338 | 1342 | ||
1339 | /* journalling filesystem info */ | 1343 | /* journalling filesystem info */ |
@@ -1411,6 +1415,8 @@ struct task_struct { | |||
1411 | int curr_ret_stack; | 1415 | int curr_ret_stack; |
1412 | /* Stack of return addresses for return function tracing */ | 1416 | /* Stack of return addresses for return function tracing */ |
1413 | struct ftrace_ret_stack *ret_stack; | 1417 | struct ftrace_ret_stack *ret_stack; |
1418 | /* time stamp for last schedule */ | ||
1419 | unsigned long long ftrace_timestamp; | ||
1414 | /* | 1420 | /* |
1415 | * Number of functions that haven't been traced | 1421 | * Number of functions that haven't been traced |
1416 | * because of depth overrun. | 1422 | * because of depth overrun. |
@@ -1459,16 +1465,6 @@ static inline int rt_task(struct task_struct *p) | |||
1459 | return rt_prio(p->prio); | 1465 | return rt_prio(p->prio); |
1460 | } | 1466 | } |
1461 | 1467 | ||
1462 | static inline void set_task_session(struct task_struct *tsk, pid_t session) | ||
1463 | { | ||
1464 | tsk->signal->__session = session; | ||
1465 | } | ||
1466 | |||
1467 | static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp) | ||
1468 | { | ||
1469 | tsk->signal->__pgrp = pgrp; | ||
1470 | } | ||
1471 | |||
1472 | static inline struct pid *task_pid(struct task_struct *task) | 1468 | static inline struct pid *task_pid(struct task_struct *task) |
1473 | { | 1469 | { |
1474 | return task->pids[PIDTYPE_PID].pid; | 1470 | return task->pids[PIDTYPE_PID].pid; |
@@ -1479,6 +1475,11 @@ static inline struct pid *task_tgid(struct task_struct *task) | |||
1479 | return task->group_leader->pids[PIDTYPE_PID].pid; | 1475 | return task->group_leader->pids[PIDTYPE_PID].pid; |
1480 | } | 1476 | } |
1481 | 1477 | ||
1478 | /* | ||
1479 | * Without tasklist or rcu lock it is not safe to dereference | ||
1480 | * the result of task_pgrp/task_session even if task == current, | ||
1481 | * we can race with another thread doing sys_setsid/sys_setpgid. | ||
1482 | */ | ||
1482 | static inline struct pid *task_pgrp(struct task_struct *task) | 1483 | static inline struct pid *task_pgrp(struct task_struct *task) |
1483 | { | 1484 | { |
1484 | return task->group_leader->pids[PIDTYPE_PGID].pid; | 1485 | return task->group_leader->pids[PIDTYPE_PGID].pid; |
@@ -1504,17 +1505,23 @@ struct pid_namespace; | |||
1504 | * | 1505 | * |
1505 | * see also pid_nr() etc in include/linux/pid.h | 1506 | * see also pid_nr() etc in include/linux/pid.h |
1506 | */ | 1507 | */ |
1508 | pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, | ||
1509 | struct pid_namespace *ns); | ||
1507 | 1510 | ||
1508 | static inline pid_t task_pid_nr(struct task_struct *tsk) | 1511 | static inline pid_t task_pid_nr(struct task_struct *tsk) |
1509 | { | 1512 | { |
1510 | return tsk->pid; | 1513 | return tsk->pid; |
1511 | } | 1514 | } |
1512 | 1515 | ||
1513 | pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | 1516 | static inline pid_t task_pid_nr_ns(struct task_struct *tsk, |
1517 | struct pid_namespace *ns) | ||
1518 | { | ||
1519 | return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns); | ||
1520 | } | ||
1514 | 1521 | ||
1515 | static inline pid_t task_pid_vnr(struct task_struct *tsk) | 1522 | static inline pid_t task_pid_vnr(struct task_struct *tsk) |
1516 | { | 1523 | { |
1517 | return pid_vnr(task_pid(tsk)); | 1524 | return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL); |
1518 | } | 1525 | } |
1519 | 1526 | ||
1520 | 1527 | ||
@@ -1531,31 +1538,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) | |||
1531 | } | 1538 | } |
1532 | 1539 | ||
1533 | 1540 | ||
1534 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) | 1541 | static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, |
1542 | struct pid_namespace *ns) | ||
1535 | { | 1543 | { |
1536 | return tsk->signal->__pgrp; | 1544 | return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); |
1537 | } | 1545 | } |
1538 | 1546 | ||
1539 | pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | ||
1540 | |||
1541 | static inline pid_t task_pgrp_vnr(struct task_struct *tsk) | 1547 | static inline pid_t task_pgrp_vnr(struct task_struct *tsk) |
1542 | { | 1548 | { |
1543 | return pid_vnr(task_pgrp(tsk)); | 1549 | return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL); |
1544 | } | 1550 | } |
1545 | 1551 | ||
1546 | 1552 | ||
1547 | static inline pid_t task_session_nr(struct task_struct *tsk) | 1553 | static inline pid_t task_session_nr_ns(struct task_struct *tsk, |
1554 | struct pid_namespace *ns) | ||
1548 | { | 1555 | { |
1549 | return tsk->signal->__session; | 1556 | return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns); |
1550 | } | 1557 | } |
1551 | 1558 | ||
1552 | pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | ||
1553 | |||
1554 | static inline pid_t task_session_vnr(struct task_struct *tsk) | 1559 | static inline pid_t task_session_vnr(struct task_struct *tsk) |
1555 | { | 1560 | { |
1556 | return pid_vnr(task_session(tsk)); | 1561 | return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); |
1557 | } | 1562 | } |
1558 | 1563 | ||
1564 | /* obsolete, do not use */ | ||
1565 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) | ||
1566 | { | ||
1567 | return task_pgrp_nr_ns(tsk, &init_pid_ns); | ||
1568 | } | ||
1559 | 1569 | ||
1560 | /** | 1570 | /** |
1561 | * pid_alive - check that a task structure is not stale | 1571 | * pid_alive - check that a task structure is not stale |
@@ -1966,7 +1976,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *); | |||
1966 | /* Allocate a new mm structure and copy contents from tsk->mm */ | 1976 | /* Allocate a new mm structure and copy contents from tsk->mm */ |
1967 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | 1977 | extern struct mm_struct *dup_mm(struct task_struct *tsk); |
1968 | 1978 | ||
1969 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); | 1979 | extern int copy_thread(unsigned long, unsigned long, unsigned long, |
1980 | struct task_struct *, struct pt_regs *); | ||
1970 | extern void flush_thread(void); | 1981 | extern void flush_thread(void); |
1971 | extern void exit_thread(void); | 1982 | extern void exit_thread(void); |
1972 | 1983 | ||
@@ -2051,6 +2062,11 @@ static inline int thread_group_empty(struct task_struct *p) | |||
2051 | #define delay_group_leader(p) \ | 2062 | #define delay_group_leader(p) \ |
2052 | (thread_group_leader(p) && !thread_group_empty(p)) | 2063 | (thread_group_leader(p) && !thread_group_empty(p)) |
2053 | 2064 | ||
2065 | static inline int task_detached(struct task_struct *p) | ||
2066 | { | ||
2067 | return p->exit_signal == -1; | ||
2068 | } | ||
2069 | |||
2054 | /* | 2070 | /* |
2055 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring | 2071 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring |
2056 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 2072 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |