Skip to content

Commit 3c5d61a

Browse files
urezkitehcaster
authored andcommitted
rcu/kvfree: Refactor kvfree_rcu_queue_batch()
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: 2b55d6a ("rcu/kvfree: Add kvfree_rcu_barrier() API") Suggested-by: Linus Torvalds <[email protected]> Closes: https://lore.kernel.org/lkml/ZvWUt2oyXRsvJRNc@pc636/T/ Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 77ced98 commit 3c5d61a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/rcu/tree.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,11 +3607,12 @@ kvfree_rcu_queue_batch(struct kfree_rcu_cpu *krcp)
36073607
}
36083608

36093609
// One work is per one batch, so there are three
3610-
// "free channels", the batch can handle. It can
3611-
// be that the work is in the pending state when
3612-
// channels have been detached following by each
3613-
// other.
3610+
// "free channels", the batch can handle. Break
3611+
// the loop since it is done with this CPU thus
3612+
// queuing an RCU work is _always_ success here.
36143613
queued = queue_rcu_work(system_unbound_wq, &krwp->rcu_work);
3614+
WARN_ON_ONCE(!queued);
3615+
break;
36153616
}
36163617
}
36173618

0 commit comments

Comments
 (0)