The rclp->len field is accessed concurrently by multiple contexts in RCU operations. Using WRITE_ONCE() provides the necessary memory ordering guarantees.
This change ensures that the callback list length is updated atomically and provides consistent visibility across different CPU contexts, maintaining the integrity of RCU callback list management. Signed-off-by: Kaushlendra Kumar <kaushlendra.ku...@intel.com> --- kernel/rcu/rcu_segcblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c index 1693ea22ef1b..e10b36e9de54 100644 --- a/kernel/rcu/rcu_segcblist.c +++ b/kernel/rcu/rcu_segcblist.c @@ -71,7 +71,7 @@ struct rcu_head *rcu_cblist_dequeue(struct rcu_cblist *rclp) rhp = rclp->head; if (!rhp) return NULL; - rclp->len--; + WRITE_ONCE(rclp->len, rclp->len - 1); rclp->head = rhp->next; if (!rclp->head) rclp->tail = &rclp->head; -- 2.34.1