Merge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux...
[safe/jmp/linux-2.6] / include / linux / sched.h
index 29eae73..75e6e60 100644 (file)
@@ -100,7 +100,7 @@ struct robust_list_head;
 struct bio;
 struct fs_struct;
 struct bts_context;
-struct perf_counter_context;
+struct perf_event_context;
 
 /*
  * List of flags we want to share for kernel threads,
@@ -140,6 +140,10 @@ extern int nr_processes(void);
 extern unsigned long nr_running(void);
 extern unsigned long nr_uninterruptible(void);
 extern unsigned long nr_iowait(void);
+extern unsigned long nr_iowait_cpu(void);
+extern unsigned long this_cpu_load(void);
+
+
 extern void calc_global_load(void);
 extern u64 cpu_nr_migrations(int cpu);
 
@@ -190,6 +194,7 @@ extern unsigned long long time_sync_thresh;
 /* in tsk->state again */
 #define TASK_DEAD              64
 #define TASK_WAKEKILL          128
+#define TASK_WAKING            256
 
 /* Convenience macros for the sake of set_task_state */
 #define TASK_KILLABLE          (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
@@ -256,7 +261,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
 extern void init_idle(struct task_struct *idle, int cpu);
 extern void init_idle_bootup_task(struct task_struct *idle);
 
-extern int runqueue_is_locked(void);
+extern int runqueue_is_locked(int cpu);
 extern void task_rq_unlock_wait(struct task_struct *p);
 
 extern cpumask_var_t nohz_cpu_mask;
@@ -304,7 +309,7 @@ extern void softlockup_tick(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_all_softlockup_watchdogs(void);
 extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
-                                   struct file *filp, void __user *buffer,
+                                   void __user *buffer,
                                    size_t *lenp, loff_t *ppos);
 extern unsigned int  softlockup_panic;
 extern int softlockup_thresh;
@@ -326,7 +331,7 @@ extern unsigned long sysctl_hung_task_check_count;
 extern unsigned long sysctl_hung_task_timeout_secs;
 extern unsigned long sysctl_hung_task_warnings;
 extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
-                                        struct file *filp, void __user *buffer,
+                                        void __user *buffer,
                                         size_t *lenp, loff_t *ppos);
 #endif
 
@@ -421,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
        return max(mm->hiwater_rss, get_mm_rss(mm));
 }
 
+static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
+                                        struct mm_struct *mm)
+{
+       unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
+
+       if (*maxrss < hiwater_rss)
+               *maxrss = hiwater_rss;
+}
+
 static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
 {
        return max(mm->hiwater_vm, mm->total_vm);
@@ -433,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm);
 /* dumpable bits */
 #define MMF_DUMPABLE      0  /* core dump is permitted */
 #define MMF_DUMP_SECURELY 1  /* core file is readable only by root */
+
 #define MMF_DUMPABLE_BITS 2
+#define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
 
 /* coredump filter bits */
 #define MMF_DUMP_ANON_PRIVATE  2
@@ -443,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm);
 #define MMF_DUMP_ELF_HEADERS   6
 #define MMF_DUMP_HUGETLB_PRIVATE 7
 #define MMF_DUMP_HUGETLB_SHARED  8
+
 #define MMF_DUMP_FILTER_SHIFT  MMF_DUMPABLE_BITS
 #define MMF_DUMP_FILTER_BITS   7
 #define MMF_DUMP_FILTER_MASK \
@@ -456,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm);
 #else
 # define MMF_DUMP_MASK_DEFAULT_ELF     0
 #endif
+                                       /* leave room for more dump flags */
+#define MMF_VM_MERGEABLE       16      /* KSM may merge identical pages */
+
+#define MMF_INIT_MASK          (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
 
 struct sighand_struct {
        atomic_t                count;
@@ -472,6 +493,13 @@ struct pacct_struct {
        unsigned long           ac_minflt, ac_majflt;
 };
 
+struct cpu_itimer {
+       cputime_t expires;
+       cputime_t incr;
+       u32 error;
+       u32 incr_error;
+};
+
 /**
  * struct task_cputime - collected CPU time counts
  * @utime:             time spent in user mode, in &cputime_t units
@@ -566,9 +594,12 @@ struct signal_struct {
        struct pid *leader_pid;
        ktime_t it_real_incr;
 
-       /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
-       cputime_t it_prof_expires, it_virt_expires;
-       cputime_t it_prof_incr, it_virt_incr;
+       /*
+        * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
+        * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
+        * values are defined to 0 and 1 respectively
+        */
+       struct cpu_itimer it[2];
 
        /*
         * Thread group totals for process CPU timers.
@@ -600,6 +631,7 @@ struct signal_struct {
        unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
        unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
        unsigned long inblock, oublock, cinblock, coublock;
+       unsigned long maxrss, cmaxrss;
        struct task_io_accounting ioac;
 
        /*
@@ -631,6 +663,8 @@ struct signal_struct {
        unsigned audit_tty;
        struct tty_audit_buf *tty_audit_buf;
 #endif
+
+       int oom_adj;    /* OOM kill score adjustment (bit shift) */
 };
 
 /* Context switch must be unlocked if interrupts are to be enabled */
@@ -700,7 +734,7 @@ struct user_struct {
 #endif
 #endif
 
-#ifdef CONFIG_PERF_COUNTERS
+#ifdef CONFIG_PERF_EVENTS
        atomic_long_t locked_vm;
 #endif
 };
@@ -802,14 +836,14 @@ enum cpu_idle_type {
 #define SD_BALANCE_NEWIDLE     0x0002  /* Balance when about to become idle */
 #define SD_BALANCE_EXEC                0x0004  /* Balance on exec */
 #define SD_BALANCE_FORK                0x0008  /* Balance on fork, clone */
-#define SD_WAKE_IDLE           0x0010  /* Wake to idle CPU on task wakeup */
+#define SD_BALANCE_WAKE                0x0010  /* Balance on wakeup */
 #define SD_WAKE_AFFINE         0x0020  /* Wake task to waking CPU */
-#define SD_WAKE_BALANCE                0x0040  /* Perform balancing at task wakeup */
+#define SD_PREFER_LOCAL                0x0040  /* Prefer to keep tasks local to this domain */
 #define SD_SHARE_CPUPOWER      0x0080  /* Domain members share cpu power */
 #define SD_POWERSAVINGS_BALANCE        0x0100  /* Balance for power savings */
 #define SD_SHARE_PKG_RESOURCES 0x0200  /* Domain members share cpu pkg resources */
 #define SD_SERIALIZE           0x0400  /* Only a single load balancing instance */
-#define SD_WAKE_IDLE_FAR       0x0800  /* Gain latency sacrificing cache hit */
+
 #define SD_PREFER_SIBLING      0x1000  /* Prefer to place tasks in a sibling domain */
 
 enum powersavings_balance_level {
@@ -991,6 +1025,9 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
        return 0;
 }
 
+unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
+unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
+
 #else /* CONFIG_SMP */
 
 struct sched_domain_attr;
@@ -1002,6 +1039,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
 }
 #endif /* !CONFIG_SMP */
 
+
 struct io_context;                     /* See blkdev.h */
 
 
@@ -1019,6 +1057,12 @@ struct uts_namespace;
 struct rq;
 struct sched_domain;
 
+/*
+ * wake flags
+ */
+#define WF_SYNC                0x01            /* waker goes to sleep after wakup */
+#define WF_FORK                0x02            /* child wakeup after fork */
+
 struct sched_class {
        const struct sched_class *next;
 
@@ -1026,13 +1070,13 @@ struct sched_class {
        void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
        void (*yield_task) (struct rq *rq);
 
-       void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
+       void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
 
        struct task_struct * (*pick_next_task) (struct rq *rq);
        void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
-       int  (*select_task_rq)(struct task_struct *p, int sync);
+       int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
 
        unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
                        struct rq *busiest, unsigned long max_load_move,
@@ -1064,6 +1108,8 @@ struct sched_class {
        void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
                             int oldprio, int running);
 
+       unsigned int (*get_rr_interval) (struct task_struct *task);
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
        void (*moved_group) (struct task_struct *p);
 #endif
@@ -1102,6 +1148,8 @@ struct sched_entity {
        u64                     start_runtime;
        u64                     avg_wakeup;
 
+       u64                     avg_running;
+
 #ifdef CONFIG_SCHEDSTATS
        u64                     wait_start;
        u64                     wait_max;
@@ -1199,7 +1247,6 @@ struct task_struct {
         * a short time
         */
        unsigned char fpu_counter;
-       s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
 #ifdef CONFIG_BLK_DEV_IO_TRACE
        unsigned int btrace_seq;
 #endif
@@ -1224,7 +1271,6 @@ struct task_struct {
        struct mm_struct *mm, *active_mm;
 
 /* task state */
-       struct linux_binfmt *binfmt;
        int exit_state;
        int exit_code, exit_signal;
        int pdeath_signal;  /*  The signal sent when the parent dies  */
@@ -1436,10 +1482,10 @@ struct task_struct {
        struct list_head pi_state_list;
        struct futex_pi_state *pi_state_cache;
 #endif
-#ifdef CONFIG_PERF_COUNTERS
-       struct perf_counter_context *perf_counter_ctxp;
-       struct mutex perf_counter_mutex;
-       struct list_head perf_counter_list;
+#ifdef CONFIG_PERF_EVENTS
+       struct perf_event_context *perf_event_ctxp;
+       struct mutex perf_event_mutex;
+       struct list_head perf_event_list;
 #endif
 #ifdef CONFIG_NUMA
        struct mempolicy *mempolicy;    /* Protected by alloc_lock */
@@ -1492,6 +1538,7 @@ struct task_struct {
        /* bitmask of trace recursion */
        unsigned long trace_recursion;
 #endif /* CONFIG_TRACING */
+       unsigned long stack_start;
 };
 
 /* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1699,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p);
 #define PF_FROZEN      0x00010000      /* frozen for system suspend */
 #define PF_FSTRANS     0x00020000      /* inside a filesystem transaction */
 #define PF_KSWAPD      0x00040000      /* I am kswapd */
-#define PF_SWAPOFF     0x00080000      /* I am in swapoff */
+#define PF_OOM_ORIGIN  0x00080000      /* Allocating much memory to others */
 #define PF_LESS_THROTTLE 0x00100000    /* Throttle me less: I clean memory */
 #define PF_KTHREAD     0x00200000      /* I am a kernel thread */
 #define PF_RANDOMIZE   0x00400000      /* randomize virtual address space */
@@ -1742,7 +1789,6 @@ extern cputime_t task_gtime(struct task_struct *p);
 
 #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
 #define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
-#define RCU_READ_UNLOCK_GOT_QS  (1 << 2) /* CPU has responded to RCU core. */
 
 static inline void rcu_copy_process(struct task_struct *p)
 {
@@ -1772,10 +1818,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
        return 0;
 }
 #endif
+
+#ifndef CONFIG_CPUMASK_OFFSTACK
 static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
 {
        return set_cpus_allowed_ptr(p, &new_mask);
 }
+#endif
 
 /*
  * Architectures can set this to 1 if they have specified
@@ -1858,7 +1907,7 @@ extern unsigned int sysctl_sched_time_avg;
 extern unsigned int sysctl_timer_migration;
 
 int sched_nr_latency_handler(struct ctl_table *table, int write,
-               struct file *file, void __user *buffer, size_t *length,
+               void __user *buffer, size_t *length,
                loff_t *ppos);
 #endif
 #ifdef CONFIG_SCHED_DEBUG
@@ -1876,7 +1925,7 @@ extern unsigned int sysctl_sched_rt_period;
 extern int sysctl_sched_rt_runtime;
 
 int sched_rt_handler(struct ctl_table *table, int write,
-               struct file *filp, void __user *buffer, size_t *lenp,
+               void __user *buffer, size_t *lenp,
                loff_t *ppos);
 
 extern unsigned int sysctl_sched_compat_yield;
@@ -2011,6 +2060,7 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
 extern int kill_pid(struct pid *pid, int sig, int priv);
 extern int kill_proc_info(int, struct siginfo *, pid_t);
 extern int do_notify_parent(struct task_struct *, int);
+extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
 extern void force_sig(int, struct task_struct *);
 extern void force_sig_specific(int, struct task_struct *);
 extern int send_sig(int, struct task_struct *, int);
@@ -2288,7 +2338,10 @@ static inline int signal_pending(struct task_struct *p)
        return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
 }
 
-extern int __fatal_signal_pending(struct task_struct *p);
+static inline int __fatal_signal_pending(struct task_struct *p)
+{
+       return unlikely(sigismember(&p->pending.signal, SIGKILL));
+}
 
 static inline int fatal_signal_pending(struct task_struct *p)
 {