Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8efb56172bc55082b8490778b07ef73eea0b551
Commit:     b8efb56172bc55082b8490778b07ef73eea0b551
Parent:     de8d585a12aef40676f12ddc63e97daaf7752ba1
Author:     Ingo Molnar <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 17:00:10 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 17:00:10 2007 +0200

    sched debug: BKL usage statistics
    
    add per task and per rq BKL usage statistics.
    
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]>
    Reviewed-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 include/linux/sched.h |    4 ++++
 kernel/sched.c        |    9 +++++++++
 kernel/sched_debug.c  |    4 ++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d0cc583..920eb73 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -621,6 +621,10 @@ struct sched_info {
        /* timestamps */
        unsigned long long last_arrival,/* when we last ran on a cpu */
                           last_queued; /* when we were last queued to run */
+#ifdef CONFIG_SCHEDSTATS
+       /* BKL stats */
+       unsigned long bkl_cnt;
+#endif
 };
 #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
 
diff --git a/kernel/sched.c b/kernel/sched.c
index f33608e..5004dff 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -356,6 +356,9 @@ struct rq {
        /* try_to_wake_up() stats */
        unsigned long ttwu_cnt;
        unsigned long ttwu_local;
+
+       /* BKL stats */
+       unsigned long bkl_cnt;
 #endif
        struct lock_class_key rq_lock_key;
 };
@@ -3414,6 +3417,12 @@ static inline void schedule_debug(struct task_struct 
*prev)
        profile_hit(SCHED_PROFILING, __builtin_return_address(0));
 
        schedstat_inc(this_rq(), sched_cnt);
+#ifdef CONFIG_SCHEDSTATS
+       if (unlikely(prev->lock_depth >= 0)) {
+               schedstat_inc(this_rq(), bkl_cnt);
+               schedstat_inc(prev, sched_info.bkl_cnt);
+       }
+#endif
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 57ee9d5..823b63a 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -136,6 +136,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct 
cfs_rq *cfs_rq)
                        SPLIT_NS(spread0));
        SEQ_printf(m, "  .%-30s: %ld\n", "nr_running", cfs_rq->nr_running);
        SEQ_printf(m, "  .%-30s: %ld\n", "load", cfs_rq->load.weight);
+       SEQ_printf(m, "  .%-30s: %ld\n", "bkl_cnt",
+                       rq->bkl_cnt);
 }
 
 static void print_cpu(struct seq_file *m, int cpu)
@@ -323,6 +325,7 @@ void proc_sched_show_task(struct task_struct *p, struct 
seq_file *m)
        PN(se.exec_max);
        PN(se.slice_max);
        PN(se.wait_max);
+       P(sched_info.bkl_cnt);
 #endif
        SEQ_printf(m, "%-25s:%20Ld\n",
                   "nr_switches", (long long)(p->nvcsw + p->nivcsw));
@@ -350,6 +353,7 @@ void proc_sched_set_task(struct task_struct *p)
        p->se.exec_max                  = 0;
        p->se.slice_max                 = 0;
        p->se.wait_max                  = 0;
+       p->sched_info.bkl_cnt           = 0;
 #endif
        p->se.sum_exec_runtime          = 0;
        p->se.prev_sum_exec_runtime     = 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to