diff options
author | Petr Mladek | 2016-01-25 17:38:05 +0100 |
---|---|---|
committer | Michael S. Tsirkin | 2016-03-11 01:40:13 +0200 |
commit | fad7b7b27b6a168ca8ebc84482043886f837b89d (patch) | |
tree | 5655b00b5e9dbf07a5e2d33a98c9d648753cd52a /ipc | |
parent | c235082b50f6dd81436b82fd73ffbdeede4ec2e4 (diff) |
virtio_balloon: Use a workqueue instead of "vballoon" kthread
This patch moves the deferred work from the "vballoon" kthread into a
system freezable workqueue.
We do not need to maintain and run a dedicated kthread. Also the event
driven workqueues API makes the logic much easier. Especially, we do
not longer need an own wait queue, wait function, and freeze point.
The conversion is pretty straightforward. One cycle of the main loop
is put into a work. The work is queued instead of waking the kthread.
fill_balloon() and leak_balloon() have a limit for the amount of modified
pages. The work re-queues itself when necessary. For this, we make
fill_balloon() to return the number of really modified pages.
Note that leak_balloon() already did this.
virtballoon_restore() queues the work only when really needed.
The only complication is that we need to prevent queuing the work
when the balloon is being removed. It was easier before because the
kthread simply removed itself from the wait queue. We need an
extra boolean and spin lock now.
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.
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions