aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-08 11:02:50 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-08 11:02:57 -0400
commitff96e612cba32510e263e17b213235fe5746397e (patch)
treea8df57d76b10e0901a4fb76cd2987eb9826a560a /include/linux/sched.h
parentcd84a42f315e50edd454c27a3da3951ccd3d735a (diff)
parent577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff)
Merge commit 'v2.6.30-rc1' into core/urgent
Merge reason: need latest upstream to queue up dependent fix Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h103
1 files changed, 54 insertions, 49 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 481fad3a9b42..98e1fe51601d 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;
97struct robust_list_head; 97struct robust_list_head;
98struct bio; 98struct bio;
99struct bts_tracer; 99struct bts_tracer;
100struct 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);
137extern unsigned long nr_active(void); 138extern unsigned long nr_active(void);
138extern unsigned long nr_iowait(void); 139extern unsigned long nr_iowait(void);
139 140
141extern unsigned long get_parent_ip(unsigned long addr);
142
140struct seq_file; 143struct seq_file;
141struct cfs_rq; 144struct cfs_rq;
142struct task_group; 145struct task_group;
@@ -297,17 +300,11 @@ extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
297 struct file *filp, void __user *buffer, 300 struct file *filp, void __user *buffer,
298 size_t *lenp, loff_t *ppos); 301 size_t *lenp, loff_t *ppos);
299extern unsigned int softlockup_panic; 302extern unsigned int softlockup_panic;
300extern unsigned long sysctl_hung_task_check_count;
301extern unsigned long sysctl_hung_task_timeout_secs;
302extern unsigned long sysctl_hung_task_warnings;
303extern int softlockup_thresh; 303extern int softlockup_thresh;
304#else 304#else
305static inline void softlockup_tick(void) 305static inline void softlockup_tick(void)
306{ 306{
307} 307}
308static inline void spawn_softlockup_task(void)
309{
310}
311static inline void touch_softlockup_watchdog(void) 308static inline void touch_softlockup_watchdog(void)
312{ 309{
313} 310}
@@ -316,6 +313,15 @@ static inline void touch_all_softlockup_watchdogs(void)
316} 313}
317#endif 314#endif
318 315
316#ifdef CONFIG_DETECT_HUNG_TASK
317extern unsigned int sysctl_hung_task_panic;
318extern unsigned long sysctl_hung_task_check_count;
319extern unsigned long sysctl_hung_task_timeout_secs;
320extern unsigned long sysctl_hung_task_warnings;
321extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
322 struct file *filp, void __user *buffer,
323 size_t *lenp, loff_t *ppos);
324#endif
319 325
320/* Attach to any functions which should be ignored in wchan output. */ 326/* Attach to any functions which should be ignored in wchan output. */
321#define __sched __attribute__((__section__(".sched.text"))) 327#define __sched __attribute__((__section__(".sched.text")))
@@ -547,25 +553,8 @@ struct signal_struct {
547 553
548 struct list_head cpu_timers[3]; 554 struct list_head cpu_timers[3];
549 555
550 /* job control IDs */
551
552 /*
553 * pgrp and session fields are deprecated.
554 * use the task_session_Xnr and task_pgrp_Xnr routines below
555 */
556
557 union {
558 pid_t pgrp __deprecated;
559 pid_t __pgrp;
560 };
561
562 struct pid *tty_old_pgrp; 556 struct pid *tty_old_pgrp;
563 557
564 union {
565 pid_t session __deprecated;
566 pid_t __session;
567 };
568
569 /* boolean value for session group leader */ 558 /* boolean value for session group leader */
570 int leader; 559 int leader;
571 560
@@ -1269,9 +1258,8 @@ struct task_struct {
1269/* ipc stuff */ 1258/* ipc stuff */
1270 struct sysv_sem sysvsem; 1259 struct sysv_sem sysvsem;
1271#endif 1260#endif
1272#ifdef CONFIG_DETECT_SOFTLOCKUP 1261#ifdef CONFIG_DETECT_HUNG_TASK
1273/* hung task detection */ 1262/* hung task detection */
1274 unsigned long last_switch_timestamp;
1275 unsigned long last_switch_count; 1263 unsigned long last_switch_count;
1276#endif 1264#endif
1277/* CPU-specific state of this task */ 1265/* CPU-specific state of this task */
@@ -1308,6 +1296,11 @@ struct task_struct {
1308/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1296/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
1309 spinlock_t alloc_lock; 1297 spinlock_t alloc_lock;
1310 1298
1299#ifdef CONFIG_GENERIC_HARDIRQS
1300 /* IRQ handler threads */
1301 struct irqaction *irqaction;
1302#endif
1303
1311 /* Protection of the PI data structures: */ 1304 /* Protection of the PI data structures: */
1312 spinlock_t pi_lock; 1305 spinlock_t pi_lock;
1313 1306
@@ -1421,6 +1414,8 @@ struct task_struct {
1421 int curr_ret_stack; 1414 int curr_ret_stack;
1422 /* Stack of return addresses for return function tracing */ 1415 /* Stack of return addresses for return function tracing */
1423 struct ftrace_ret_stack *ret_stack; 1416 struct ftrace_ret_stack *ret_stack;
1417 /* time stamp for last schedule */
1418 unsigned long long ftrace_timestamp;
1424 /* 1419 /*
1425 * Number of functions that haven't been traced 1420 * Number of functions that haven't been traced
1426 * because of depth overrun. 1421 * because of depth overrun.
@@ -1469,16 +1464,6 @@ static inline int rt_task(struct task_struct *p)
1469 return rt_prio(p->prio); 1464 return rt_prio(p->prio);
1470} 1465}
1471 1466
1472static inline void set_task_session(struct task_struct *tsk, pid_t session)
1473{
1474 tsk->signal->__session = session;
1475}
1476
1477static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
1478{
1479 tsk->signal->__pgrp = pgrp;
1480}
1481
1482static inline struct pid *task_pid(struct task_struct *task) 1467static inline struct pid *task_pid(struct task_struct *task)
1483{ 1468{
1484 return task->pids[PIDTYPE_PID].pid; 1469 return task->pids[PIDTYPE_PID].pid;
@@ -1489,6 +1474,11 @@ static inline struct pid *task_tgid(struct task_struct *task)
1489 return task->group_leader->pids[PIDTYPE_PID].pid; 1474 return task->group_leader->pids[PIDTYPE_PID].pid;
1490} 1475}
1491 1476
1477/*
1478 * Without tasklist or rcu lock it is not safe to dereference
1479 * the result of task_pgrp/task_session even if task == current,
1480 * we can race with another thread doing sys_setsid/sys_setpgid.
1481 */
1492static inline struct pid *task_pgrp(struct task_struct *task) 1482static inline struct pid *task_pgrp(struct task_struct *task)
1493{ 1483{
1494 return task->group_leader->pids[PIDTYPE_PGID].pid; 1484 return task->group_leader->pids[PIDTYPE_PGID].pid;
@@ -1514,17 +1504,23 @@ struct pid_namespace;
1514 * 1504 *
1515 * see also pid_nr() etc in include/linux/pid.h 1505 * see also pid_nr() etc in include/linux/pid.h
1516 */ 1506 */
1507pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
1508 struct pid_namespace *ns);
1517 1509
1518static inline pid_t task_pid_nr(struct task_struct *tsk) 1510static inline pid_t task_pid_nr(struct task_struct *tsk)
1519{ 1511{
1520 return tsk->pid; 1512 return tsk->pid;
1521} 1513}
1522 1514
1523pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); 1515static inline pid_t task_pid_nr_ns(struct task_struct *tsk,
1516 struct pid_namespace *ns)
1517{
1518 return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
1519}
1524 1520
1525static inline pid_t task_pid_vnr(struct task_struct *tsk) 1521static inline pid_t task_pid_vnr(struct task_struct *tsk)
1526{ 1522{
1527 return pid_vnr(task_pid(tsk)); 1523 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1528} 1524}
1529 1525
1530 1526
@@ -1541,31 +1537,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1541} 1537}
1542 1538
1543 1539
1544static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1540static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1541 struct pid_namespace *ns)
1545{ 1542{
1546 return tsk->signal->__pgrp; 1543 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
1547} 1544}
1548 1545
1549pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1550
1551static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 1546static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1552{ 1547{
1553 return pid_vnr(task_pgrp(tsk)); 1548 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1554} 1549}
1555 1550
1556 1551
1557static inline pid_t task_session_nr(struct task_struct *tsk) 1552static inline pid_t task_session_nr_ns(struct task_struct *tsk,
1553 struct pid_namespace *ns)
1558{ 1554{
1559 return tsk->signal->__session; 1555 return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
1560} 1556}
1561 1557
1562pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1563
1564static inline pid_t task_session_vnr(struct task_struct *tsk) 1558static inline pid_t task_session_vnr(struct task_struct *tsk)
1565{ 1559{
1566 return pid_vnr(task_session(tsk)); 1560 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1567} 1561}
1568 1562
1563/* obsolete, do not use */
1564static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1565{
1566 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1567}
1569 1568
1570/** 1569/**
1571 * pid_alive - check that a task structure is not stale 1570 * pid_alive - check that a task structure is not stale
@@ -1975,7 +1974,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
1975/* Allocate a new mm structure and copy contents from tsk->mm */ 1974/* Allocate a new mm structure and copy contents from tsk->mm */
1976extern struct mm_struct *dup_mm(struct task_struct *tsk); 1975extern struct mm_struct *dup_mm(struct task_struct *tsk);
1977 1976
1978extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); 1977extern int copy_thread(unsigned long, unsigned long, unsigned long,
1978 struct task_struct *, struct pt_regs *);
1979extern void flush_thread(void); 1979extern void flush_thread(void);
1980extern void exit_thread(void); 1980extern void exit_thread(void);
1981 1981
@@ -2060,6 +2060,11 @@ static inline int thread_group_empty(struct task_struct *p)
2060#define delay_group_leader(p) \ 2060#define delay_group_leader(p) \
2061 (thread_group_leader(p) && !thread_group_empty(p)) 2061 (thread_group_leader(p) && !thread_group_empty(p))
2062 2062
2063static inline int task_detached(struct task_struct *p)
2064{
2065 return p->exit_signal == -1;
2066}
2067
2063/* 2068/*
2064 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2069 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2065 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2070 * subscriptions and synchronises with wait4(). Also used in procfs. Also