[PATCH 0/3] util/thread-pool: Expose minimun and maximum size

Nicolas Saenz Julienne posted 3 patches 2 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220221170843.849084-1-nsaenzju@redhat.com
Test checkpatch passed
Maintainers: Hanna Reitz <hreitz@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Michael Roth <michael.roth@amd.com>, Eric Blake <eblake@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Markus Armbruster <armbru@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
MAINTAINERS               |   1 +
include/block/aio.h       |  11 +++
include/qemu/main-loop.h  |  11 +++
include/sysemu/iothread.h |  11 +--
iothread.c                | 171 ++++----------------------------------
qapi/qom.json             |  14 ++--
qga/meson.build           |   2 +-
qom/meson.build           |   1 +
tests/unit/meson.build    |  10 +--
util/async.c              |   3 +
util/event-loop.c         | 168 +++++++++++++++++++++++++++++++++++++
util/event-loop.h         |  45 ++++++++++
util/main-loop.c          |  56 +++++++++++++
util/thread-pool.c        |  41 ++++++++-
14 files changed, 368 insertions(+), 177 deletions(-)
create mode 100644 util/event-loop.c
create mode 100644 util/event-loop.h
[PATCH 0/3] util/thread-pool: Expose minimun and maximum size
Posted by Nicolas Saenz Julienne 2 years, 2 months ago
As discussed on the previous RFC[1] the thread-pool's dynamic thread
management doesn't play well with real-time and latency sensitive
systems. This series introduces a set of controls that'll permit
achieving more deterministic behaviours, for example by fixing the
pool's size.

We first introduce a new common interface to event loop configuration by
moving iothread's already available properties into an abstract class
called 'EventLooopBackend' and have both 'IOThread' and the newly
created 'MainLoop' inherit the properties from that class.

With this new configuration interface in place it's relatively simple to
introduce new options to fix the even loop's thread pool sizes. The
resulting QAPI looks like this:

    -object main-loop,id=main-loop,thread-pool-min=1,thread-pool-max=1

Note that all patches are bisect friendly and pass all the tests.

[1] https://patchwork.ozlabs.org/project/qemu-devel/patch/20220202175234.656711-1-nsaenzju@redhat.com/

---

Nicolas Saenz Julienne (3):
  util & iothread: Introduce event-loop abstract class
  util/main-loop: Introduce the main loop into QOM
  util/event-loop: Introduce options to set the thread pool size

 MAINTAINERS               |   1 +
 include/block/aio.h       |  11 +++
 include/qemu/main-loop.h  |  11 +++
 include/sysemu/iothread.h |  11 +--
 iothread.c                | 171 ++++----------------------------------
 qapi/qom.json             |  14 ++--
 qga/meson.build           |   2 +-
 qom/meson.build           |   1 +
 tests/unit/meson.build    |  10 +--
 util/async.c              |   3 +
 util/event-loop.c         | 168 +++++++++++++++++++++++++++++++++++++
 util/event-loop.h         |  45 ++++++++++
 util/main-loop.c          |  56 +++++++++++++
 util/thread-pool.c        |  41 ++++++++-
 14 files changed, 368 insertions(+), 177 deletions(-)
 create mode 100644 util/event-loop.c
 create mode 100644 util/event-loop.h

-- 
2.35.1