sched debug: BKL usage statistics
[safe/jmp/linux-2.6] / kernel / sched_debug.c
index 4eaaf96..823b63a 100644 (file)
@@ -134,6 +134,10 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
        spread0 = min_vruntime - rq0_min_vruntime;
        SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "spread0",
                        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)
@@ -210,6 +214,49 @@ static void sysrq_sched_debug_show(void)
        sched_debug_show(NULL, NULL);
 }
 
+#ifdef CONFIG_FAIR_USER_SCHED
+
+static DEFINE_MUTEX(root_user_share_mutex);
+
+static int
+root_user_share_read_proc(char *page, char **start, off_t off, int count,
+                                int *eof, void *data)
+{
+       int len;
+
+       len = sprintf(page, "%d\n", init_task_grp_load);
+
+       return len;
+}
+
+static int
+root_user_share_write_proc(struct file *file, const char __user *buffer,
+                                unsigned long count, void *data)
+{
+       unsigned long shares;
+       char kbuf[sizeof(unsigned long)+1];
+       int rc = 0;
+
+       if (copy_from_user(kbuf, buffer, sizeof(kbuf)))
+               return -EFAULT;
+
+       shares = simple_strtoul(kbuf, NULL, 0);
+
+       if (!shares)
+               shares = NICE_0_LOAD;
+
+       mutex_lock(&root_user_share_mutex);
+
+       init_task_grp_load = shares;
+       rc = sched_group_set_shares(&init_task_grp, shares);
+
+       mutex_unlock(&root_user_share_mutex);
+
+       return (rc < 0 ? rc : count);
+}
+
+#endif /* CONFIG_FAIR_USER_SCHED */
+
 static int sched_debug_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, sched_debug_show, NULL);
@@ -232,6 +279,15 @@ static int __init init_sched_debug_procfs(void)
 
        pe->proc_fops = &sched_debug_fops;
 
+#ifdef CONFIG_FAIR_USER_SCHED
+       pe = create_proc_entry("root_user_share", 0644, NULL);
+       if (!pe)
+               return -ENOMEM;
+
+       pe->read_proc = root_user_share_read_proc;
+       pe->write_proc = root_user_share_write_proc;
+#endif
+
        return 0;
 }
 
@@ -269,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));
@@ -296,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;