diff options
author | Uladzislau Rezki (Sony) <urezki@gmail.com> | 2024-09-30 13:37:10 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-08 16:31:04 +0100 |
commit | 88a470c6d2c2abc32879d39e7cad749cd47f29f3 (patch) | |
tree | b8c5f15ec9988b95cb93a79f82cd4557324addc4 | |
parent | 24211fb49c9ac1b576470b7e393a5a0b50af2707 (diff) |
rcu/kvfree: Refactor kvfree_rcu_queue_batch()
commit 3c5d61ae919cc377c71118ccc76fa6e8518023f8 upstream.
Improve readability of kvfree_rcu_queue_batch() function
in away that, after a first batch queuing, the loop is break
and success value is returned to a caller.
There is no reason to loop and check batches further as all
outstanding objects have already been picked and attached to
a certain batch to complete an offloading.
Fixes: 2b55d6a42d14 ("rcu/kvfree: Add kvfree_rcu_barrier() API")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Closes: https://lore.kernel.org/lkml/ZvWUt2oyXRsvJRNc@pc636/T/
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | kernel/rcu/tree.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index be00aac5f4e7..8af1354b2231 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3627,11 +3627,12 @@ kvfree_rcu_queue_batch(struct kfree_rcu_cpu *krcp) } // One work is per one batch, so there are three - // "free channels", the batch can handle. It can - // be that the work is in the pending state when - // channels have been detached following by each - // other. + // "free channels", the batch can handle. Break + // the loop since it is done with this CPU thus + // queuing an RCU work is _always_ success here. queued = queue_rcu_work(system_wq, &krwp->rcu_work); + WARN_ON_ONCE(!queued); + break; } } |