* [PATCH] rcu/kvfree: Refactor kvfree_rcu_queue_batch()
@ 2024-09-30 11:37 Uladzislau Rezki (Sony)
2024-10-01 16:31 ` Vlastimil Babka
0 siblings, 1 reply; 2+ messages in thread
From: Uladzislau Rezki (Sony) @ 2024-09-30 11:37 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Paul E . McKenney, RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Frederic Weisbecker, Uladzislau Rezki,
Oleksiy Avramchenko, Linus Torvalds
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.
Link: https://lore.kernel.org/lkml/ZvWUt2oyXRsvJRNc@pc636/T/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
kernel/rcu/tree.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a60616e69b66..b1f883fcd918 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3607,11 +3607,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_unbound_wq, &krwp->rcu_work);
+ WARN_ON_ONCE(!queued);
+ break;
}
}
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rcu/kvfree: Refactor kvfree_rcu_queue_batch()
2024-09-30 11:37 [PATCH] rcu/kvfree: Refactor kvfree_rcu_queue_batch() Uladzislau Rezki (Sony)
@ 2024-10-01 16:31 ` Vlastimil Babka
0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2024-10-01 16:31 UTC (permalink / raw)
To: Uladzislau Rezki (Sony)
Cc: Paul E . McKenney, RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Frederic Weisbecker, Oleksiy Avramchenko,
Linus Torvalds
On 9/30/24 13:37, Uladzislau Rezki (Sony) wrote:
> 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.
>
> Link: https://lore.kernel.org/lkml/ZvWUt2oyXRsvJRNc@pc636/T/
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Applied to slab/for-next, thanks!
> ---
> kernel/rcu/tree.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index a60616e69b66..b1f883fcd918 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3607,11 +3607,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_unbound_wq, &krwp->rcu_work);
> + WARN_ON_ONCE(!queued);
> + break;
> }
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-01 16:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-30 11:37 [PATCH] rcu/kvfree: Refactor kvfree_rcu_queue_batch() Uladzislau Rezki (Sony)
2024-10-01 16:31 ` Vlastimil Babka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®