[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160105144918.GF3178@pathway.suse.cz>
Date: Tue, 5 Jan 2016 15:49:18 +0100
From: Petr Mladek <pmladek@...e.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Tejun Heo <tj@...nel.org>, Rusty Russell <rusty@...tcorp.com.au>,
Jeff Epler <jepler@...ythonic.net>,
Jiri Kosina <jkosina@...e.cz>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] virtio_balloon: Use a workqueue instead of
"vballoon" kthread
On Sat 2016-01-02 23:36:03, Michael S. Tsirkin wrote:
> On Sat, Jan 02, 2016 at 06:43:16AM -0500, Tejun Heo wrote:
> > On Fri, Jan 01, 2016 at 12:18:17PM +0200, Michael S. Tsirkin wrote:
> > > > My initial idea was to use a dedicated workqueue. Michael S. Tsirkin
> > > > @@ -563,7 +534,7 @@ static void virtballoon_remove(struct virtio_device *vdev)
> > > > struct virtio_balloon *vb = vdev->priv;
> > > >
> > > > unregister_oom_notifier(&vb->nb);
> > > > - kthread_stop(vb->thread);
> > > > + cancel_work_sync(&vb->wq_work);
> > >
> > > OK but since job requeues itself, cancelling like this might not be enough.
> >
> > As long as there's no further external queueing, cancel_work_sync() is
> > guaranteed to kill a self-requeueing work item.
> >
> > Thanks.
>
> I didn't realise this. Thanks!
>
> Unfortunately in this case, there can be further requeueing
> if a stats request arrives.
Please, is there any point where the stat requests are disabled for
sure? I am not 100% sure but it might be after the reset() call:
vb->vdev->config->reset(vb->vdev);
Then we could split the kthread into two works: resizing and stats.
The resizing work still must be canceled before leaking the balloon.
But the stats work might be canceled after the reset() call.
In fact, the solution with the two works looks even cleaner.
Thanks for feedback,
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists