Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[safe/jmp/linux-2.6] / kernel / rcutree_trace.c
index 0cb52b8..4b31c77 100644 (file)
@@ -20,7 +20,7 @@
  * Papers:  http://www.rdrop.com/users/paulmck/RCU
  *
  * For detailed explanation of Read-Copy Update mechanism see -
- *             Documentation/RCU
+ *             Documentation/RCU
  *
  */
 #include <linux/types.h>
@@ -77,8 +77,12 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 
 static int show_rcudata(struct seq_file *m, void *unused)
 {
-       seq_puts(m, "rcu:\n");
-       PRINT_RCU_DATA(rcu_data, print_one_rcu_data, m);
+#ifdef CONFIG_TREE_PREEMPT_RCU
+       seq_puts(m, "rcu_preempt:\n");
+       PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data, m);
+#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
+       seq_puts(m, "rcu_sched:\n");
+       PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m);
        seq_puts(m, "rcu_bh:\n");
        PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data, m);
        return 0;
@@ -89,7 +93,7 @@ static int rcudata_open(struct inode *inode, struct file *file)
        return single_open(file, show_rcudata, NULL);
 }
 
-static struct file_operations rcudata_fops = {
+static const struct file_operations rcudata_fops = {
        .owner = THIS_MODULE,
        .open = rcudata_open,
        .read = seq_read,
@@ -103,7 +107,7 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp)
                return;
        seq_printf(m, "%d,%s,%ld,%ld,%d,%ld,%d",
                   rdp->cpu,
-                  cpu_is_offline(rdp->cpu) ? "\"Y\"" : "\"N\"",
+                  cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"",
                   rdp->completed, rdp->gpnum,
                   rdp->passed_quiesc, rdp->passed_quiesc_completed,
                   rdp->qs_pending);
@@ -125,8 +129,12 @@ static int show_rcudata_csv(struct seq_file *m, void *unused)
        seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\",");
 #endif /* #ifdef CONFIG_NO_HZ */
        seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\"\n");
-       seq_puts(m, "\"rcu:\"\n");
-       PRINT_RCU_DATA(rcu_data, print_one_rcu_data_csv, m);
+#ifdef CONFIG_TREE_PREEMPT_RCU
+       seq_puts(m, "\"rcu_preempt:\"\n");
+       PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m);
+#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
+       seq_puts(m, "\"rcu_sched:\"\n");
+       PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m);
        seq_puts(m, "\"rcu_bh:\"\n");
        PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data_csv, m);
        return 0;
@@ -137,7 +145,7 @@ static int rcudata_csv_open(struct inode *inode, struct file *file)
        return single_open(file, show_rcudata_csv, NULL);
 }
 
-static struct file_operations rcudata_csv_fops = {
+static const struct file_operations rcudata_csv_fops = {
        .owner = THIS_MODULE,
        .open = rcudata_csv_open,
        .read = seq_read,
@@ -151,13 +159,13 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
        struct rcu_node *rnp;
 
        seq_printf(m, "c=%ld g=%ld s=%d jfq=%ld j=%x "
-                     "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu\n",
+                     "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu oqlen=%ld\n",
                   rsp->completed, rsp->gpnum, rsp->signaled,
                   (long)(rsp->jiffies_force_qs - jiffies),
                   (int)(jiffies & 0xffff),
                   rsp->n_force_qs, rsp->n_force_qs_ngp,
                   rsp->n_force_qs - rsp->n_force_qs_ngp,
-                  rsp->n_force_qs_lh);
+                  rsp->n_force_qs_lh, rsp->orphan_qlen);
        for (rnp = &rsp->node[0]; rnp - &rsp->node[0] < NUM_RCU_NODES; rnp++) {
                if (rnp->level != level) {
                        seq_puts(m, "\n");
@@ -172,8 +180,12 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
 
 static int show_rcuhier(struct seq_file *m, void *unused)
 {
-       seq_puts(m, "rcu:\n");
-       print_one_rcu_state(m, &rcu_state);
+#ifdef CONFIG_TREE_PREEMPT_RCU
+       seq_puts(m, "rcu_preempt:\n");
+       print_one_rcu_state(m, &rcu_preempt_state);
+#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
+       seq_puts(m, "rcu_sched:\n");
+       print_one_rcu_state(m, &rcu_sched_state);
        seq_puts(m, "rcu_bh:\n");
        print_one_rcu_state(m, &rcu_bh_state);
        return 0;
@@ -184,7 +196,7 @@ static int rcuhier_open(struct inode *inode, struct file *file)
        return single_open(file, show_rcuhier, NULL);
 }
 
-static struct file_operations rcuhier_fops = {
+static const struct file_operations rcuhier_fops = {
        .owner = THIS_MODULE,
        .open = rcuhier_open,
        .read = seq_read,
@@ -194,8 +206,12 @@ static struct file_operations rcuhier_fops = {
 
 static int show_rcugp(struct seq_file *m, void *unused)
 {
-       seq_printf(m, "rcu: completed=%ld  gpnum=%ld\n",
-                  rcu_state.completed, rcu_state.gpnum);
+#ifdef CONFIG_TREE_PREEMPT_RCU
+       seq_printf(m, "rcu_preempt: completed=%ld  gpnum=%ld\n",
+                  rcu_preempt_state.completed, rcu_preempt_state.gpnum);
+#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
+       seq_printf(m, "rcu_sched: completed=%ld  gpnum=%ld\n",
+                  rcu_sched_state.completed, rcu_sched_state.gpnum);
        seq_printf(m, "rcu_bh: completed=%ld  gpnum=%ld\n",
                   rcu_bh_state.completed, rcu_bh_state.gpnum);
        return 0;
@@ -206,7 +222,7 @@ static int rcugp_open(struct inode *inode, struct file *file)
        return single_open(file, show_rcugp, NULL);
 }
 
-static struct file_operations rcugp_fops = {
+static const struct file_operations rcugp_fops = {
        .owner = THIS_MODULE,
        .open = rcugp_open,
        .read = seq_read,
@@ -244,8 +260,12 @@ static void print_rcu_pendings(struct seq_file *m, struct rcu_state *rsp)
 
 static int show_rcu_pending(struct seq_file *m, void *unused)
 {
-       seq_puts(m, "rcu:\n");
-       print_rcu_pendings(m, &rcu_state);
+#ifdef CONFIG_TREE_PREEMPT_RCU
+       seq_puts(m, "rcu_preempt:\n");
+       print_rcu_pendings(m, &rcu_preempt_state);
+#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
+       seq_puts(m, "rcu_sched:\n");
+       print_rcu_pendings(m, &rcu_sched_state);
        seq_puts(m, "rcu_bh:\n");
        print_rcu_pendings(m, &rcu_bh_state);
        return 0;
@@ -256,7 +276,7 @@ static int rcu_pending_open(struct inode *inode, struct file *file)
        return single_open(file, show_rcu_pending, NULL);
 }
 
-static struct file_operations rcu_pending_fops = {
+static const struct file_operations rcu_pending_fops = {
        .owner = THIS_MODULE,
        .open = rcu_pending_open,
        .read = seq_read,
@@ -265,62 +285,47 @@ static struct file_operations rcu_pending_fops = {
 };
 
 static struct dentry *rcudir;
-static struct dentry *datadir;
-static struct dentry *datadir_csv;
-static struct dentry *gpdir;
-static struct dentry *hierdir;
-static struct dentry *rcu_pendingdir;
 
 static int __init rcuclassic_trace_init(void)
 {
+       struct dentry *retval;
+
        rcudir = debugfs_create_dir("rcu", NULL);
        if (!rcudir)
-               goto out;
+               goto free_out;
 
-       datadir = debugfs_create_file("rcudata", 0444, rcudir,
+       retval = debugfs_create_file("rcudata", 0444, rcudir,
                                                NULL, &rcudata_fops);
-       if (!datadir)
+       if (!retval)
                goto free_out;
 
-       datadir_csv = debugfs_create_file("rcudata.csv", 0444, rcudir,
+       retval = debugfs_create_file("rcudata.csv", 0444, rcudir,
                                                NULL, &rcudata_csv_fops);
-       if (!datadir_csv)
+       if (!retval)
                goto free_out;
 
-       gpdir = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
-       if (!gpdir)
+       retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
+       if (!retval)
                goto free_out;
 
-       hierdir = debugfs_create_file("rcuhier", 0444, rcudir,
+       retval = debugfs_create_file("rcuhier", 0444, rcudir,
                                                NULL, &rcuhier_fops);
-       if (!hierdir)
+       if (!retval)
                goto free_out;
 
-       rcu_pendingdir = debugfs_create_file("rcu_pending", 0444, rcudir,
+       retval = debugfs_create_file("rcu_pending", 0444, rcudir,
                                                NULL, &rcu_pending_fops);
-       if (!rcu_pendingdir)
+       if (!retval)
                goto free_out;
        return 0;
 free_out:
-       if (datadir)
-               debugfs_remove(datadir);
-       if (datadir_csv)
-               debugfs_remove(datadir_csv);
-       if (gpdir)
-               debugfs_remove(gpdir);
-       debugfs_remove(rcudir);
-out:
+       debugfs_remove_recursive(rcudir);
        return 1;
 }
 
 static void __exit rcuclassic_trace_cleanup(void)
 {
-       debugfs_remove(datadir);
-       debugfs_remove(datadir_csv);
-       debugfs_remove(gpdir);
-       debugfs_remove(hierdir);
-       debugfs_remove(rcu_pendingdir);
-       debugfs_remove(rcudir);
+       debugfs_remove_recursive(rcudir);
 }