diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 142 |
1 files changed, 50 insertions, 92 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index eafe4a7b823..44637353519 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -82,6 +82,7 @@ struct sched_param { | |||
82 | #include <linux/resource.h> | 82 | #include <linux/resource.h> |
83 | #include <linux/timer.h> | 83 | #include <linux/timer.h> |
84 | #include <linux/hrtimer.h> | 84 | #include <linux/hrtimer.h> |
85 | #include <linux/task_io_accounting.h> | ||
85 | 86 | ||
86 | #include <asm/processor.h> | 87 | #include <asm/processor.h> |
87 | 88 | ||
@@ -194,7 +195,16 @@ extern void init_idle(struct task_struct *idle, int cpu); | |||
194 | 195 | ||
195 | extern cpumask_t nohz_cpu_mask; | 196 | extern cpumask_t nohz_cpu_mask; |
196 | 197 | ||
197 | extern void show_state(void); | 198 | /* |
199 | * Only dump TASK_* tasks. (-1 for all tasks) | ||
200 | */ | ||
201 | extern void show_state_filter(unsigned long state_filter); | ||
202 | |||
203 | static inline void show_state(void) | ||
204 | { | ||
205 | show_state_filter(-1); | ||
206 | } | ||
207 | |||
198 | extern void show_regs(struct pt_regs *); | 208 | extern void show_regs(struct pt_regs *); |
199 | 209 | ||
200 | /* | 210 | /* |
@@ -338,15 +348,23 @@ struct mm_struct { | |||
338 | 348 | ||
339 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 349 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
340 | 350 | ||
341 | unsigned dumpable:2; | ||
342 | cpumask_t cpu_vm_mask; | 351 | cpumask_t cpu_vm_mask; |
343 | 352 | ||
344 | /* Architecture-specific MM context */ | 353 | /* Architecture-specific MM context */ |
345 | mm_context_t context; | 354 | mm_context_t context; |
346 | 355 | ||
347 | /* Token based thrashing protection. */ | 356 | /* Swap token stuff */ |
348 | unsigned long swap_token_time; | 357 | /* |
349 | char recent_pagein; | 358 | * Last value of global fault stamp as seen by this process. |
359 | * In other words, this value gives an indication of how long | ||
360 | * it has been since this task got the token. | ||
361 | * Look at mm/thrash.c | ||
362 | */ | ||
363 | unsigned int faultstamp; | ||
364 | unsigned int token_priority; | ||
365 | unsigned int last_interval; | ||
366 | |||
367 | unsigned char dumpable:2; | ||
350 | 368 | ||
351 | /* coredumping support */ | 369 | /* coredumping support */ |
352 | int core_waiters; | 370 | int core_waiters; |
@@ -419,7 +437,12 @@ struct signal_struct { | |||
419 | /* job control IDs */ | 437 | /* job control IDs */ |
420 | pid_t pgrp; | 438 | pid_t pgrp; |
421 | pid_t tty_old_pgrp; | 439 | pid_t tty_old_pgrp; |
422 | pid_t session; | 440 | |
441 | union { | ||
442 | pid_t session __deprecated; | ||
443 | pid_t __session; | ||
444 | }; | ||
445 | |||
423 | /* boolean value for session group leader */ | 446 | /* boolean value for session group leader */ |
424 | int leader; | 447 | int leader; |
425 | 448 | ||
@@ -556,7 +579,7 @@ struct sched_info { | |||
556 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ | 579 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ |
557 | 580 | ||
558 | #ifdef CONFIG_SCHEDSTATS | 581 | #ifdef CONFIG_SCHEDSTATS |
559 | extern struct file_operations proc_schedstat_operations; | 582 | extern const struct file_operations proc_schedstat_operations; |
560 | #endif /* CONFIG_SCHEDSTATS */ | 583 | #endif /* CONFIG_SCHEDSTATS */ |
561 | 584 | ||
562 | #ifdef CONFIG_TASK_DELAY_ACCT | 585 | #ifdef CONFIG_TASK_DELAY_ACCT |
@@ -625,6 +648,7 @@ enum idle_type | |||
625 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ | 648 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ |
626 | #define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ | 649 | #define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ |
627 | #define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ | 650 | #define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ |
651 | #define SD_SERIALIZE 1024 /* Only a single load balancing instance */ | ||
628 | 652 | ||
629 | #define BALANCE_FOR_MC_POWER \ | 653 | #define BALANCE_FOR_MC_POWER \ |
630 | (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0) | 654 | (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0) |
@@ -991,6 +1015,7 @@ struct task_struct { | |||
991 | wait_queue_t *io_wait; | 1015 | wait_queue_t *io_wait; |
992 | /* i/o counters(bytes read/written, #syscalls */ | 1016 | /* i/o counters(bytes read/written, #syscalls */ |
993 | u64 rchar, wchar, syscr, syscw; | 1017 | u64 rchar, wchar, syscr, syscw; |
1018 | struct task_io_accounting ioac; | ||
994 | #if defined(CONFIG_TASK_XACCT) | 1019 | #if defined(CONFIG_TASK_XACCT) |
995 | u64 acct_rss_mem1; /* accumulated rss usage */ | 1020 | u64 acct_rss_mem1; /* accumulated rss usage */ |
996 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ | 1021 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ |
@@ -1023,6 +1048,9 @@ struct task_struct { | |||
1023 | #ifdef CONFIG_TASK_DELAY_ACCT | 1048 | #ifdef CONFIG_TASK_DELAY_ACCT |
1024 | struct task_delay_info *delays; | 1049 | struct task_delay_info *delays; |
1025 | #endif | 1050 | #endif |
1051 | #ifdef CONFIG_FAULT_INJECTION | ||
1052 | int make_it_fail; | ||
1053 | #endif | ||
1026 | }; | 1054 | }; |
1027 | 1055 | ||
1028 | static inline pid_t process_group(struct task_struct *tsk) | 1056 | static inline pid_t process_group(struct task_struct *tsk) |
@@ -1030,6 +1058,21 @@ static inline pid_t process_group(struct task_struct *tsk) | |||
1030 | return tsk->signal->pgrp; | 1058 | return tsk->signal->pgrp; |
1031 | } | 1059 | } |
1032 | 1060 | ||
1061 | static inline pid_t signal_session(struct signal_struct *sig) | ||
1062 | { | ||
1063 | return sig->__session; | ||
1064 | } | ||
1065 | |||
1066 | static inline pid_t process_session(struct task_struct *tsk) | ||
1067 | { | ||
1068 | return signal_session(tsk->signal); | ||
1069 | } | ||
1070 | |||
1071 | static inline void set_signal_session(struct signal_struct *sig, pid_t session) | ||
1072 | { | ||
1073 | sig->__session = session; | ||
1074 | } | ||
1075 | |||
1033 | static inline struct pid *task_pid(struct task_struct *task) | 1076 | static inline struct pid *task_pid(struct task_struct *task) |
1034 | { | 1077 | { |
1035 | return task->pids[PIDTYPE_PID].pid; | 1078 | return task->pids[PIDTYPE_PID].pid; |
@@ -1101,7 +1144,6 @@ static inline void put_task_struct(struct task_struct *t) | |||
1101 | #define PF_MEMALLOC 0x00000800 /* Allocating memory */ | 1144 | #define PF_MEMALLOC 0x00000800 /* Allocating memory */ |
1102 | #define PF_FLUSHER 0x00001000 /* responsible for disk writeback */ | 1145 | #define PF_FLUSHER 0x00001000 /* responsible for disk writeback */ |
1103 | #define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ | 1146 | #define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ |
1104 | #define PF_FREEZE 0x00004000 /* this task is being frozen for suspend now */ | ||
1105 | #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ | 1147 | #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ |
1106 | #define PF_FROZEN 0x00010000 /* frozen for system suspend */ | 1148 | #define PF_FROZEN 0x00010000 /* frozen for system suspend */ |
1107 | #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ | 1149 | #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ |
@@ -1223,7 +1265,6 @@ extern struct mm_struct init_mm; | |||
1223 | 1265 | ||
1224 | #define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr) | 1266 | #define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr) |
1225 | extern struct task_struct *find_task_by_pid_type(int type, int pid); | 1267 | extern struct task_struct *find_task_by_pid_type(int type, int pid); |
1226 | extern void set_special_pids(pid_t session, pid_t pgrp); | ||
1227 | extern void __set_special_pids(pid_t session, pid_t pgrp); | 1268 | extern void __set_special_pids(pid_t session, pid_t pgrp); |
1228 | 1269 | ||
1229 | /* per-UID process charging. */ | 1270 | /* per-UID process charging. */ |
@@ -1288,7 +1329,6 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv); | |||
1288 | extern int kill_pid(struct pid *pid, int sig, int priv); | 1329 | extern int kill_pid(struct pid *pid, int sig, int priv); |
1289 | extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); | 1330 | extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); |
1290 | extern int kill_pg_info(int, struct siginfo *, pid_t); | 1331 | extern int kill_pg_info(int, struct siginfo *, pid_t); |
1291 | extern int kill_proc_info(int, struct siginfo *, pid_t); | ||
1292 | extern void do_notify_parent(struct task_struct *, int); | 1332 | extern void do_notify_parent(struct task_struct *, int); |
1293 | extern void force_sig(int, struct task_struct *); | 1333 | extern void force_sig(int, struct task_struct *); |
1294 | extern void force_sig_specific(int, struct task_struct *); | 1334 | extern void force_sig_specific(int, struct task_struct *); |
@@ -1365,7 +1405,6 @@ extern NORET_TYPE void do_group_exit(int); | |||
1365 | extern void daemonize(const char *, ...); | 1405 | extern void daemonize(const char *, ...); |
1366 | extern int allow_signal(int); | 1406 | extern int allow_signal(int); |
1367 | extern int disallow_signal(int); | 1407 | extern int disallow_signal(int); |
1368 | extern struct task_struct *child_reaper; | ||
1369 | 1408 | ||
1370 | extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); | 1409 | extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); |
1371 | extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); | 1410 | extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); |
@@ -1610,87 +1649,6 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | |||
1610 | 1649 | ||
1611 | extern void normalize_rt_tasks(void); | 1650 | extern void normalize_rt_tasks(void); |
1612 | 1651 | ||
1613 | #ifdef CONFIG_PM | ||
1614 | /* | ||
1615 | * Check if a process has been frozen | ||
1616 | */ | ||
1617 | static inline int frozen(struct task_struct *p) | ||
1618 | { | ||
1619 | return p->flags & PF_FROZEN; | ||
1620 | } | ||
1621 | |||
1622 | /* | ||
1623 | * Check if there is a request to freeze a process | ||
1624 | */ | ||
1625 | static inline int freezing(struct task_struct *p) | ||
1626 | { | ||
1627 | return p->flags & PF_FREEZE; | ||
1628 | } | ||
1629 | |||
1630 | /* | ||
1631 | * Request that a process be frozen | ||
1632 | * FIXME: SMP problem. We may not modify other process' flags! | ||
1633 | */ | ||
1634 | static inline void freeze(struct task_struct *p) | ||
1635 | { | ||
1636 | p->flags |= PF_FREEZE; | ||
1637 | } | ||
1638 | |||
1639 | /* | ||
1640 | * Sometimes we may need to cancel the previous 'freeze' request | ||
1641 | */ | ||
1642 | static inline void do_not_freeze(struct task_struct *p) | ||
1643 | { | ||
1644 | p->flags &= ~PF_FREEZE; | ||
1645 | } | ||
1646 | |||
1647 | /* | ||
1648 | * Wake up a frozen process | ||
1649 | */ | ||
1650 | static inline int thaw_process(struct task_struct *p) | ||
1651 | { | ||
1652 | if (frozen(p)) { | ||
1653 | p->flags &= ~PF_FROZEN; | ||
1654 | wake_up_process(p); | ||
1655 | return 1; | ||
1656 | } | ||
1657 | return 0; | ||
1658 | } | ||
1659 | |||
1660 | /* | ||
1661 | * freezing is complete, mark process as frozen | ||
1662 | */ | ||
1663 | static inline void frozen_process(struct task_struct *p) | ||
1664 | { | ||
1665 | p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN; | ||
1666 | } | ||
1667 | |||
1668 | extern void refrigerator(void); | ||
1669 | extern int freeze_processes(void); | ||
1670 | extern void thaw_processes(void); | ||
1671 | |||
1672 | static inline int try_to_freeze(void) | ||
1673 | { | ||
1674 | if (freezing(current)) { | ||
1675 | refrigerator(); | ||
1676 | return 1; | ||
1677 | } else | ||
1678 | return 0; | ||
1679 | } | ||
1680 | #else | ||
1681 | static inline int frozen(struct task_struct *p) { return 0; } | ||
1682 | static inline int freezing(struct task_struct *p) { return 0; } | ||
1683 | static inline void freeze(struct task_struct *p) { BUG(); } | ||
1684 | static inline int thaw_process(struct task_struct *p) { return 1; } | ||
1685 | static inline void frozen_process(struct task_struct *p) { BUG(); } | ||
1686 | |||
1687 | static inline void refrigerator(void) {} | ||
1688 | static inline int freeze_processes(void) { BUG(); return 0; } | ||
1689 | static inline void thaw_processes(void) {} | ||
1690 | |||
1691 | static inline int try_to_freeze(void) { return 0; } | ||
1692 | |||
1693 | #endif /* CONFIG_PM */ | ||
1694 | #endif /* __KERNEL__ */ | 1652 | #endif /* __KERNEL__ */ |
1695 | 1653 | ||
1696 | #endif | 1654 | #endif |