From: Paul E. McKenney Date: Thu, 1 Sep 2022 17:55:57 +0000 (-0700) Subject: Merge branches 'doc.2022.08.31b', 'fixes.2022.08.31b', 'kvfree.2022.08.31b', 'nocb... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5c0ec4900497f7c9cc12f393c329a52e67bc6b8b;p=linux.git Merge branches 'doc.2022.08.31b', 'fixes.2022.08.31b', 'kvfree.2022.08.31b', 'nocb.2022.09.01a', 'poll.2022.08.31b', 'poll-srcu.2022.08.31b' and 'tasks.2022.08.31b' into HEAD doc.2022.08.31b: Documentation updates fixes.2022.08.31b: Miscellaneous fixes kvfree.2022.08.31b: kvfree_rcu() updates nocb.2022.09.01a: NOCB CPU updates poll.2022.08.31b: Full-oldstate RCU polling grace-period API poll-srcu.2022.08.31b: Polled SRCU grace-period updates tasks.2022.08.31b: Tasks RCU updates --- 5c0ec4900497f7c9cc12f393c329a52e67bc6b8b diff --cc kernel/rcu/tree.c index 79aea7df4345e,79aea7df4345e,7b90478b752e8,79aea7df4345e,ef15bae3c7c77,79aea7df4345e,11d5aefd16961..6bb8e72bc8151 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@@@@@@@ -3616,8 -3616,8 -3632,8 -3616,8 -3688,56 -3616,8 -3616,8 +3704,56 @@@@@@@@ bool poll_state_synchronize_rcu(unsigne EXPORT_SYMBOL_GPL(poll_state_synchronize_rcu); /** ---- -- * cond_synchronize_rcu - Conditionally wait for an RCU grace period ++++ ++ * poll_state_synchronize_rcu_full - Has the specified RCU grace period completed? ++++ ++ * @rgosp: value from get_state_synchronize_rcu_full() or start_poll_synchronize_rcu_full() + * ++++ ++ * If a full RCU grace period has elapsed since the earlier call from ++++ ++ * which *rgosp was obtained, return @true, otherwise return @false. ++++ ++ * If @false is returned, it is the caller's responsibility to invoke this ++++ ++ * function later on until it does return @true. Alternatively, the caller ++++ ++ * can explicitly wait for a grace period, for example, by passing @rgosp ++++ ++ * to cond_synchronize_rcu() or by directly invoking synchronize_rcu(). ++++ ++ * ++++ ++ * Yes, this function does not take counter wrap into account. ++++ ++ * But counter wrap is harmless. If the counter wraps, we have waited ++++ ++ * for more than a billion grace periods (and way more on a 64-bit ++++ ++ * system!). Those needing to keep rcu_gp_oldstate values for very ++++ ++ * long time periods (many hours even on 32-bit systems) should check ++++ ++ * them occasionally and either refresh them or set a flag indicating ++++ ++ * that the grace period has completed. Alternatively, they can use ++++ ++ * get_completed_synchronize_rcu_full() to get a guaranteed-completed ++++ ++ * grace-period state. ++ + ++ * ++++ ++ * This function provides the same memory-ordering guarantees that would ++++ ++ * be provided by a synchronize_rcu() that was invoked at the call to ++++ ++ * the function that provided @rgosp, and that returned at the end of this ++++ ++ * function. And this guarantee requires that the root rcu_node structure's ++++ ++ * ->gp_seq field be checked instead of that of the rcu_state structure. ++++ ++ * The problem is that the just-ending grace-period's callbacks can be ++++ ++ * invoked between the time that the root rcu_node structure's ->gp_seq ++++ ++ * field is updated and the time that the rcu_state structure's ->gp_seq ++++ ++ * field is updated. Therefore, if a single synchronize_rcu() is to ++++ ++ * cause a subsequent poll_state_synchronize_rcu_full() to return @true, ++++ ++ * then the root rcu_node structure is the one that needs to be polled. ++++ ++ */ ++++ ++bool poll_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp) ++++ ++{ ++++ ++ struct rcu_node *rnp = rcu_get_root(); ++++ ++ ++++ ++ smp_mb(); // Order against root rcu_node structure grace-period cleanup. ++++ ++ if (rgosp->rgos_norm == RCU_GET_STATE_COMPLETED || ++++ ++ rcu_seq_done_exact(&rnp->gp_seq, rgosp->rgos_norm) || ++++ ++ rgosp->rgos_exp == RCU_GET_STATE_COMPLETED || ++++ ++ rcu_seq_done_exact(&rcu_state.expedited_sequence, rgosp->rgos_exp)) { ++++ ++ smp_mb(); /* Ensure GP ends before subsequent accesses. */ ++++ ++ return true; ++++ ++ } ++++ ++ return false; ++++ ++} ++++ ++EXPORT_SYMBOL_GPL(poll_state_synchronize_rcu_full); ++++ ++ ++++ ++/** ++++ ++ * cond_synchronize_rcu - Conditionally wait for an RCU grace period * @oldstate: value from get_state_synchronize_rcu(), start_poll_synchronize_rcu(), or start_poll_synchronize_rcu_expedited() * * If a full RCU grace period has elapsed since the earlier call to