]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/sched.h
[PATCH] csa: convert CONFIG tag for extended accounting routines
[linux-2.6-omap-h63xx.git] / include / linux / sched.h
index 1c876e27ff936dfe375694bc3cb6b812f1ef33a2..4ddeb0f982fbc2c0c4be90d968983b39da84ab07 100644 (file)
@@ -148,6 +148,7 @@ extern unsigned long weighted_cpuload(const int cpu);
 #define EXIT_DEAD              32
 /* in tsk->state again */
 #define TASK_NONINTERACTIVE    64
+#define TASK_DEAD              128
 
 #define __set_task_state(tsk, state_value)             \
        do { (tsk)->state = (state_value); } while (0)
@@ -463,6 +464,10 @@ struct signal_struct {
 #ifdef CONFIG_BSD_PROCESS_ACCT
        struct pacct_struct pacct;      /* per-process accounting information */
 #endif
+#ifdef CONFIG_TASKSTATS
+       spinlock_t stats_lock;
+       struct taskstats *stats;
+#endif
 };
 
 /* Context switch must be unlocked if interrupts are to be enabled */
@@ -500,8 +505,8 @@ struct signal_struct {
 #define rt_prio(prio)          unlikely((prio) < MAX_RT_PRIO)
 #define rt_task(p)             rt_prio((p)->prio)
 #define batch_task(p)          (unlikely((p)->policy == SCHED_BATCH))
-#define has_rt_policy(p) \
-       unlikely((p)->policy != SCHED_NORMAL && (p)->policy != SCHED_BATCH)
+#define is_rt_policy(p)                ((p) != SCHED_NORMAL && (p) != SCHED_BATCH)
+#define has_rt_policy(p)       unlikely(is_rt_policy((p)->policy))
 
 /*
  * Some day this will be a full-fledged user tracking system..
@@ -537,7 +542,7 @@ extern struct user_struct root_user;
 struct backing_dev_info;
 struct reclaim_state;
 
-#ifdef CONFIG_SCHEDSTATS
+#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 struct sched_info {
        /* cumulative counters */
        unsigned long   cpu_time,       /* time spent on the cpu */
@@ -548,9 +553,53 @@ struct sched_info {
        unsigned long   last_arrival,   /* when we last ran on a cpu */
                        last_queued;    /* when we were last queued to run */
 };
+#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
 
+#ifdef CONFIG_SCHEDSTATS
 extern struct file_operations proc_schedstat_operations;
+#endif /* CONFIG_SCHEDSTATS */
+
+#ifdef CONFIG_TASK_DELAY_ACCT
+struct task_delay_info {
+       spinlock_t      lock;
+       unsigned int    flags;  /* Private per-task flags */
+
+       /* For each stat XXX, add following, aligned appropriately
+        *
+        * struct timespec XXX_start, XXX_end;
+        * u64 XXX_delay;
+        * u32 XXX_count;
+        *
+        * Atomicity of updates to XXX_delay, XXX_count protected by
+        * single lock above (split into XXX_lock if contention is an issue).
+        */
+
+       /*
+        * XXX_count is incremented on every XXX operation, the delay
+        * associated with the operation is added to XXX_delay.
+        * XXX_delay contains the accumulated delay time in nanoseconds.
+        */
+       struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */
+       u64 blkio_delay;        /* wait for sync block io completion */
+       u64 swapin_delay;       /* wait for swapin block io completion */
+       u32 blkio_count;        /* total count of the number of sync block */
+                               /* io operations performed */
+       u32 swapin_count;       /* total count of the number of swapin block */
+                               /* io operations performed */
+};
+#endif /* CONFIG_TASK_DELAY_ACCT */
+
+static inline int sched_info_on(void)
+{
+#ifdef CONFIG_SCHEDSTATS
+       return 1;
+#elif defined(CONFIG_TASK_DELAY_ACCT)
+       extern int delayacct_on;
+       return delayacct_on;
+#else
+       return 0;
 #endif
+}
 
 enum idle_type
 {
@@ -661,7 +710,6 @@ extern unsigned int max_cache_size;
 
 
 struct io_context;                     /* See blkdev.h */
-void exit_io_context(void);
 struct cpuset;
 
 #define NGROUPS_SMALL          32
@@ -736,8 +784,9 @@ struct task_struct {
        struct prio_array *array;
 
        unsigned short ioprio;
+#ifdef CONFIG_BLK_DEV_IO_TRACE
        unsigned int btrace_seq;
-
+#endif
        unsigned long sleep_avg;
        unsigned long long timestamp, last_ran;
        unsigned long long sched_time; /* sched_clock time spent running */
@@ -747,7 +796,7 @@ struct task_struct {
        cpumask_t cpus_allowed;
        unsigned int time_slice, first_time_slice;
 
-#ifdef CONFIG_SCHEDSTATS
+#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
        struct sched_info sched_info;
 #endif
 
@@ -771,6 +820,11 @@ struct task_struct {
        unsigned did_exec:1;
        pid_t pid;
        pid_t tgid;
+
+#ifdef CONFIG_CC_STACKPROTECTOR
+       /* Canary value for the -fstack-protector gcc feature */
+       unsigned long stack_canary;
+#endif
        /* 
         * pointers to (original) parent process, youngest child, younger sibling,
         * older sibling, respectively.  (p->father can be replaced with 
@@ -817,6 +871,15 @@ struct task_struct {
        struct key *thread_keyring;     /* keyring private to this thread */
        unsigned char jit_keyring;      /* default keyring to attach requested keys to */
 #endif
+       /*
+        * fpu_counter contains the number of consecutive context switches
+        * that the FPU is used. If this is over a threshold, the lazy fpu
+        * saving becomes unlazy to save the trap. This is an unsigned char
+        * so that after 256 times the counter wraps and the behavior turns
+        * lazy again; this to deal with bursty apps that only use FPU for
+        * a short time
+        */
+       unsigned char fpu_counter;
        int oomkilladj; /* OOM kill score adjustment (bit shift). */
        char comm[TASK_COMM_LEN]; /* executable name excluding path
                                     - access with [gs]et_task_comm (which lock
@@ -824,8 +887,10 @@ struct task_struct {
                                     - initialized normally by flush_old_exec */
 /* file system info */
        int link_count, total_link_count;
+#ifdef CONFIG_SYSVIPC
 /* ipc stuff */
        struct sysv_sem sysvsem;
+#endif
 /* CPU-specific state of this task */
        struct thread_struct thread;
 /* filesystem information */
@@ -916,7 +981,7 @@ struct task_struct {
        wait_queue_t *io_wait;
 /* i/o counters(bytes read/written, #syscalls */
        u64 rchar, wchar, syscr, syscw;
-#if defined(CONFIG_BSD_PROCESS_ACCT)
+#if defined(CONFIG_TASK_XACCT)
        u64 acct_rss_mem1;      /* accumulated rss usage */
        u64 acct_vm_mem1;       /* accumulated virtual memory usage */
        clock_t acct_stimexpd;  /* clock_t-converted stime since last update */
@@ -945,6 +1010,9 @@ struct task_struct {
         * cache last used pipe for splice
         */
        struct pipe_inode_info *splice_pipe;
+#ifdef CONFIG_TASK_DELAY_ACCT
+       struct task_delay_info *delays;
+#endif
 };
 
 static inline pid_t process_group(struct task_struct *tsk)
@@ -965,6 +1033,16 @@ static inline int pid_alive(struct task_struct *p)
        return p->pids[PIDTYPE_PID].pid != NULL;
 }
 
+/**
+ * is_init - check if a task structure is the first user space
+ *          task the kernel created.
+ * @p: Task structure to be checked.
+ */
+static inline int is_init(struct task_struct *tsk)
+{
+       return tsk->pid == 1;
+}
+
 extern void free_task(struct task_struct *tsk);
 #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
 
@@ -983,7 +1061,6 @@ static inline void put_task_struct(struct task_struct *t)
                                        /* Not implemented yet, only for 486*/
 #define PF_STARTING    0x00000002      /* being created */
 #define PF_EXITING     0x00000004      /* getting shut down */
-#define PF_DEAD                0x00000008      /* Dead */
 #define PF_FORKNOEXEC  0x00000040      /* forked but didn't exec */
 #define PF_SUPERPRIV   0x00000100      /* used super-user privileges */
 #define PF_DUMPCORE    0x00000200      /* dumped core */
@@ -1128,7 +1205,7 @@ extern void switch_uid(struct user_struct *);
 
 #include <asm/current.h>
 
-extern void do_timer(struct pt_regs *);
+extern void do_timer(unsigned long ticks);
 
 extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
 extern int FASTCALL(wake_up_process(struct task_struct * tsk));
@@ -1505,6 +1582,14 @@ static inline void freeze(struct task_struct *p)
        p->flags |= PF_FREEZE;
 }
 
+/*
+ * Sometimes we may need to cancel the previous 'freeze' request
+ */
+static inline void do_not_freeze(struct task_struct *p)
+{
+       p->flags &= ~PF_FREEZE;
+}
+
 /*
  * Wake up a frozen process
  */