cli: Add --iothreads defaultiothread.thread_pool_{min,max}
It allows to set the thread pool size to optimize spawning worker threads for the default event loop in real time environment. For example: --iothreads defaultiothread.thread_pool_min=8,\ defaultiothread.thread_pool_max=16 Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
parent
90e13549b4
commit
2984c13cff
|
@ -14,6 +14,7 @@
|
||||||
<iothread id="1"/>
|
<iothread id="1"/>
|
||||||
<iothread id="2" thread_pool_min="8" thread_pool_max="16"/>
|
<iothread id="2" thread_pool_min="8" thread_pool_max="16"/>
|
||||||
</iothreadids>
|
</iothreadids>
|
||||||
|
<defaultiothread thread_pool_min="4" thread_pool_max="32"/>
|
||||||
<memory>65536</memory>
|
<memory>65536</memory>
|
||||||
<currentMemory>65536</currentMemory>
|
<currentMemory>65536</currentMemory>
|
||||||
<blkiotune>
|
<blkiotune>
|
||||||
|
|
|
@ -545,7 +545,7 @@ memorytune0.vcpus=0-3,memorytune0.node0.id=0,memorytune0.node0.bandwidth=60
|
||||||
--memorybacking size=1,unit='G',nodeset=0,1,nosharepages=yes,locked=yes,discard=yes,allocation.mode=immediate,access_mode=shared,source_type=file,hugepages.page.size=12,hugepages.page1.size=1234,hugepages.page1.unit=MB,hugepages.page1.nodeset=2,allocation.threads=8
|
--memorybacking size=1,unit='G',nodeset=0,1,nosharepages=yes,locked=yes,discard=yes,allocation.mode=immediate,access_mode=shared,source_type=file,hugepages.page.size=12,hugepages.page1.size=1234,hugepages.page1.unit=MB,hugepages.page1.nodeset=2,allocation.threads=8
|
||||||
|
|
||||||
|
|
||||||
--iothreads iothreads=5,iothreadids.iothread0.id=1,iothreadids.iothread1.id=2,iothreadids.iothread1.thread_pool_min=8,iothreadids.iothread1.thread_pool_max=16
|
--iothreads iothreads=5,iothreadids.iothread0.id=1,iothreadids.iothread1.id=2,iothreadids.iothread1.thread_pool_min=8,iothreadids.iothread1.thread_pool_max=16,defaultiothread.thread_pool_min=4,defaultiothread.thread_pool_max=32
|
||||||
|
|
||||||
|
|
||||||
--metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6,genid_enable=yes
|
--metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6,genid_enable=yes
|
||||||
|
|
|
@ -2608,6 +2608,12 @@ class ParserIOThreads(VirtCLIParser):
|
||||||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||||
return cb(*args, **kwargs)
|
return cb(*args, **kwargs)
|
||||||
|
|
||||||
|
def defaultiothread_find_inst_cb(self, *args, **kwargs):
|
||||||
|
cliarg = "defaultiothread"
|
||||||
|
list_propname = "defaultiothread"
|
||||||
|
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||||
|
return cb(*args, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _virtcli_class_init(cls):
|
def _virtcli_class_init(cls):
|
||||||
VirtCLIParser._virtcli_class_init_common(cls)
|
VirtCLIParser._virtcli_class_init_common(cls)
|
||||||
|
@ -2619,6 +2625,10 @@ class ParserIOThreads(VirtCLIParser):
|
||||||
"thread_pool_min", find_inst_cb=cls.iothreads_find_inst_cb)
|
"thread_pool_min", find_inst_cb=cls.iothreads_find_inst_cb)
|
||||||
cls.add_arg("iothreadids.iothread[0-9]*.thread_pool_max",
|
cls.add_arg("iothreadids.iothread[0-9]*.thread_pool_max",
|
||||||
"thread_pool_max", find_inst_cb=cls.iothreads_find_inst_cb)
|
"thread_pool_max", find_inst_cb=cls.iothreads_find_inst_cb)
|
||||||
|
cls.add_arg("defaultiothread.thread_pool_min", "thread_pool_min",
|
||||||
|
find_inst_cb=cls.defaultiothread_find_inst_cb)
|
||||||
|
cls.add_arg("defaultiothread.thread_pool_max", "thread_pool_max",
|
||||||
|
find_inst_cb=cls.defaultiothread_find_inst_cb)
|
||||||
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
|
|
@ -74,6 +74,13 @@ class _IOThreadID(XMLBuilder):
|
||||||
thread_pool_max = XMLProperty("./@thread_pool_max", is_int=True)
|
thread_pool_max = XMLProperty("./@thread_pool_max", is_int=True)
|
||||||
|
|
||||||
|
|
||||||
|
class _DefaultIOThread(XMLBuilder):
|
||||||
|
XML_NAME = "defaultiothread"
|
||||||
|
|
||||||
|
thread_pool_min = XMLProperty("./@thread_pool_min", is_int=True)
|
||||||
|
thread_pool_max = XMLProperty("./@thread_pool_max", is_int=True)
|
||||||
|
|
||||||
|
|
||||||
class Guest(XMLBuilder):
|
class Guest(XMLBuilder):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate_name(conn, name, check_collision=True, validate=True):
|
def validate_name(conn, name, check_collision=True, validate=True):
|
||||||
|
@ -180,7 +187,8 @@ class Guest(XMLBuilder):
|
||||||
XML_NAME = "domain"
|
XML_NAME = "domain"
|
||||||
_XML_PROP_ORDER = [
|
_XML_PROP_ORDER = [
|
||||||
"type", "name", "uuid", "genid", "genid_enable",
|
"type", "name", "uuid", "genid", "genid_enable",
|
||||||
"title", "description", "_metadata", "iothreads", "iothreadids",
|
"title", "description", "_metadata",
|
||||||
|
"iothreads", "iothreadids", "defaultiothread",
|
||||||
"maxMemory", "maxMemorySlots", "memory", "_currentMemory",
|
"maxMemory", "maxMemorySlots", "memory", "_currentMemory",
|
||||||
"blkiotune", "memtune", "memoryBacking",
|
"blkiotune", "memtune", "memoryBacking",
|
||||||
"_vcpus", "vcpu_current", "vcpu_placement",
|
"_vcpus", "vcpu_current", "vcpu_placement",
|
||||||
|
@ -226,6 +234,7 @@ class Guest(XMLBuilder):
|
||||||
|
|
||||||
iothreads = XMLProperty("./iothreads", is_int=True)
|
iothreads = XMLProperty("./iothreads", is_int=True)
|
||||||
iothreadids = XMLChildProperty(_IOThreadID, relative_xpath="./iothreadids")
|
iothreadids = XMLChildProperty(_IOThreadID, relative_xpath="./iothreadids")
|
||||||
|
defaultiothread = XMLChildProperty(_DefaultIOThread)
|
||||||
|
|
||||||
def _set_currentMemory(self, val):
|
def _set_currentMemory(self, val):
|
||||||
if val is not None:
|
if val is not None:
|
||||||
|
|
Loading…
Reference in New Issue