[PATCH 5/6] kvfree_rcu: clear KRC_MONITOR_TODO bit once a batch is started
From: Uladzislau Rezki (Sony)
Date: Wed Apr 14 2021 - 08:12:58 EST
Before attempting of starting a new batch the KRC_MONITOR_TODO
bit is cleared and set back when a previous RCU batch is still
in progress.
Clear the KRC_MONITOR_TODO bit only when a new batch has been
successfully queued, if not, it stays active anyway, thus no
reason in setting it back. Please note that checking/setting
this bit is protected by the krcp->lock spinlock.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
---
kernel/rcu/tree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index da3605067cc1..012030cbe55e 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3427,16 +3427,14 @@ static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp,
unsigned long flags)
{
// Attempt to start a new batch.
- clear_bit(KRC_MONITOR_TODO, &krcp->flags);
-
if (queue_kfree_rcu_work(krcp)) {
// Success! Our job is done here.
+ clear_bit(KRC_MONITOR_TODO, &krcp->flags);
raw_spin_unlock_irqrestore(&krcp->lock, flags);
return;
}
// Previous RCU batch still in progress, try again later.
- set_bit(KRC_MONITOR_TODO, &krcp->flags);
schedule_delayed_work(&krcp->monitor_work, KFREE_DRAIN_JIFFIES);
raw_spin_unlock_irqrestore(&krcp->lock, flags);
}
--
2.20.1