Skip to contentSkip to conversation

rcu/segcblist: Add counters to segcblist datastructure

RFC PATCH Superseded Joel Fernandes (Google) 2 participants 3 messages Jul 19, 2020 – Jul 29, 2020 RCU

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rcu/segcblist: Add counters to segcblist datastructure

From: Joel Fernandes <[email protected]>

Add counting of segment lengths of segmented callback list.

This will be useful for a number of things such as knowing how big the ready-to-execute segment have gotten. The immediate benefit is ability to trace how the callbacks in the segmented callback list change.

---
 include/linux/rcu_segcblist.h |  2 +
 kernel/rcu/rcu_segcblist.c    | 96 +++++++++++++++++++++++++++++++----
 2 files changed, 89 insertions(+), 9 deletions(-)
include/linux/rcu_segcblist.h +2 -0
index b36afe7b22c9..d462ae5e340a 100644
@@ -69,8 +69,10 @@ struct rcu_segcblist {
 	unsigned long gp_seq[RCU_CBLIST_NSEGS];
 #ifdef CONFIG_RCU_NOCB_CPU
 	atomic_long_t len;
+	atomic_long_t seglen[RCU_CBLIST_NSEGS];
 #else
 	long len;
+	long seglen[RCU_CBLIST_NSEGS];
 #endif
 	u8 enabled;
 	u8 offloaded;
kernel/rcu/rcu_segcblist.c +87 -9

188 lines not on this page · raw message

Signature · 1 line
2.28.0.rc0.105.gf9edc3c819-goog
#1 lore raw

kernel/rcu/rcu_segcblist.c struct rcu_head *rcu_cblist_dequeue(struct rcu_cblist *rclp) · line 131

Quoted 7 lines · Joel Fernandes (Google)
kernel/rcu/rcu_segcblist.c +7 -0
+/* Move from's segment length to to's segment. */
+static void rcu_segcblist_move_seglen(struct rcu_segcblist *rsclp, int from, int to)
+{
+	long len = rcu_segcblist_get_seglen(rsclp, from);
+
+	if (!len || from == to)
+		return;

Nit: You probably wanna do the parameter sanity checks before the atomic_read.

Thanks,
Davidlohr

#2 lore raw
Quoted 12 lines · Davidlohr Bueso

kernel/rcu/rcu_segcblist.c struct rcu_head *rcu_cblist_dequeue(struct rcu_cblist *rclp) · line 131

Quoted 7 lines · Joel Fernandes (Google)
kernel/rcu/rcu_segcblist.c +7 -0
+/* Move from's segment length to to's segment. */
+static void rcu_segcblist_move_seglen(struct rcu_segcblist *rsclp, int from, int to)
+{
+	long len = rcu_segcblist_get_seglen(rsclp, from);
+
+	if (!len || from == to)
+		return;

Nit: You probably wanna do the parameter sanity checks before the atomic_read.

Ok, I'll do that next revision. Thank you.

- Joel