Linux virtualization list
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: Petr Mladek <pmladek@suse.com>, Jiri Kosina <jkosina@suse.cz>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Tejun Heo <tj@kernel.org>, Jeff Epler <jepler@unpythonic.net>
Subject: [PATCH v5 0/2] virtio_balloon: Conversion to workqueue + parallel stats
Date: Mon, 25 Jan 2016 17:38:04 +0100	[thread overview]
Message-ID: <1453739886-29458-1-git-send-email-pmladek@suse.com> (raw)

The previous version did not prevent updating the balloon when it was
being removed. There was an idea to update the stats in a separate work
and cancel it after the config reset. But this does not seem to work.
The code for updating the stats communicates with the host. IMHO, it
should not run after the reset (flushing buffers). Therefore I decided
to use a boolean value and a spin lock (inspired by virtio_scsi).

Michael S. Tsirkin suggested that it would have been nice to split the work
and updated the stats in parallel. I did a lot of investigation and it seemed
that we did not need any extra sychronization. Anyway, I rather made the split
in a separate patch. See the patch description for more details.

Changes against v4:

  + removed fix of the balloon restore code; it was false alarm;
    freezer waken the kthread and it restored the balloon later

  + added a spin lock to prevent updating the balloon when being removed

  + split the work into two; it allows to update stats even
    when the balloon is being resized


Changes against v3:

  + rebased on 4.4-rc3

  + call cancel_work_sync() when removing the balloon

  + do not queue the work from fill_balloon() and leak_balloon()
    because they are called also independently from the workqueue,
    e.g. remove_common(), virtballoon_oom_notify(). Re-queue
    the work from the work function when necessary.


Changes against v2:

  + Use system_freezable_wq instead of an allocated one
    and move INIT_WORK() higher in virtballoon_probe().

  + Fix typos in the commit message.


Changes against v1:

  + More elegant detection of the pending work in fill_balloon() and
    leak_balloon(). It still needs to keep the original requested number
    of pages but it does not add any extra boolean variable.

  + Remove WQ_MEM_RECLAIM workqueue parameter. If I get it correctly,
    this is possible because the code manipulates memory but it is not
    used in the memory reclaim path.

  + initialize the work item before allocation the workqueue


Just for record, the discussion about the previous version can be found
at http://thread.gmane.org/gmane.linux.kernel/2100306


Petr Mladek (2):
  virtio_balloon: Use a workqueue instead of "vballoon" kthread
  virtio_balloon: Allow to resize and update the balloon stats in
    parallel

 drivers/virtio/virtio_balloon.c | 122 ++++++++++++++++++++--------------------
 1 file changed, 61 insertions(+), 61 deletions(-)

-- 
1.8.5.6

             reply	other threads:[~2016-01-25 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 16:38 Petr Mladek [this message]
2016-01-25 16:38 ` [PATCH v5 1/2] virtio_balloon: Use a workqueue instead of "vballoon" kthread Petr Mladek
2016-01-25 16:38 ` [PATCH v5 2/2] virtio_balloon: Allow to resize and update the balloon stats in parallel Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453739886-29458-1-git-send-email-pmladek@suse.com \
    --to=pmladek@suse.com \
    --cc=jepler@unpythonic.net \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox