Michael S. Tsirkin
2014-Nov-20 16:25 UTC
[PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
On Thu, Nov 20, 2014 at 11:07:46AM -0500, Tejun Heo wrote:> On Thu, Nov 20, 2014 at 05:03:17PM +0100, Petr Mladek wrote: > ... > > @@ -476,7 +460,6 @@ static void virtballoon_remove(struct virtio_device *vdev) > > { > > struct virtio_balloon *vb = vdev->priv; > > > > - kthread_stop(vb->thread); > > remove_common(vb); > > kfree(vb); > > } > > Shouldn't the work item be flushed before removal is complete?In fact, flushing it won't help because it can requeue itself, right?> Thanks. > > -- > tejun
Michael S. Tsirkin
2014-Nov-20 16:26 UTC
[PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
On Thu, Nov 20, 2014 at 06:25:43PM +0200, Michael S. Tsirkin wrote:> On Thu, Nov 20, 2014 at 11:07:46AM -0500, Tejun Heo wrote: > > On Thu, Nov 20, 2014 at 05:03:17PM +0100, Petr Mladek wrote: > > ... > > > @@ -476,7 +460,6 @@ static void virtballoon_remove(struct virtio_device *vdev) > > > { > > > struct virtio_balloon *vb = vdev->priv; > > > > > > - kthread_stop(vb->thread); > > > remove_common(vb); > > > kfree(vb); > > > } > > > > Shouldn't the work item be flushed before removal is complete? > > In fact, flushing it won't help because it can requeue itself, right?>From that POV a dedicated WQ kept it simple.> > > Thanks. > > > > -- > > tejun
Tejun Heo
2014-Nov-20 16:29 UTC
[PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
On Thu, Nov 20, 2014 at 06:26:24PM +0200, Michael S. Tsirkin wrote:> On Thu, Nov 20, 2014 at 06:25:43PM +0200, Michael S. Tsirkin wrote: > > On Thu, Nov 20, 2014 at 11:07:46AM -0500, Tejun Heo wrote: > > > On Thu, Nov 20, 2014 at 05:03:17PM +0100, Petr Mladek wrote: > > > ... > > > > @@ -476,7 +460,6 @@ static void virtballoon_remove(struct virtio_device *vdev) > > > > { > > > > struct virtio_balloon *vb = vdev->priv; > > > > > > > > - kthread_stop(vb->thread); > > > > remove_common(vb); > > > > kfree(vb); > > > > } > > > > > > Shouldn't the work item be flushed before removal is complete? > > > > In fact, flushing it won't help because it can requeue itself, right?There's cancel_work_sync() to stop the self-requeueing ones.> From that POV a dedicated WQ kept it simple.A dedicated wq doesn't do anything for that. You can't shut down a workqueue with a pending work item on it. destroy_workqueue() will try to drain the target wq, warn if it doesn't finish in certain number of iterations and just keep trying indefinitely. Thanks. -- tejun
Possibly Parallel Threads
- [PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
- [PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
- [PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
- [PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
- [PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue