]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
srcu: Shrink Tiny SRCU a bit
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 28 Apr 2017 21:16:16 +0000 (14:16 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 8 Jun 2017 15:25:38 +0000 (08:25 -0700)
In Tiny SRCU, __srcu_read_lock() is a trivial function, outweighed by
its EXPORT_SYMBOL_GPL(), and on many architectures, its call sequence.
This commit therefore moves it to srcutiny.h so that it can be inlined.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/srcutiny.h
kernel/rcu/srcutiny.c

index b8859179b001e9fe81947598036607c105a3168f..b6edd9c8fdce4045ef0621301ada61c8b489b75c 100644 (file)
@@ -63,6 +63,21 @@ void srcu_drive_gp(struct work_struct *wp);
 
 void synchronize_srcu(struct srcu_struct *sp);
 
+/*
+ * Counts the new reader in the appropriate per-CPU element of the
+ * srcu_struct.  Can be invoked from irq/bh handlers, but the matching
+ * __srcu_read_unlock() must be in the same handler instance.  Returns an
+ * index that must be passed to the matching srcu_read_unlock().
+ */
+static inline int __srcu_read_lock(struct srcu_struct *sp)
+{
+       int idx;
+
+       idx = READ_ONCE(sp->srcu_idx);
+       WRITE_ONCE(sp->srcu_lock_nesting[idx], sp->srcu_lock_nesting[idx] + 1);
+       return idx;
+}
+
 static inline void synchronize_srcu_expedited(struct srcu_struct *sp)
 {
        synchronize_srcu(sp);
index 32798eb14853d47b9b155bb4bd3c4007dd13736e..988543721d5d2e273c699430d28bed23dddc8dbb 100644 (file)
@@ -95,22 +95,6 @@ void cleanup_srcu_struct(struct srcu_struct *sp)
 }
 EXPORT_SYMBOL_GPL(cleanup_srcu_struct);
 
-/*
- * Counts the new reader in the appropriate per-CPU element of the
- * srcu_struct.  Can be invoked from irq/bh handlers, but the matching
- * __srcu_read_unlock() must be in the same handler instance.  Returns an
- * index that must be passed to the matching srcu_read_unlock().
- */
-int __srcu_read_lock(struct srcu_struct *sp)
-{
-       int idx;
-
-       idx = READ_ONCE(sp->srcu_idx);
-       WRITE_ONCE(sp->srcu_lock_nesting[idx], sp->srcu_lock_nesting[idx] + 1);
-       return idx;
-}
-EXPORT_SYMBOL_GPL(__srcu_read_lock);
-
 /*
  * Removes the count for the old reader from the appropriate element of
  * the srcu_struct.