Blame view
kernel/rcu/tiny_plugin.h
4.57 KB
bbad93798 rcu: slim down rc... |
1 |
/* |
a57eb940d rcu: Add a TINY_P... |
2 |
* Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition |
bbad93798 rcu: slim down rc... |
3 |
* Internal non-public definitions that provide either classic |
a57eb940d rcu: Add a TINY_P... |
4 |
* or preemptible semantics. |
bbad93798 rcu: slim down rc... |
5 6 7 8 9 10 11 12 13 14 15 16 |
* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
87de1cfdc rcu: Stop trackin... |
17 18 |
* along with this program; if not, you can access it online at * http://www.gnu.org/licenses/gpl-2.0.html. |
bbad93798 rcu: slim down rc... |
19 |
* |
a57eb940d rcu: Add a TINY_P... |
20 |
* Copyright (c) 2010 Linaro |
bbad93798 rcu: slim down rc... |
21 22 23 |
* * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> */ |
b2c0710c4 rcu: move TINY_RC... |
24 |
#include <linux/kthread.h> |
9fc9204ef rcu: Make rcu/tin... |
25 |
#include <linux/init.h> |
9e571a82f rcu: add tracing ... |
26 27 |
#include <linux/debugfs.h> #include <linux/seq_file.h> |
24278d148 rcu: priority boo... |
28 29 30 31 32 |
/* Global control variables for rcupdate callback mechanism. */ struct rcu_ctrlblk { struct rcu_head *rcucblist; /* List of pending callbacks (CBs). */ struct rcu_head **donetail; /* ->next pointer of last "done" CB. */ struct rcu_head **curtail; /* ->next pointer of last CB. */ |
9e571a82f rcu: add tracing ... |
33 |
RCU_TRACE(long qlen); /* Number of pending CBs. */ |
6bfc09e23 rcu: Provide RCU ... |
34 35 36 |
RCU_TRACE(unsigned long gp_start); /* Start time for stalls. */ RCU_TRACE(unsigned long ticks_this_gp); /* Statistic for stalls. */ RCU_TRACE(unsigned long jiffies_stall); /* Jiffies at next stall. */ |
e66c33d57 rcu: Add const an... |
37 |
RCU_TRACE(const char *name); /* Name of RCU type. */ |
24278d148 rcu: priority boo... |
38 39 40 41 42 43 |
}; /* Definition for rcupdate control block. */ static struct rcu_ctrlblk rcu_sched_ctrlblk = { .donetail = &rcu_sched_ctrlblk.rcucblist, .curtail = &rcu_sched_ctrlblk.rcucblist, |
e99033c5c rcu: Put names in... |
44 |
RCU_TRACE(.name = "rcu_sched") |
24278d148 rcu: priority boo... |
45 46 47 48 49 |
}; static struct rcu_ctrlblk rcu_bh_ctrlblk = { .donetail = &rcu_bh_ctrlblk.rcucblist, .curtail = &rcu_bh_ctrlblk.rcucblist, |
e99033c5c rcu: Put names in... |
50 |
RCU_TRACE(.name = "rcu_bh") |
24278d148 rcu: priority boo... |
51 52 53 |
}; #ifdef CONFIG_DEBUG_LOCK_ALLOC |
318bdcd95 rcu: Consolidate ... |
54 |
#include <linux/kernel_stat.h> |
24278d148 rcu: priority boo... |
55 56 |
int rcu_scheduler_active __read_mostly; EXPORT_SYMBOL_GPL(rcu_scheduler_active); |
bbad93798 rcu: slim down rc... |
57 58 59 60 61 |
/* * During boot, we forgive RCU lockdep issues. After this function is * invoked, we start taking RCU lockdep issues seriously. */ |
b2c0710c4 rcu: move TINY_RC... |
62 |
void __init rcu_scheduler_starting(void) |
bbad93798 rcu: slim down rc... |
63 64 65 66 67 68 |
{ WARN_ON(nr_context_switches() > 0); rcu_scheduler_active = 1; } #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
24278d148 rcu: priority boo... |
69 |
|
9e571a82f rcu: add tracing ... |
70 |
#ifdef CONFIG_RCU_TRACE |
9e571a82f rcu: add tracing ... |
71 72 73 |
static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n) { unsigned long flags; |
7a11e2058 rcu: Move TINY_PR... |
74 |
local_irq_save(flags); |
9e571a82f rcu: add tracing ... |
75 |
rcp->qlen -= n; |
7a11e2058 rcu: Move TINY_PR... |
76 |
local_irq_restore(flags); |
9e571a82f rcu: add tracing ... |
77 78 79 80 81 82 83 |
} /* * Dump statistics for TINY_RCU, such as they are. */ static int show_tiny_stats(struct seq_file *m, void *unused) { |
9e571a82f rcu: add tracing ... |
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
seq_printf(m, "rcu_sched: qlen: %ld ", rcu_sched_ctrlblk.qlen); seq_printf(m, "rcu_bh: qlen: %ld ", rcu_bh_ctrlblk.qlen); return 0; } static int show_tiny_stats_open(struct inode *inode, struct file *file) { return single_open(file, show_tiny_stats, NULL); } static const struct file_operations show_tiny_stats_fops = { .owner = THIS_MODULE, .open = show_tiny_stats_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static struct dentry *rcudir; static int __init rcutiny_trace_init(void) { struct dentry *retval; rcudir = debugfs_create_dir("rcu", NULL); if (!rcudir) goto free_out; retval = debugfs_create_file("rcudata", 0444, rcudir, NULL, &show_tiny_stats_fops); if (!retval) goto free_out; return 0; free_out: debugfs_remove_recursive(rcudir); return 1; } |
9fc9204ef rcu: Make rcu/tin... |
122 |
device_initcall(rcutiny_trace_init); |
9e571a82f rcu: add tracing ... |
123 |
|
318bdcd95 rcu: Consolidate ... |
124 125 126 127 128 129 130 131 132 |
static void check_cpu_stall(struct rcu_ctrlblk *rcp) { unsigned long j; unsigned long js; if (rcu_cpu_stall_suppress) return; rcp->ticks_this_gp++; j = jiffies; |
7d0ae8086 rcu: Convert ACCE... |
133 |
js = READ_ONCE(rcp->jiffies_stall); |
ec1fe396f rcu: Fix RCU CPU ... |
134 |
if (rcp->rcucblist && ULONG_CMP_GE(j, js)) { |
318bdcd95 rcu: Consolidate ... |
135 136 |
pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld) ", |
5f6130fa5 tiny_rcu: Directl... |
137 |
rcp->name, rcp->ticks_this_gp, DYNTICK_TASK_EXIT_IDLE, |
318bdcd95 rcu: Consolidate ... |
138 139 |
jiffies - rcp->gp_start, rcp->qlen); dump_stack(); |
7d0ae8086 rcu: Convert ACCE... |
140 141 |
WRITE_ONCE(rcp->jiffies_stall, jiffies + 3 * rcu_jiffies_till_stall_check() + 3); |
ec1fe396f rcu: Fix RCU CPU ... |
142 |
} else if (ULONG_CMP_GE(j, js)) { |
7d0ae8086 rcu: Convert ACCE... |
143 144 |
WRITE_ONCE(rcp->jiffies_stall, jiffies + rcu_jiffies_till_stall_check()); |
ec1fe396f rcu: Fix RCU CPU ... |
145 |
} |
318bdcd95 rcu: Consolidate ... |
146 |
} |
318bdcd95 rcu: Consolidate ... |
147 148 |
static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp) { |
318bdcd95 rcu: Consolidate ... |
149 150 |
rcp->ticks_this_gp = 0; rcp->gp_start = jiffies; |
7d0ae8086 rcu: Convert ACCE... |
151 152 |
WRITE_ONCE(rcp->jiffies_stall, jiffies + rcu_jiffies_till_stall_check()); |
318bdcd95 rcu: Consolidate ... |
153 154 155 156 157 158 159 |
} static void check_cpu_stalls(void) { RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk)); RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk)); } |
149614446 rcu: Shrink TINY_... |
160 161 |
#endif /* #ifdef CONFIG_RCU_TRACE */ |