Skip to content

Commit

Permalink
rcu/tree: Repeat the monitor if any free channel is busy
Browse files Browse the repository at this point in the history
It is possible that one of the channels cannot be detached
because its free channel is busy and previously queued data
has not been processed yet. On the other hand, another
channel can be successfully detached causing the monitor
work to stop.

Prevent that by rescheduling the monitor work if there are
any channels in the pending state after a detach attempt.

Fixes: 34c8817 ("rcu: Support kfree_bulk() interface in kfree_rcu()")
Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
  • Loading branch information
Uladzislau Rezki (Sony) authored and Paul E. McKenney committed Jun 29, 2020
1 parent 4d29194 commit 594aa59
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kernel/rcu/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ static void kfree_rcu_work(struct work_struct *work)
static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp)
{
struct kfree_rcu_cpu_work *krwp;
bool queued = false;
bool repeat = false;
int i;

lockdep_assert_held(&krcp->lock);
Expand Down Expand Up @@ -3143,11 +3143,14 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp)
* been detached following each other, one by one.
*/
queue_rcu_work(system_wq, &krwp->rcu_work);
queued = true;
}

/* Repeat if any "free" corresponding channel is still busy. */
if (krcp->bhead || krcp->head)
repeat = true;
}

return queued;
return !repeat;
}

static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp,
Expand Down

0 comments on commit 594aa59

Please sign in to comment.