Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1645270

[PATCH] rcu: mark debug_lockdep_rcu_enabled() as pure

From Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Newsgroups linux.kernel
Subject [PATCH] rcu: mark debug_lockdep_rcu_enabled() as pure
Date 2017-05-19 09:20 +0200
Message-ID <tIKmC-7av-27@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


This allows to get rid of unneeded invocations.

Function debug_lockdep_rcu_enabled() becomes really hot if several
debug options are enabled together with CONFIG_PROVE_RCU.

Hottest path ends with:
  debug_lockdep_rcu_enabled
  is_ftrace_trampoline
  __kernel_text_address

Here debug_lockdep_rcu_enabled() is called from condition
(debug_lockdep_rcu_enabled() && !__warned && (c)) inside macro
do_for_each_ftrace_op(), where "c" is false.

With this patch "netperf -H localhost" shows boost from 2400 to 2500.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 include/linux/rcupdate.h |    2 +-
 kernel/rcu/update.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e1e5d002fdb9..9ecb3cb715bd 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -472,7 +472,7 @@ extern struct lockdep_map rcu_lock_map;
 extern struct lockdep_map rcu_bh_lock_map;
 extern struct lockdep_map rcu_sched_lock_map;
 extern struct lockdep_map rcu_callback_map;
-int debug_lockdep_rcu_enabled(void);
+int __pure debug_lockdep_rcu_enabled(void);
 
 int rcu_read_lock_held(void);
 int rcu_read_lock_bh_held(void);
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 273e869ca21d..a0c30abefdcd 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -292,7 +292,7 @@ struct lockdep_map rcu_callback_map =
 	STATIC_LOCKDEP_MAP_INIT("rcu_callback", &rcu_callback_key);
 EXPORT_SYMBOL_GPL(rcu_callback_map);
 
-int notrace debug_lockdep_rcu_enabled(void)
+int __pure notrace debug_lockdep_rcu_enabled(void)
 {
 	return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && debug_locks &&
 	       current->lockdep_recursion == 0;

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] rcu: mark debug_lockdep_rcu_enabled() as pure Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2017-05-19 09:20 +0200
  Re: [PATCH] rcu: mark debug_lockdep_rcu_enabled() as pure "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-05-20 18:50 +0200
    Re: [PATCH] rcu: mark debug_lockdep_rcu_enabled() as pure Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2017-05-21 11:00 +0200

csiph-web