aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-07 07:34:26 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 07:34:42 -0400
commit2e8844e13ab73f1107aea4317a53ff5879f2e1d7 (patch)
tree36165371cf6fd26d674610f1c6bb5fac50e6e13f /include/linux/sched.h
parentc78a3956b982418186e40978a51636a2b43221bc (diff)
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
Merge branch 'linus' into tracing/hw-branch-tracing
Merge reason: update to latest tracing and ptrace APIs Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h98
1 files changed, 54 insertions, 44 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 89cd308cc7a5..b94f3541f67b 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,
@@ -393,8 +394,15 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
393 (mm)->hiwater_vm = (mm)->total_vm; \ 394 (mm)->hiwater_vm = (mm)->total_vm; \
394} while (0) 395} while (0)
395 396
396#define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm)) 397static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
397#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
402static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
403{
404 return max(mm->hiwater_vm, mm->total_vm);
405}
398 406
399extern void set_dumpable(struct mm_struct *mm, int value); 407extern void set_dumpable(struct mm_struct *mm, int value);
400extern int get_dumpable(struct mm_struct *mm); 408extern int get_dumpable(struct mm_struct *mm);
@@ -542,25 +550,8 @@ struct signal_struct {
542 550
543 struct list_head cpu_timers[3]; 551 struct list_head cpu_timers[3];
544 552
545 /* job control IDs */
546
547 /*
548 * pgrp and session fields are deprecated.
549 * use the task_session_Xnr and task_pgrp_Xnr routines below
550 */
551
552 union {
553 pid_t pgrp __deprecated;
554 pid_t __pgrp;
555 };
556
557 struct pid *tty_old_pgrp; 553 struct pid *tty_old_pgrp;
558 554
559 union {
560 pid_t session __deprecated;
561 pid_t __session;
562 };
563
564 /* boolean value for session group leader */ 555 /* boolean value for session group leader */
565 int leader; 556 int leader;
566 557
@@ -1002,6 +993,7 @@ struct sched_class {
1002 struct rq *busiest, struct sched_domain *sd, 993 struct rq *busiest, struct sched_domain *sd,
1003 enum cpu_idle_type idle); 994 enum cpu_idle_type idle);
1004 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);
1005 void (*post_schedule) (struct rq *this_rq); 997 void (*post_schedule) (struct rq *this_rq);
1006 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);
1007 999
@@ -1056,6 +1048,10 @@ struct sched_entity {
1056 u64 last_wakeup; 1048 u64 last_wakeup;
1057 u64 avg_overlap; 1049 u64 avg_overlap;
1058 1050
1051 u64 start_runtime;
1052 u64 avg_wakeup;
1053 u64 nr_migrations;
1054
1059#ifdef CONFIG_SCHEDSTATS 1055#ifdef CONFIG_SCHEDSTATS
1060 u64 wait_start; 1056 u64 wait_start;
1061 u64 wait_max; 1057 u64 wait_max;
@@ -1071,7 +1067,6 @@ struct sched_entity {
1071 u64 exec_max; 1067 u64 exec_max;
1072 u64 slice_max; 1068 u64 slice_max;
1073 1069
1074 u64 nr_migrations;
1075 u64 nr_migrations_cold; 1070 u64 nr_migrations_cold;
1076 u64 nr_failed_migrations_affine; 1071 u64 nr_failed_migrations_affine;
1077 u64 nr_failed_migrations_running; 1072 u64 nr_failed_migrations_running;
@@ -1168,6 +1163,7 @@ struct task_struct {
1168#endif 1163#endif
1169 1164
1170 struct list_head tasks; 1165 struct list_head tasks;
1166 struct plist_node pushable_tasks;
1171 1167
1172 struct mm_struct *mm, *active_mm; 1168 struct mm_struct *mm, *active_mm;
1173 1169
@@ -1179,6 +1175,8 @@ struct task_struct {
1179 /* ??? */ 1175 /* ??? */
1180 unsigned int personality; 1176 unsigned int personality;
1181 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 */
1182 pid_t pid; 1180 pid_t pid;
1183 pid_t tgid; 1181 pid_t tgid;
1184 1182
@@ -1409,6 +1407,8 @@ struct task_struct {
1409 int curr_ret_stack; 1407 int curr_ret_stack;
1410 /* Stack of return addresses for return function tracing */ 1408 /* Stack of return addresses for return function tracing */
1411 struct ftrace_ret_stack *ret_stack; 1409 struct ftrace_ret_stack *ret_stack;
1410 /* time stamp for last schedule */
1411 unsigned long long ftrace_timestamp;
1412 /* 1412 /*
1413 * Number of functions that haven't been traced 1413 * Number of functions that haven't been traced
1414 * because of depth overrun. 1414 * because of depth overrun.
@@ -1457,16 +1457,6 @@ static inline int rt_task(struct task_struct *p)
1457 return rt_prio(p->prio); 1457 return rt_prio(p->prio);
1458} 1458}
1459 1459
1460static inline void set_task_session(struct task_struct *tsk, pid_t session)
1461{
1462 tsk->signal->__session = session;
1463}
1464
1465static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
1466{
1467 tsk->signal->__pgrp = pgrp;
1468}
1469
1470static inline struct pid *task_pid(struct task_struct *task) 1460static inline struct pid *task_pid(struct task_struct *task)
1471{ 1461{
1472 return task->pids[PIDTYPE_PID].pid; 1462 return task->pids[PIDTYPE_PID].pid;
@@ -1477,6 +1467,11 @@ static inline struct pid *task_tgid(struct task_struct *task)
1477 return task->group_leader->pids[PIDTYPE_PID].pid; 1467 return task->group_leader->pids[PIDTYPE_PID].pid;
1478} 1468}
1479 1469
1470/*
1471 * Without tasklist or rcu lock it is not safe to dereference
1472 * the result of task_pgrp/task_session even if task == current,
1473 * we can race with another thread doing sys_setsid/sys_setpgid.
1474 */
1480static inline struct pid *task_pgrp(struct task_struct *task) 1475static inline struct pid *task_pgrp(struct task_struct *task)
1481{ 1476{
1482 return task->group_leader->pids[PIDTYPE_PGID].pid; 1477 return task->group_leader->pids[PIDTYPE_PGID].pid;
@@ -1502,17 +1497,23 @@ struct pid_namespace;
1502 * 1497 *
1503 * see also pid_nr() etc in include/linux/pid.h 1498 * see also pid_nr() etc in include/linux/pid.h
1504 */ 1499 */
1500pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
1501 struct pid_namespace *ns);
1505 1502
1506static inline pid_t task_pid_nr(struct task_struct *tsk) 1503static inline pid_t task_pid_nr(struct task_struct *tsk)
1507{ 1504{
1508 return tsk->pid; 1505 return tsk->pid;
1509} 1506}
1510 1507
1511pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); 1508static inline pid_t task_pid_nr_ns(struct task_struct *tsk,
1509 struct pid_namespace *ns)
1510{
1511 return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
1512}
1512 1513
1513static inline pid_t task_pid_vnr(struct task_struct *tsk) 1514static inline pid_t task_pid_vnr(struct task_struct *tsk)
1514{ 1515{
1515 return pid_vnr(task_pid(tsk)); 1516 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1516} 1517}
1517 1518
1518 1519
@@ -1529,31 +1530,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1529} 1530}
1530 1531
1531 1532
1532static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1533static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1534 struct pid_namespace *ns)
1533{ 1535{
1534 return tsk->signal->__pgrp; 1536 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
1535} 1537}
1536 1538
1537pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1538
1539static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 1539static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1540{ 1540{
1541 return pid_vnr(task_pgrp(tsk)); 1541 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1542} 1542}
1543 1543
1544 1544
1545static inline pid_t task_session_nr(struct task_struct *tsk) 1545static inline pid_t task_session_nr_ns(struct task_struct *tsk,
1546 struct pid_namespace *ns)
1546{ 1547{
1547 return tsk->signal->__session; 1548 return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
1548} 1549}
1549 1550
1550pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1551
1552static inline pid_t task_session_vnr(struct task_struct *tsk) 1551static inline pid_t task_session_vnr(struct task_struct *tsk)
1553{ 1552{
1554 return pid_vnr(task_session(tsk)); 1553 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1555} 1554}
1556 1555
1556/* obsolete, do not use */
1557static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1558{
1559 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1560}
1557 1561
1558/** 1562/**
1559 * pid_alive - check that a task structure is not stale 1563 * pid_alive - check that a task structure is not stale
@@ -1963,7 +1967,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
1963/* Allocate a new mm structure and copy contents from tsk->mm */ 1967/* Allocate a new mm structure and copy contents from tsk->mm */
1964extern struct mm_struct *dup_mm(struct task_struct *tsk); 1968extern struct mm_struct *dup_mm(struct task_struct *tsk);
1965 1969
1966extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); 1970extern int copy_thread(unsigned long, unsigned long, unsigned long,
1971 struct task_struct *, struct pt_regs *);
1967extern void flush_thread(void); 1972extern void flush_thread(void);
1968extern void exit_thread(void); 1973extern void exit_thread(void);
1969 1974
@@ -2048,6 +2053,11 @@ static inline int thread_group_empty(struct task_struct *p)
2048#define delay_group_leader(p) \ 2053#define delay_group_leader(p) \
2049 (thread_group_leader(p) && !thread_group_empty(p)) 2054 (thread_group_leader(p) && !thread_group_empty(p))
2050 2055
2056static inline int task_detached(struct task_struct *p)
2057{
2058 return p->exit_signal == -1;
2059}
2060
2051/* 2061/*
2052 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2062 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2053 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2063 * subscriptions and synchronises with wait4(). Also used in procfs. Also