Frederic Weisbecker 1598f4a476 rcu/nocb: Add/del rdp to iterate from rcuog itself
NOCB rdp's are part of a group whose list is iterated by the
corresponding rdp leader.

This list is RCU traversed because an rdp can be either added or
deleted concurrently. Upon addition, a new iteration to the list after
a synchronization point (a pair of LOCK/UNLOCK ->nocb_gp_lock) is forced
to make sure:

1) we didn't miss a new element added in the middle of an iteration
2) we didn't ignore a whole subset of the list due to an element being
   quickly deleted and then re-added.
3) we prevent from probably other surprises...

Although this layout is expected to be safe, it doesn't help anybody
to sleep well.

Simplify instead the nocb state toggling with moving the list
modification from the nocb (de-)offloading workqueue to the rcuog
kthreads instead.

Whenever the rdp leader is expected to (re-)set the SEGCBLIST_KTHREAD_GP
flag of a target rdp, the latter is queued so that the leader handles
the flag flip along with adding or deleting the target rdp to the list
to iterate. This way the list modification and iteration happen from the
same kthread and those operations can't race altogether.

As a bonus, the flags for each rdp don't need to be checked locklessly
before each iteration, which is one less opportunity to produce
nightmares.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Uladzislau Rezki <uladzislau.rezki@sony.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Zqiang <qiang1.zhang@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
2022-07-19 11:42:36 -07:00
..
2022-05-26 17:13:43 -07:00
2022-06-02 07:17:59 +02:00
2022-06-05 10:40:31 -07:00
2022-05-25 16:18:27 -07:00
2021-12-02 17:25:21 +09:00
2022-05-25 11:32:53 -07:00
2022-06-02 08:55:01 -07:00
2022-05-27 21:24:19 -07:00
2022-01-11 13:08:21 -08:00
2022-06-15 19:28:44 -04:00
2021-09-08 15:32:35 -07:00
2022-05-23 17:51:12 -07:00
2022-03-15 10:32:44 +01:00
2022-03-28 17:29:53 -07:00
2021-06-18 11:43:08 +02:00
2021-09-08 15:32:34 -07:00
2021-05-07 00:26:33 -07:00
2022-05-29 10:31:36 -07:00
2022-05-02 14:06:20 -06:00
2021-10-14 13:29:18 +02:00
2022-01-08 12:43:57 -06:00
2022-06-17 14:57:42 -05:00
2022-05-24 11:11:13 -07:00
2022-02-25 09:36:06 +01:00
2022-05-26 16:57:20 -07:00