On 2022/04/20 6:01, Jason Gunthorpe wrote: > The flush_work exists because of this: > >> @@ -1602,7 +1604,7 @@ void ib_unregister_device_queued(struct ib_device *ib_dev) >> WARN_ON(!refcount_read(&ib_dev->refcount)); >> WARN_ON(!ib_dev->ops.dealloc_driver); >> get_device(&ib_dev->dev); >> - if (!queue_work(system_unbound_wq, &ib_dev->unregistration_work)) >> + if (!queue_work(ib_unbound_wq, &ib_dev->unregistration_work)) >> put_device(&ib_dev->dev); >> } > > Which fires off a work that must be completed before the module is > unloaded. I see. Here is an updated patch. > > It seems like a big waste to create an entire WQ just for a single > infrequent user like this. No need to worry about resource wasting, for creating a WQ without WQ_MEM_RECLAIM flag consumes little memory. > > Is there some other solution? No.