mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
UPSTREAM: rcu: Refactor code a bit in rcu_nocb_do_flush_bypass()
This consolidates the code a bit and makes it cleaner. Functionally it
is the same.
Bug: 258241771
Bug: 222463781
Test: CQ
Reported-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 3d222a0c0c)
Change-Id: I8422c7138edd6a476fc46374beefdf46dd76b8b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4318047
Tested-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Commit-Queue: Joel Fernandes <joelaf@google.com>
(cherry picked from commit 58cb433d445d2416ba26645e8df63d86afa15f8c)
[Cherry picked from chromeos-5.15 tree. Minor tweaks to commit message
to match Android style]
Signed-off-by: Qais Yousef <qyousef@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
f4abe7bb5f
commit
222a4cd66c
@@ -332,10 +332,11 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
|
|||||||
*
|
*
|
||||||
* Note that this function always returns true if rhp is NULL.
|
* Note that this function always returns true if rhp is NULL.
|
||||||
*/
|
*/
|
||||||
static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
|
static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp_in,
|
||||||
unsigned long j, bool lazy)
|
unsigned long j, bool lazy)
|
||||||
{
|
{
|
||||||
struct rcu_cblist rcl;
|
struct rcu_cblist rcl;
|
||||||
|
struct rcu_head *rhp = rhp_in;
|
||||||
|
|
||||||
WARN_ON_ONCE(!rcu_rdp_is_offloaded(rdp));
|
WARN_ON_ONCE(!rcu_rdp_is_offloaded(rdp));
|
||||||
rcu_lockdep_assert_cblist_protected(rdp);
|
rcu_lockdep_assert_cblist_protected(rdp);
|
||||||
@@ -350,16 +351,16 @@ static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the new CB requested was a lazy one, queue it onto the main
|
* If the new CB requested was a lazy one, queue it onto the main
|
||||||
* ->cblist so we can take advantage of a sooner grade period.
|
* ->cblist so that we can take advantage of the grace-period that will
|
||||||
|
* happen regardless. But queue it onto the bypass list first so that
|
||||||
|
* the lazy CB is ordered with the existing CBs in the bypass list.
|
||||||
*/
|
*/
|
||||||
if (lazy && rhp) {
|
if (lazy && rhp) {
|
||||||
rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, NULL);
|
rcu_cblist_enqueue(&rdp->nocb_bypass, rhp);
|
||||||
rcu_cblist_enqueue(&rcl, rhp);
|
rhp = NULL;
|
||||||
WRITE_ONCE(rdp->lazy_len, 0);
|
|
||||||
} else {
|
|
||||||
rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp);
|
|
||||||
WRITE_ONCE(rdp->lazy_len, 0);
|
|
||||||
}
|
}
|
||||||
|
rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp);
|
||||||
|
WRITE_ONCE(rdp->lazy_len, 0);
|
||||||
|
|
||||||
rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl);
|
rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl);
|
||||||
WRITE_ONCE(rdp->nocb_bypass_first, j);
|
WRITE_ONCE(rdp->nocb_bypass_first, j);
|
||||||
|
|||||||
Reference in New Issue
Block a user