Repository navigation
Commit b23d7a5
ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU
On a 144 thread system, `perf ftrace` takes about 20 seconds to start
up, due to calling synchronize_rcu() for each CPU.
cat /proc/108560/stack
0xc0003e7eb336f470
__switch_to+0x2e0/0x480
__wait_rcu_gp+0x20c/0x220
synchronize_rcu+0x9c/0xc0
ring_buffer_reset_cpu+0x88/0x2e0
tracing_reset_online_cpus+0x84/0xe0
tracing_open+0x1d4/0x1f0
On a system with 10x more threads, it starts to become an annoyance.
Batch these up so we disable all the per-cpu buffers first, then
synchronize_rcu() once, then reset each of the buffers. This brings
the time down to about 0.5s.
Link: https://lkml.kernel.org/r/20200625053403.2386972-1-npiggin@gmail.com
Tested-by: Anton Blanchard <anton@ozlabs.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>1 parent 10464b4 commit b23d7a5
3 files changed
Lines changed: 73 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
273 | 276 | | |
274 | 277 | | |
275 | 278 | | |
| |||
4790 | 4793 | | |
4791 | 4794 | | |
4792 | 4795 | | |
| 4796 | + | |
| 4797 | + | |
| 4798 | + | |
| 4799 | + | |
| 4800 | + | |
| 4801 | + | |
| 4802 | + | |
| 4803 | + | |
| 4804 | + | |
| 4805 | + | |
| 4806 | + | |
| 4807 | + | |
| 4808 | + | |
| 4809 | + | |
| 4810 | + | |
| 4811 | + | |
| 4812 | + | |
| 4813 | + | |
| 4814 | + | |
| 4815 | + | |
4793 | 4816 | | |
4794 | 4817 | | |
4795 | 4818 | | |
| |||
4798 | 4821 | | |
4799 | 4822 | | |
4800 | 4823 | | |
4801 | | - | |
4802 | 4824 | | |
4803 | 4825 | | |
4804 | 4826 | | |
| |||
4809 | 4831 | | |
4810 | 4832 | | |
4811 | 4833 | | |
4812 | | - | |
| 4834 | + | |
4813 | 4835 | | |
4814 | | - | |
4815 | | - | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
4816 | 4840 | | |
4817 | | - | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
4818 | 4850 | | |
4819 | | - | |
| 4851 | + | |
| 4852 | + | |
4820 | 4853 | | |
4821 | | - | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
4822 | 4857 | | |
4823 | | - | |
4824 | | - | |
| 4858 | + | |
| 4859 | + | |
4825 | 4860 | | |
4826 | | - | |
4827 | | - | |
| 4861 | + | |
| 4862 | + | |
| 4863 | + | |
| 4864 | + | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
| 4868 | + | |
4828 | 4869 | | |
4829 | | - | |
4830 | 4870 | | |
4831 | 4871 | | |
4832 | 4872 | | |
4833 | 4873 | | |
4834 | 4874 | | |
4835 | 4875 | | |
4836 | 4876 | | |
| 4877 | + | |
4837 | 4878 | | |
4838 | 4879 | | |
4839 | | - | |
4840 | | - | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
| 4896 | + | |
| 4897 | + | |
4841 | 4898 | | |
4842 | 4899 | | |
4843 | 4900 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2003 | 2003 | | |
2004 | 2004 | | |
2005 | 2005 | | |
2006 | | - | |
2007 | 2006 | | |
2008 | 2007 | | |
2009 | 2008 | | |
| |||
2015 | 2014 | | |
2016 | 2015 | | |
2017 | 2016 | | |
2018 | | - | |
2019 | | - | |
| 2017 | + | |
2020 | 2018 | | |
2021 | 2019 | | |
2022 | 2020 | | |
| |||
0 commit comments