aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-07-08 18:17:59 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-09-07 19:18:13 -0400
commit85b39d305bfe809a11ff2770d380be3e2465beec (patch)
tree2bc6f52c07779203329b0d791f631ab894a8846e
parente02b2edfa13878c6671d31d5c736f56f89d99bf1 (diff)
rcu: Uninline rcu_read_lock_held()
This commit uninlines rcu_read_lock_held(). According to "size vmlinux" this saves 28549 in .text: - 5541731 3014560 14757888 23314179 + 5513182 3026848 14757888 23297918 Note: it looks as if the data grows by 12288 bytes but this is not true, it does not actually grow. But .data starts with ALIGN(THREAD_SIZE) and since .text shrinks the padding grows, and thus .data grows too as it seen by /bin/size. diff System.map: - ffffffff81510000 D _sdata - ffffffff81510000 D init_thread_union + ffffffff81509000 D _sdata + ffffffff8150c000 D init_thread_union Perhaps we can change vmlinux.lds.S to .data itself, so that /bin/size can't "wrongly" report that .data grows if .text shinks. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--include/linux/rcupdate.h36
-rw-r--r--kernel/rcu/update.c32
2 files changed, 33 insertions, 35 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 7e47e44bce03..321ed0d4e675 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -371,41 +371,7 @@ extern struct lockdep_map rcu_sched_lock_map;
371extern struct lockdep_map rcu_callback_map; 371extern struct lockdep_map rcu_callback_map;
372int debug_lockdep_rcu_enabled(void); 372int debug_lockdep_rcu_enabled(void);
373 373
374/** 374int rcu_read_lock_held(void);
375 * rcu_read_lock_held() - might we be in RCU read-side critical section?
376 *
377 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
378 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
379 * this assumes we are in an RCU read-side critical section unless it can
380 * prove otherwise. This is useful for debug checks in functions that
381 * require that they be called within an RCU read-side critical section.
382 *
383 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
384 * and while lockdep is disabled.
385 *
386 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
387 * occur in the same context, for example, it is illegal to invoke
388 * rcu_read_unlock() in process context if the matching rcu_read_lock()
389 * was invoked from within an irq handler.
390 *
391 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
392 * offline from an RCU perspective, so check for those as well.
393 */
394static inline int rcu_read_lock_held(void)
395{
396 if (!debug_lockdep_rcu_enabled())
397 return 1;
398 if (!rcu_is_watching())
399 return 0;
400 if (!rcu_lockdep_current_cpu_online())
401 return 0;
402 return lock_is_held(&rcu_lock_map);
403}
404
405/*
406 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
407 * hell.
408 */
409int rcu_read_lock_bh_held(void); 375int rcu_read_lock_bh_held(void);
410 376
411/** 377/**
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 4056d7992a6c..ea8ea7b16e11 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -137,6 +137,38 @@ int notrace debug_lockdep_rcu_enabled(void)
137EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled); 137EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled);
138 138
139/** 139/**
140 * rcu_read_lock_held() - might we be in RCU read-side critical section?
141 *
142 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
143 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
144 * this assumes we are in an RCU read-side critical section unless it can
145 * prove otherwise. This is useful for debug checks in functions that
146 * require that they be called within an RCU read-side critical section.
147 *
148 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
149 * and while lockdep is disabled.
150 *
151 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
152 * occur in the same context, for example, it is illegal to invoke
153 * rcu_read_unlock() in process context if the matching rcu_read_lock()
154 * was invoked from within an irq handler.
155 *
156 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
157 * offline from an RCU perspective, so check for those as well.
158 */
159int rcu_read_lock_held(void)
160{
161 if (!debug_lockdep_rcu_enabled())
162 return 1;
163 if (!rcu_is_watching())
164 return 0;
165 if (!rcu_lockdep_current_cpu_online())
166 return 0;
167 return lock_is_held(&rcu_lock_map);
168}
169EXPORT_SYMBOL_GPL(rcu_read_lock_held);
170
171/**
140 * rcu_read_lock_bh_held() - might we be in RCU-bh read-side critical section? 172 * rcu_read_lock_bh_held() - might we be in RCU-bh read-side critical section?
141 * 173 *
142 * Check for bottom half being disabled, which covers both the 174 * Check for bottom half being disabled, which covers both the