On 2022/10/17 21:39, Christoph Hellwig wrote:
On Thu, Oct 13, 2022 at 05:44:49PM +0800, Chao Leng wrote:
+ rcu = kvmalloc(count * sizeof(*rcu), GFP_KERNEL);
+ if (rcu) {
+ list_for_each_entry(q, &set->tag_list, tag_set_list) {
+ if (blk_queue_noquiesced(q))
+ continue;
+
+ init_rcu_head(&rcu[i].head);
+ init_completion(&rcu[i].completion);
+ call_srcu(q->srcu, &rcu[i].head, wakeme_after_rcu);
+ i++;
+ }
+
+ for (i = 0; i < count; i++) {
+ wait_for_completion(&rcu[i].completion);
+ destroy_rcu_head(&rcu[i].head);
+ }
+ kvfree(rcu);
+ } else {
+ list_for_each_entry(q, &set->tag_list, tag_set_list)
+ synchronize_srcu(q->srcu);
+ }
Having to allocate a struct rcu_synchronize for each of the potentially
many queues here is a bit sad.
Pull just explained the start_poll_synchronize_rcu interfaces at ALPSS
last week, so I wonder if something like that would also be feasible
for SRCU, as that would come in really handy here.
Using start_poll_synchronize_rcu will reduce some memory.
This is a good idea.
.