UBUNTU: Ubuntu-2.6.38-12.51
[linux-flexiantxendom0-natty.git] / kernel / sched_stats.h
index ee71bec..48ddf43 100644 (file)
@@ -4,7 +4,7 @@
  * bump this up when changing the output format or the meaning of an existing
  * format, so that tools can adapt (or abort)
  */
-#define SCHEDSTAT_VERSION 14
+#define SCHEDSTAT_VERSION 15
 
 static int show_schedstat(struct seq_file *seq, void *v)
 {
@@ -26,12 +26,11 @@ static int show_schedstat(struct seq_file *seq, void *v)
 
                /* runqueue-specific stats */
                seq_printf(seq,
-                   "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu",
-                   cpu, rq->yld_both_empty,
-                   rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
+                   "cpu%d %u %u %u %u %u %u %llu %llu %lu",
+                   cpu, rq->yld_count,
                    rq->sched_switch, rq->sched_count, rq->sched_goidle,
                    rq->ttwu_count, rq->ttwu_local,
-                   rq->rq_sched_info.cpu_time,
+                   rq->rq_cpu_time,
                    rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
 
                seq_printf(seq, "\n");
@@ -42,7 +41,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
                for_each_domain(cpu, sd) {
                        enum cpu_idle_type itype;
 
-                       cpumask_scnprintf(mask_str, mask_len, sd->span);
+                       cpumask_scnprintf(mask_str, mask_len,
+                                         sched_domain_span(sd));
                        seq_printf(seq, "domain%d %s", dcount++, mask_str);
                        for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
                                        itype++) {
@@ -123,7 +123,7 @@ static inline void
 rq_sched_info_depart(struct rq *rq, unsigned long long delta)
 {
        if (rq)
-               rq->rq_sched_info.cpu_time += delta;
+               rq->rq_cpu_time += delta;
 }
 
 static inline void
@@ -157,15 +157,7 @@ static inline void sched_info_reset_dequeued(struct task_struct *t)
 }
 
 /*
- * Called when a process is dequeued from the active array and given
- * the cpu.  We should note that with the exception of interactive
- * tasks, the expired queue will become the active queue after the active
- * queue is empty, without explicitly dequeuing and requeuing tasks in the
- * expired queue.  (Interactive tasks may be requeued directly to the
- * active queue, thus delaying tasks in the expired queue from running;
- * see scheduler_tick()).
- *
- * Though we are interested in knowing how long it was from the *first* time a
+ * We are interested in knowing how long it was from the *first* time a
  * task was queued to the time that it finally hit a cpu, we call this routine
  * from dequeue_task() to account for possible rq->clock skew across cpus. The
  * delta taken on each cpu would annul the skew.
@@ -203,16 +195,6 @@ static void sched_info_arrive(struct task_struct *t)
 }
 
 /*
- * Called when a process is queued into either the active or expired
- * array.  The time is noted and later used to determine how long we
- * had to wait for us to reach the cpu.  Since the expired queue will
- * become the active queue after active queue is empty, without dequeuing
- * and requeuing any tasks, we are interested in queuing to either. It
- * is unusual but not impossible for tasks to be dequeued and immediately
- * requeued in the same or another array: this can happen in sched_yield(),
- * set_user_nice(), and even load_balance() as it moves tasks from runqueue
- * to runqueue.
- *
  * This function is only called from enqueue_task(), but also only updates
  * the timestamp if it is already not set.  It's assumed that
  * sched_info_dequeued() will clear that stamp when appropriate.
@@ -236,7 +218,6 @@ static inline void sched_info_depart(struct task_struct *t)
        unsigned long long delta = task_rq(t)->clock -
                                        t->sched_info.last_arrival;
 
-       t->sched_info.cpu_time += delta;
        rq_sched_info_depart(task_rq(t), delta);
 
        if (t->state == TASK_RUNNING)
@@ -296,18 +277,15 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next)
 static inline void account_group_user_time(struct task_struct *tsk,
                                           cputime_t cputime)
 {
-       struct signal_struct *sig;
+       struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
 
-       sig = tsk->signal;
-       if (unlikely(!sig))
+       if (!cputimer->running)
                return;
-       if (sig->cputime.totals) {
-               struct task_cputime *times;
 
-               times = per_cpu_ptr(sig->cputime.totals, get_cpu());
-               times->utime = cputime_add(times->utime, cputime);
-               put_cpu_no_resched();
-       }
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.utime =
+               cputime_add(cputimer->cputime.utime, cputime);
+       spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -323,18 +301,15 @@ static inline void account_group_user_time(struct task_struct *tsk,
 static inline void account_group_system_time(struct task_struct *tsk,
                                             cputime_t cputime)
 {
-       struct signal_struct *sig;
+       struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
 
-       sig = tsk->signal;
-       if (unlikely(!sig))
+       if (!cputimer->running)
                return;
-       if (sig->cputime.totals) {
-               struct task_cputime *times;
 
-               times = per_cpu_ptr(sig->cputime.totals, get_cpu());
-               times->stime = cputime_add(times->stime, cputime);
-               put_cpu_no_resched();
-       }
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.stime =
+               cputime_add(cputimer->cputime.stime, cputime);
+       spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -350,16 +325,12 @@ static inline void account_group_system_time(struct task_struct *tsk,
 static inline void account_group_exec_runtime(struct task_struct *tsk,
                                              unsigned long long ns)
 {
-       struct signal_struct *sig;
+       struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
 
-       sig = tsk->signal;
-       if (unlikely(!sig))
+       if (!cputimer->running)
                return;
-       if (sig->cputime.totals) {
-               struct task_cputime *times;
 
-               times = per_cpu_ptr(sig->cputime.totals, get_cpu());
-               times->sum_exec_runtime += ns;
-               put_cpu_no_resched();
-       }
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.sum_exec_runtime += ns;
+       spin_unlock(&cputimer->lock);
 }