diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-08-14 17:41:49 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-08-30 19:10:49 -0400 |
| commit | 4e6ea4ef56f9425cd239ffdb6be45b3aeeb347fd (patch) | |
| tree | 81702573011d79ef39d2934e020372976256b9de /include/linux | |
| parent | 55cda2290bf9d8510fbe7c1939a36680476c69c4 (diff) | |
srcu: Make early-boot call_srcu() reuse workqueue lists
Allocating a list_head structure that is almost never used, and, when
used, is used only during early boot (rcu_init() and earlier), is a bit
wasteful. This commit therefore eliminates that list_head in favor of
the one in the work_struct structure. This is safe because the work_struct
structure cannot be used until after rcu_init() returns.
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/srcutiny.h | 2 | ||||
| -rw-r--r-- | include/linux/srcutree.h | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h index 2b5c0822e683..f41d2fb09f87 100644 --- a/include/linux/srcutiny.h +++ b/include/linux/srcutiny.h | |||
| @@ -36,7 +36,6 @@ struct srcu_struct { | |||
| 36 | struct rcu_head *srcu_cb_head; /* Pending callbacks: Head. */ | 36 | struct rcu_head *srcu_cb_head; /* Pending callbacks: Head. */ |
| 37 | struct rcu_head **srcu_cb_tail; /* Pending callbacks: Tail. */ | 37 | struct rcu_head **srcu_cb_tail; /* Pending callbacks: Tail. */ |
| 38 | struct work_struct srcu_work; /* For driving grace periods. */ | 38 | struct work_struct srcu_work; /* For driving grace periods. */ |
| 39 | struct list_head srcu_boot_entry; /* Early-boot callbacks. */ | ||
| 40 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 41 | struct lockdep_map dep_map; | 40 | struct lockdep_map dep_map; |
| 42 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 41 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
| @@ -49,7 +48,6 @@ void srcu_drive_gp(struct work_struct *wp); | |||
| 49 | .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \ | 48 | .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \ |
| 50 | .srcu_cb_tail = &name.srcu_cb_head, \ | 49 | .srcu_cb_tail = &name.srcu_cb_head, \ |
| 51 | .srcu_work = __WORK_INITIALIZER(name.srcu_work, srcu_drive_gp), \ | 50 | .srcu_work = __WORK_INITIALIZER(name.srcu_work, srcu_drive_gp), \ |
| 52 | .srcu_boot_entry = LIST_HEAD_INIT(name.srcu_boot_entry), \ | ||
| 53 | __SRCU_DEP_MAP_INIT(name) \ | 51 | __SRCU_DEP_MAP_INIT(name) \ |
| 54 | } | 52 | } |
| 55 | 53 | ||
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 9cfa4610113a..0ae91b3a7406 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h | |||
| @@ -94,7 +94,6 @@ struct srcu_struct { | |||
| 94 | /* callback for the barrier */ | 94 | /* callback for the barrier */ |
| 95 | /* operation. */ | 95 | /* operation. */ |
| 96 | struct delayed_work work; | 96 | struct delayed_work work; |
| 97 | struct list_head srcu_boot_entry; /* Early-boot callbacks. */ | ||
| 98 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 97 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 99 | struct lockdep_map dep_map; | 98 | struct lockdep_map dep_map; |
| 100 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 99 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
| @@ -110,7 +109,7 @@ struct srcu_struct { | |||
| 110 | .sda = &pcpu_name, \ | 109 | .sda = &pcpu_name, \ |
| 111 | .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ | 110 | .lock = __SPIN_LOCK_UNLOCKED(name.lock), \ |
| 112 | .srcu_gp_seq_needed = -1UL, \ | 111 | .srcu_gp_seq_needed = -1UL, \ |
| 113 | .srcu_boot_entry = LIST_HEAD_INIT(name.srcu_boot_entry), \ | 112 | .work = __DELAYED_WORK_INITIALIZER(name.work, NULL, 0), \ |
| 114 | __SRCU_DEP_MAP_INIT(name) \ | 113 | __SRCU_DEP_MAP_INIT(name) \ |
| 115 | } | 114 | } |
| 116 | 115 | ||
