diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-05 19:41:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-05 19:41:22 -0400 |
commit | 9efe21cb82b5dbe3b0b2ae4de4eccc64ecb94e95 (patch) | |
tree | 7ff8833745d2f268f897f6fa4a27263b4a572245 /include/linux/sched.h | |
parent | de18836e447c2dc30120c0919b8db8ddc0401cc4 (diff) | |
parent | 0221c81b1b8eb0cbb6b30a0ced52ead32d2b4e4c (diff) |
Merge branch 'linus' into irq/threaded
Conflicts:
include/linux/irq.h
kernel/irq/handle.c
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 113 |
1 files changed, 69 insertions, 44 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 38b77b0f56e5..c96140210d1c 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; |
@@ -331,7 +334,9 @@ extern signed long schedule_timeout(signed long timeout); | |||
331 | extern signed long schedule_timeout_interruptible(signed long timeout); | 334 | extern signed long schedule_timeout_interruptible(signed long timeout); |
332 | extern signed long schedule_timeout_killable(signed long timeout); | 335 | extern signed long schedule_timeout_killable(signed long timeout); |
333 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 336 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
337 | asmlinkage void __schedule(void); | ||
334 | asmlinkage void schedule(void); | 338 | asmlinkage void schedule(void); |
339 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | ||
335 | 340 | ||
336 | struct nsproxy; | 341 | struct nsproxy; |
337 | struct user_namespace; | 342 | struct user_namespace; |
@@ -389,8 +394,15 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
389 | (mm)->hiwater_vm = (mm)->total_vm; \ | 394 | (mm)->hiwater_vm = (mm)->total_vm; \ |
390 | } while (0) | 395 | } while (0) |
391 | 396 | ||
392 | #define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm)) | 397 | 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) | 398 | { |
399 | return max(mm->hiwater_rss, get_mm_rss(mm)); | ||
400 | } | ||
401 | |||
402 | static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) | ||
403 | { | ||
404 | return max(mm->hiwater_vm, mm->total_vm); | ||
405 | } | ||
394 | 406 | ||
395 | extern void set_dumpable(struct mm_struct *mm, int value); | 407 | extern void set_dumpable(struct mm_struct *mm, int value); |
396 | extern int get_dumpable(struct mm_struct *mm); | 408 | extern int get_dumpable(struct mm_struct *mm); |
@@ -538,25 +550,8 @@ struct signal_struct { | |||
538 | 550 | ||
539 | struct list_head cpu_timers[3]; | 551 | struct list_head cpu_timers[3]; |
540 | 552 | ||
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; | 553 | struct pid *tty_old_pgrp; |
554 | 554 | ||
555 | union { | ||
556 | pid_t session __deprecated; | ||
557 | pid_t __session; | ||
558 | }; | ||
559 | |||
560 | /* boolean value for session group leader */ | 555 | /* boolean value for session group leader */ |
561 | int leader; | 556 | int leader; |
562 | 557 | ||
@@ -998,6 +993,7 @@ struct sched_class { | |||
998 | struct rq *busiest, struct sched_domain *sd, | 993 | struct rq *busiest, struct sched_domain *sd, |
999 | enum cpu_idle_type idle); | 994 | enum cpu_idle_type idle); |
1000 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 995 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
996 | int (*needs_post_schedule) (struct rq *this_rq); | ||
1001 | void (*post_schedule) (struct rq *this_rq); | 997 | void (*post_schedule) (struct rq *this_rq); |
1002 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 998 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); |
1003 | 999 | ||
@@ -1052,6 +1048,10 @@ struct sched_entity { | |||
1052 | u64 last_wakeup; | 1048 | u64 last_wakeup; |
1053 | u64 avg_overlap; | 1049 | u64 avg_overlap; |
1054 | 1050 | ||
1051 | u64 start_runtime; | ||
1052 | u64 avg_wakeup; | ||
1053 | u64 nr_migrations; | ||
1054 | |||
1055 | #ifdef CONFIG_SCHEDSTATS | 1055 | #ifdef CONFIG_SCHEDSTATS |
1056 | u64 wait_start; | 1056 | u64 wait_start; |
1057 | u64 wait_max; | 1057 | u64 wait_max; |
@@ -1067,7 +1067,6 @@ struct sched_entity { | |||
1067 | u64 exec_max; | 1067 | u64 exec_max; |
1068 | u64 slice_max; | 1068 | u64 slice_max; |
1069 | 1069 | ||
1070 | u64 nr_migrations; | ||
1071 | u64 nr_migrations_cold; | 1070 | u64 nr_migrations_cold; |
1072 | u64 nr_failed_migrations_affine; | 1071 | u64 nr_failed_migrations_affine; |
1073 | u64 nr_failed_migrations_running; | 1072 | u64 nr_failed_migrations_running; |
@@ -1164,6 +1163,7 @@ struct task_struct { | |||
1164 | #endif | 1163 | #endif |
1165 | 1164 | ||
1166 | struct list_head tasks; | 1165 | struct list_head tasks; |
1166 | struct plist_node pushable_tasks; | ||
1167 | 1167 | ||
1168 | struct mm_struct *mm, *active_mm; | 1168 | struct mm_struct *mm, *active_mm; |
1169 | 1169 | ||
@@ -1175,6 +1175,8 @@ struct task_struct { | |||
1175 | /* ??? */ | 1175 | /* ??? */ |
1176 | unsigned int personality; | 1176 | unsigned int personality; |
1177 | unsigned did_exec:1; | 1177 | unsigned did_exec:1; |
1178 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | ||
1179 | * execve */ | ||
1178 | pid_t pid; | 1180 | pid_t pid; |
1179 | pid_t tgid; | 1181 | pid_t tgid; |
1180 | 1182 | ||
@@ -1332,6 +1334,7 @@ struct task_struct { | |||
1332 | int lockdep_depth; | 1334 | int lockdep_depth; |
1333 | unsigned int lockdep_recursion; | 1335 | unsigned int lockdep_recursion; |
1334 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | 1336 | struct held_lock held_locks[MAX_LOCK_DEPTH]; |
1337 | gfp_t lockdep_reclaim_gfp; | ||
1335 | #endif | 1338 | #endif |
1336 | 1339 | ||
1337 | /* journalling filesystem info */ | 1340 | /* journalling filesystem info */ |
@@ -1409,6 +1412,8 @@ struct task_struct { | |||
1409 | int curr_ret_stack; | 1412 | int curr_ret_stack; |
1410 | /* Stack of return addresses for return function tracing */ | 1413 | /* Stack of return addresses for return function tracing */ |
1411 | struct ftrace_ret_stack *ret_stack; | 1414 | struct ftrace_ret_stack *ret_stack; |
1415 | /* time stamp for last schedule */ | ||
1416 | unsigned long long ftrace_timestamp; | ||
1412 | /* | 1417 | /* |
1413 | * Number of functions that haven't been traced | 1418 | * Number of functions that haven't been traced |
1414 | * because of depth overrun. | 1419 | * because of depth overrun. |
@@ -1457,16 +1462,6 @@ static inline int rt_task(struct task_struct *p) | |||
1457 | return rt_prio(p->prio); | 1462 | return rt_prio(p->prio); |
1458 | } | 1463 | } |
1459 | 1464 | ||
1460 | static inline void set_task_session(struct task_struct *tsk, pid_t session) | ||
1461 | { | ||
1462 | tsk->signal->__session = session; | ||
1463 | } | ||
1464 | |||
1465 | static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp) | ||
1466 | { | ||
1467 | tsk->signal->__pgrp = pgrp; | ||
1468 | } | ||
1469 | |||
1470 | static inline struct pid *task_pid(struct task_struct *task) | 1465 | static inline struct pid *task_pid(struct task_struct *task) |
1471 | { | 1466 | { |
1472 | return task->pids[PIDTYPE_PID].pid; | 1467 | return task->pids[PIDTYPE_PID].pid; |
@@ -1477,6 +1472,11 @@ static inline struct pid *task_tgid(struct task_struct *task) | |||
1477 | return task->group_leader->pids[PIDTYPE_PID].pid; | 1472 | return task->group_leader->pids[PIDTYPE_PID].pid; |
1478 | } | 1473 | } |
1479 | 1474 | ||
1475 | /* | ||
1476 | * Without tasklist or rcu lock it is not safe to dereference | ||
1477 | * the result of task_pgrp/task_session even if task == current, | ||
1478 | * we can race with another thread doing sys_setsid/sys_setpgid. | ||
1479 | */ | ||
1480 | static inline struct pid *task_pgrp(struct task_struct *task) | 1480 | static inline struct pid *task_pgrp(struct task_struct *task) |
1481 | { | 1481 | { |
1482 | return task->group_leader->pids[PIDTYPE_PGID].pid; | 1482 | return task->group_leader->pids[PIDTYPE_PGID].pid; |
@@ -1502,17 +1502,23 @@ struct pid_namespace; | |||
1502 | * | 1502 | * |
1503 | * see also pid_nr() etc in include/linux/pid.h | 1503 | * see also pid_nr() etc in include/linux/pid.h |
1504 | */ | 1504 | */ |
1505 | pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, | ||
1506 | struct pid_namespace *ns); | ||
1505 | 1507 | ||
1506 | static inline pid_t task_pid_nr(struct task_struct *tsk) | 1508 | static inline pid_t task_pid_nr(struct task_struct *tsk) |
1507 | { | 1509 | { |
1508 | return tsk->pid; | 1510 | return tsk->pid; |
1509 | } | 1511 | } |
1510 | 1512 | ||
1511 | pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | 1513 | static inline pid_t task_pid_nr_ns(struct task_struct *tsk, |
1514 | struct pid_namespace *ns) | ||
1515 | { | ||
1516 | return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns); | ||
1517 | } | ||
1512 | 1518 | ||
1513 | static inline pid_t task_pid_vnr(struct task_struct *tsk) | 1519 | static inline pid_t task_pid_vnr(struct task_struct *tsk) |
1514 | { | 1520 | { |
1515 | return pid_vnr(task_pid(tsk)); | 1521 | return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL); |
1516 | } | 1522 | } |
1517 | 1523 | ||
1518 | 1524 | ||
@@ -1529,31 +1535,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) | |||
1529 | } | 1535 | } |
1530 | 1536 | ||
1531 | 1537 | ||
1532 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) | 1538 | static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, |
1539 | struct pid_namespace *ns) | ||
1533 | { | 1540 | { |
1534 | return tsk->signal->__pgrp; | 1541 | return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); |
1535 | } | 1542 | } |
1536 | 1543 | ||
1537 | pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | ||
1538 | |||
1539 | static inline pid_t task_pgrp_vnr(struct task_struct *tsk) | 1544 | static inline pid_t task_pgrp_vnr(struct task_struct *tsk) |
1540 | { | 1545 | { |
1541 | return pid_vnr(task_pgrp(tsk)); | 1546 | return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL); |
1542 | } | 1547 | } |
1543 | 1548 | ||
1544 | 1549 | ||
1545 | static inline pid_t task_session_nr(struct task_struct *tsk) | 1550 | static inline pid_t task_session_nr_ns(struct task_struct *tsk, |
1551 | struct pid_namespace *ns) | ||
1546 | { | 1552 | { |
1547 | return tsk->signal->__session; | 1553 | return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns); |
1548 | } | 1554 | } |
1549 | 1555 | ||
1550 | pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); | ||
1551 | |||
1552 | static inline pid_t task_session_vnr(struct task_struct *tsk) | 1556 | static inline pid_t task_session_vnr(struct task_struct *tsk) |
1553 | { | 1557 | { |
1554 | return pid_vnr(task_session(tsk)); | 1558 | return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); |
1555 | } | 1559 | } |
1556 | 1560 | ||
1561 | /* obsolete, do not use */ | ||
1562 | static inline pid_t task_pgrp_nr(struct task_struct *tsk) | ||
1563 | { | ||
1564 | return task_pgrp_nr_ns(tsk, &init_pid_ns); | ||
1565 | } | ||
1557 | 1566 | ||
1558 | /** | 1567 | /** |
1559 | * pid_alive - check that a task structure is not stale | 1568 | * pid_alive - check that a task structure is not stale |
@@ -1677,6 +1686,16 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1677 | return set_cpus_allowed_ptr(p, &new_mask); | 1686 | return set_cpus_allowed_ptr(p, &new_mask); |
1678 | } | 1687 | } |
1679 | 1688 | ||
1689 | /* | ||
1690 | * Architectures can set this to 1 if they have specified | ||
1691 | * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, | ||
1692 | * but then during bootup it turns out that sched_clock() | ||
1693 | * is reliable after all: | ||
1694 | */ | ||
1695 | #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
1696 | extern int sched_clock_stable; | ||
1697 | #endif | ||
1698 | |||
1680 | extern unsigned long long sched_clock(void); | 1699 | extern unsigned long long sched_clock(void); |
1681 | 1700 | ||
1682 | extern void sched_clock_init(void); | 1701 | extern void sched_clock_init(void); |
@@ -1953,7 +1972,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *); | |||
1953 | /* Allocate a new mm structure and copy contents from tsk->mm */ | 1972 | /* Allocate a new mm structure and copy contents from tsk->mm */ |
1954 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | 1973 | extern struct mm_struct *dup_mm(struct task_struct *tsk); |
1955 | 1974 | ||
1956 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); | 1975 | extern int copy_thread(unsigned long, unsigned long, unsigned long, |
1976 | struct task_struct *, struct pt_regs *); | ||
1957 | extern void flush_thread(void); | 1977 | extern void flush_thread(void); |
1958 | extern void exit_thread(void); | 1978 | extern void exit_thread(void); |
1959 | 1979 | ||
@@ -2038,6 +2058,11 @@ static inline int thread_group_empty(struct task_struct *p) | |||
2038 | #define delay_group_leader(p) \ | 2058 | #define delay_group_leader(p) \ |
2039 | (thread_group_leader(p) && !thread_group_empty(p)) | 2059 | (thread_group_leader(p) && !thread_group_empty(p)) |
2040 | 2060 | ||
2061 | static inline int task_detached(struct task_struct *p) | ||
2062 | { | ||
2063 | return p->exit_signal == -1; | ||
2064 | } | ||
2065 | |||
2041 | /* | 2066 | /* |
2042 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring | 2067 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring |
2043 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 2068 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |