From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751536AbcABLnV (ORCPT ); Sat, 2 Jan 2016 06:43:21 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:33915 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbcABLnS (ORCPT ); Sat, 2 Jan 2016 06:43:18 -0500 Date: Sat, 2 Jan 2016 06:43:16 -0500 From: Tejun Heo To: "Michael S. Tsirkin" Cc: Petr Mladek , Rusty Russell , Jeff Epler , Jiri Kosina , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Petr Mladek Subject: Re: [PATCH v4 2/2] virtio_balloon: Use a workqueue instead of "vballoon" kthread Message-ID: <20160102114316.GC3660@htj.duckdns.org> References: <1449236271-10133-1-git-send-email-pmladek@suse.com> <1449236271-10133-3-git-send-email-pmladek@suse.com> <20160101121432-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160101121432-mutt-send-email-mst@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, 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 > > suggested using a system one. Tejun Heo confirmed that the system > > workqueue has a pretty high concurrency level (256) by default. > > Therefore we need not be afraid of too long blocking. > > Right but fill has a 1/5 second sleep on failure - *that* > is problematic for a system queue. Why so? As long as the maximum concurrently used workers are not high, 1/5 second or even a lot longer sleeps are completely fine. > > @@ -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. -- tejun