Re: [PATCH RFC v4 1/3] block: add BIO_COMPLETE_IN_TASK for task-context completion
From: Dave Chinner
Date: Wed Mar 25 2026 - 22:49:38 EST
On Wed, Mar 25, 2026 at 08:39:21PM +0000, Matthew Wilcox wrote:
> On Thu, Mar 26, 2026 at 07:26:26AM +1100, Dave Chinner wrote:
> > > @@ -1988,6 +2060,16 @@ static int __init init_bio(void)
> > > SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
> > > }
> > >
> > > + for_each_possible_cpu(i) {
> > > + struct bio_complete_batch *batch =
> > > + per_cpu_ptr(&bio_complete_batch, i);
> > > +
> > > + bio_list_init(&batch->list);
> > > + INIT_WORK(&batch->work, bio_complete_work_fn);
> > > + }
> > > +
> > > + cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "block/bio:complete:dead",
> > > + NULL, bio_complete_batch_cpu_dead);
> >
> > XFS inodegc tracks the CPUs with work queued via a cpumask and
> > iterates the CPU mask for "all CPU" iteration scans. This avoids the
> > need for CPU hotplug integration...
>
> Can you elaborate a bit on how this would work in this context?
It may not even be relevant. I was just mentioning it because if
someone looks at the xfs_inodegc code (as I suggested) they might
wonder why there aren't hotplug hooks for a per-cpu queuing
algorithm and/or why it tracked CPUs with queued items via a CPU
mask...
-Dave.
--
Dave Chinner
dgc@xxxxxxxxxx