aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h142
1 files changed, 50 insertions, 92 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6735c1cf334c..ea92e5c89089 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
195extern cpumask_t nohz_cpu_mask; 196extern cpumask_t nohz_cpu_mask;
196 197
197extern void show_state(void); 198/*
199 * Only dump TASK_* tasks. (-1 for all tasks)
200 */
201extern void show_state_filter(unsigned long state_filter);
202
203static inline void show_state(void)
204{
205 show_state_filter(-1);
206}
207
198extern void show_regs(struct pt_regs *); 208extern 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
@@ -466,7 +489,6 @@ struct signal_struct {
466 struct pacct_struct pacct; /* per-process accounting information */ 489 struct pacct_struct pacct; /* per-process accounting information */
467#endif 490#endif
468#ifdef CONFIG_TASKSTATS 491#ifdef CONFIG_TASKSTATS
469 spinlock_t stats_lock;
470 struct taskstats *stats; 492 struct taskstats *stats;
471#endif 493#endif
472}; 494};
@@ -557,7 +579,7 @@ struct sched_info {
557#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 579#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
558 580
559#ifdef CONFIG_SCHEDSTATS 581#ifdef CONFIG_SCHEDSTATS
560extern struct file_operations proc_schedstat_operations; 582extern const struct file_operations proc_schedstat_operations;
561#endif /* CONFIG_SCHEDSTATS */ 583#endif /* CONFIG_SCHEDSTATS */
562 584
563#ifdef CONFIG_TASK_DELAY_ACCT 585#ifdef CONFIG_TASK_DELAY_ACCT
@@ -626,6 +648,7 @@ enum idle_type
626#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 648#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
627#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 649#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
628#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 */
629 652
630#define BALANCE_FOR_MC_POWER \ 653#define BALANCE_FOR_MC_POWER \
631 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0) 654 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
@@ -992,6 +1015,7 @@ struct task_struct {
992 wait_queue_t *io_wait; 1015 wait_queue_t *io_wait;
993/* i/o counters(bytes read/written, #syscalls */ 1016/* i/o counters(bytes read/written, #syscalls */
994 u64 rchar, wchar, syscr, syscw; 1017 u64 rchar, wchar, syscr, syscw;
1018 struct task_io_accounting ioac;
995#if defined(CONFIG_TASK_XACCT) 1019#if defined(CONFIG_TASK_XACCT)
996 u64 acct_rss_mem1; /* accumulated rss usage */ 1020 u64 acct_rss_mem1; /* accumulated rss usage */
997 u64 acct_vm_mem1; /* accumulated virtual memory usage */ 1021 u64 acct_vm_mem1; /* accumulated virtual memory usage */
@@ -1024,6 +1048,9 @@ struct task_struct {
1024#ifdef CONFIG_TASK_DELAY_ACCT 1048#ifdef CONFIG_TASK_DELAY_ACCT
1025 struct task_delay_info *delays; 1049 struct task_delay_info *delays;
1026#endif 1050#endif
1051#ifdef CONFIG_FAULT_INJECTION
1052 int make_it_fail;
1053#endif
1027}; 1054};
1028 1055
1029static inline pid_t process_group(struct task_struct *tsk) 1056static inline pid_t process_group(struct task_struct *tsk)
@@ -1031,6 +1058,21 @@ static inline pid_t process_group(struct task_struct *tsk)
1031 return tsk->signal->pgrp; 1058 return tsk->signal->pgrp;
1032} 1059}
1033 1060
1061static inline pid_t signal_session(struct signal_struct *sig)
1062{
1063 return sig->__session;
1064}
1065
1066static inline pid_t process_session(struct task_struct *tsk)
1067{
1068 return signal_session(tsk->signal);
1069}
1070
1071static inline void set_signal_session(struct signal_struct *sig, pid_t session)
1072{
1073 sig->__session = session;
1074}
1075
1034static inline struct pid *task_pid(struct task_struct *task) 1076static inline struct pid *task_pid(struct task_struct *task)
1035{ 1077{
1036 return task->pids[PIDTYPE_PID].pid; 1078 return task->pids[PIDTYPE_PID].pid;
@@ -1224,7 +1266,6 @@ extern struct mm_struct init_mm;
1224 1266
1225#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr) 1267#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr)
1226extern struct task_struct *find_task_by_pid_type(int type, int pid); 1268extern struct task_struct *find_task_by_pid_type(int type, int pid);
1227extern void set_special_pids(pid_t session, pid_t pgrp);
1228extern void __set_special_pids(pid_t session, pid_t pgrp); 1269extern void __set_special_pids(pid_t session, pid_t pgrp);
1229 1270
1230/* per-UID process charging. */ 1271/* per-UID process charging. */
@@ -1289,7 +1330,6 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
1289extern int kill_pid(struct pid *pid, int sig, int priv); 1330extern int kill_pid(struct pid *pid, int sig, int priv);
1290extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1331extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1291extern int kill_pg_info(int, struct siginfo *, pid_t); 1332extern int kill_pg_info(int, struct siginfo *, pid_t);
1292extern int kill_proc_info(int, struct siginfo *, pid_t);
1293extern void do_notify_parent(struct task_struct *, int); 1333extern void do_notify_parent(struct task_struct *, int);
1294extern void force_sig(int, struct task_struct *); 1334extern void force_sig(int, struct task_struct *);
1295extern void force_sig_specific(int, struct task_struct *); 1335extern void force_sig_specific(int, struct task_struct *);
@@ -1366,7 +1406,6 @@ extern NORET_TYPE void do_group_exit(int);
1366extern void daemonize(const char *, ...); 1406extern void daemonize(const char *, ...);
1367extern int allow_signal(int); 1407extern int allow_signal(int);
1368extern int disallow_signal(int); 1408extern int disallow_signal(int);
1369extern struct task_struct *child_reaper;
1370 1409
1371extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 1410extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
1372extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 1411extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
@@ -1611,87 +1650,6 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
1611 1650
1612extern void normalize_rt_tasks(void); 1651extern void normalize_rt_tasks(void);
1613 1652
1614#ifdef CONFIG_PM
1615/*
1616 * Check if a process has been frozen
1617 */
1618static inline int frozen(struct task_struct *p)
1619{
1620 return p->flags & PF_FROZEN;
1621}
1622
1623/*
1624 * Check if there is a request to freeze a process
1625 */
1626static inline int freezing(struct task_struct *p)
1627{
1628 return p->flags & PF_FREEZE;
1629}
1630
1631/*
1632 * Request that a process be frozen
1633 * FIXME: SMP problem. We may not modify other process' flags!
1634 */
1635static inline void freeze(struct task_struct *p)
1636{
1637 p->flags |= PF_FREEZE;
1638}
1639
1640/*
1641 * Sometimes we may need to cancel the previous 'freeze' request
1642 */
1643static inline void do_not_freeze(struct task_struct *p)
1644{
1645 p->flags &= ~PF_FREEZE;
1646}
1647
1648/*
1649 * Wake up a frozen process
1650 */
1651static inline int thaw_process(struct task_struct *p)
1652{
1653 if (frozen(p)) {
1654 p->flags &= ~PF_FROZEN;
1655 wake_up_process(p);
1656 return 1;
1657 }
1658 return 0;
1659}
1660
1661/*
1662 * freezing is complete, mark process as frozen
1663 */
1664static inline void frozen_process(struct task_struct *p)
1665{
1666 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
1667}
1668
1669extern void refrigerator(void);
1670extern int freeze_processes(void);
1671extern void thaw_processes(void);
1672
1673static inline int try_to_freeze(void)
1674{
1675 if (freezing(current)) {
1676 refrigerator();
1677 return 1;
1678 } else
1679 return 0;
1680}
1681#else
1682static inline int frozen(struct task_struct *p) { return 0; }
1683static inline int freezing(struct task_struct *p) { return 0; }
1684static inline void freeze(struct task_struct *p) { BUG(); }
1685static inline int thaw_process(struct task_struct *p) { return 1; }
1686static inline void frozen_process(struct task_struct *p) { BUG(); }
1687
1688static inline void refrigerator(void) {}
1689static inline int freeze_processes(void) { BUG(); return 0; }
1690static inline void thaw_processes(void) {}
1691
1692static inline int try_to_freeze(void) { return 0; }
1693
1694#endif /* CONFIG_PM */
1695#endif /* __KERNEL__ */ 1653#endif /* __KERNEL__ */
1696 1654
1697#endif 1655#endif