srcu: Shrink Tiny SRCU a bit more
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 21 Apr 2017 20:33:20 +0000 (13:33 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 8 Jun 2017 15:25:31 +0000 (08:25 -0700)
This commit rearranges Tiny SRCU's srcu_struct structure, substitutes
u8 for bool, and shrinks counters down to short.

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

index 42311ee0334fde629280f6b92cdc065853e3ba14..b8859179b001e9fe81947598036607c105a3168f 100644 (file)
 #include <linux/swait.h>
 
 struct srcu_struct {
-       int srcu_lock_nesting[2];       /* srcu_read_lock() nesting depth. */
+       short srcu_lock_nesting[2];     /* srcu_read_lock() nesting depth. */
+       short srcu_idx;                 /* Current reader array element. */
+       u8 srcu_gp_running;             /* GP workqueue running? */
+       u8 srcu_gp_waiting;             /* GP waiting for readers? */
        struct swait_queue_head srcu_wq;
                                        /* Last srcu_read_unlock() wakes GP. */
        unsigned long srcu_gp_seq;      /* GP seq # for callback tagging. */
        struct rcu_segcblist srcu_cblist;
                                        /* Pending SRCU callbacks. */
-       int srcu_idx;                   /* Current reader array element. */
-       bool srcu_gp_running;           /* GP workqueue running? */
-       bool srcu_gp_waiting;           /* GP waiting for readers? */
        struct work_struct srcu_work;   /* For driving grace periods. */
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
        struct lockdep_map dep_map;
index ae6e574d4cf5c3fbdd8ab9a56009981cec9935a1..a58592b73f19e36494096e3323d266ced3b1152e 100644 (file)
@@ -609,7 +609,7 @@ static void srcu_torture_stats(void)
        pr_cont("\n");
 #elif defined(CONFIG_TINY_SRCU)
        idx = READ_ONCE(srcu_ctlp->srcu_idx) & 0x1;
-       pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%d,%d)\n",
+       pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n",
                 torture_type, TORTURE_FLAG, idx,
                 READ_ONCE(srcu_ctlp->srcu_lock_nesting[!idx]),
                 READ_ONCE(srcu_ctlp->srcu_lock_nesting[idx]));