summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch')
-rw-r--r--patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch b/patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch
new file mode 100644
index 0000000..d3a20fb
--- /dev/null
+++ b/patches/boot_time_opt_guest/0103-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch
@@ -0,0 +1,38 @@
1From 7be707833bb35c295eb702d13cf73ac9390e4b31 Mon Sep 17 00:00:00 2001
2From: Arjan van de Ven <arjan@linux.intel.com>
3Date: Wed, 11 Feb 2015 16:25:16 -0600
4Subject: [PATCH 103/114] sysrq: skip synchronize_rcu() if there is no old op
5
6synchronize_rcu() is expensive. Currently it is called as part of the sysrq
7registration/unregistration, which happens during boot several times.
8Now, the reason for the synchronize_rcu() is to allow an old registered
9operation to expire properly... which is pointless if the old operation
10is NULL...
11So we can save the common case of the old operation being NULL a lot of time
12by just checking for non-NULL prior to the synchronize_rcu()
13
14Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
15Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
16---
17 drivers/tty/sysrq.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
21index 701c085bb19b..c60c7ba57ad9 100644
22--- a/drivers/tty/sysrq.c
23+++ b/drivers/tty/sysrq.c
24@@ -1065,8 +1065,10 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p,
25 * A concurrent __handle_sysrq either got the old op or the new op.
26 * Wait for it to go away before returning, so the code for an old
27 * op is not freed (eg. on module unload) while it is in use.
28+ * This is only relevant if the old op is not NULL of course.
29 */
30- synchronize_rcu();
31+ if (remove_op_p)
32+ synchronize_rcu();
33
34 return retval;
35 }
36--
372.11.1
38