Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
libvirt.29542
ba7f9812-conf-intro-mem-alloc-threads.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ba7f9812-conf-intro-mem-alloc-threads.patch of Package libvirt.29542
commit ba7f98126fa84d354ce72929b77cc111a9a557a9 Author: Michal Prívozník <mprivozn@redhat.com> Date: Mon Mar 21 16:49:25 2022 +0100 conf: Introduce memory allocation threads Since its v5.0.0 release QEMU is capable of specifying number of threads used to allocate memory. It defaults to 1, which may be too low for humongous guests with gigantic pages. In general, on QEMU cmd line level it is possible to use different number of threads per each memory-backend-* object, in practical terms it's not useful. Therefore, use <memoryBacking/> to set guest wide value and let all memory devices 'inherit' it, silently. IOW, don't introduce per device knob because that would only complicate things for a little or no benefit. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Index: libvirt-7.1.0/docs/formatdomain.rst =================================================================== --- libvirt-7.1.0.orig/docs/formatdomain.rst +++ libvirt-7.1.0/docs/formatdomain.rst @@ -950,7 +950,7 @@ Memory Backing <locked/> <source type="file|anonymous|memfd"/> <access mode="shared|private"/> - <allocation mode="immediate|ondemand"/> + <allocation mode="immediate|ondemand" threads='8'/> <discard/> </memoryBacking> ... @@ -999,8 +999,10 @@ influence how virtual memory pages are b Using the ``mode`` attribute, specify if the memory is to be "shared" or "private". This can be overridden per numa node by ``memAccess``. ``allocation`` - Using the ``mode`` attribute, specify when to allocate the memory by - supplying either "immediate" or "ondemand". + Using the optional ``mode`` attribute, specify when to allocate the memory by + supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is + possible to set the number of threads that hypervisor uses to allocate + memory via ``threads`` attribute. ``discard`` When set and supported by hypervisor the memory content is discarded just before guest shuts down (or when DIMM module is unplugged). Please note that Index: libvirt-7.1.0/src/conf/domain_conf.c =================================================================== --- libvirt-7.1.0.orig/src/conf/domain_conf.c +++ libvirt-7.1.0/src/conf/domain_conf.c @@ -19874,6 +19874,13 @@ virDomainDefParseMemory(virDomainDefPtr VIR_FREE(tmp); } + if (virXPathUInt("string(./memoryBacking/allocation/@threads)", + ctxt, &def->mem.allocation_threads) == -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Failed to parse memory allocation threads")); + return -1; + } + if (virXPathNode("./memoryBacking/hugepages", ctxt)) { /* hugepages will be used */ if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) { @@ -28181,6 +28188,7 @@ virDomainMemorybackingFormat(virBufferPt const virDomainMemtune *mem) { g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) allocAttrBuf = VIR_BUFFER_INITIALIZER; if (mem->nhugepages) virDomainHugepagesFormat(&childBuf, mem->hugepages, mem->nhugepages); @@ -28195,8 +28203,13 @@ virDomainMemorybackingFormat(virBufferPt virBufferAsprintf(&childBuf, "<access mode='%s'/>\n", virDomainMemoryAccessTypeToString(mem->access)); if (mem->allocation) - virBufferAsprintf(&childBuf, "<allocation mode='%s'/>\n", + virBufferAsprintf(&allocAttrBuf, " mode='%s'", virDomainMemoryAllocationTypeToString(mem->allocation)); + if (mem->allocation_threads > 0) + virBufferAsprintf(&allocAttrBuf, " threads='%u'", mem->allocation_threads); + + virXMLFormatElement(&childBuf, "allocation", &allocAttrBuf, NULL); + if (mem->discard) virBufferAddLit(&childBuf, "<discard/>\n"); Index: libvirt-7.1.0/src/conf/domain_conf.h =================================================================== --- libvirt-7.1.0.orig/src/conf/domain_conf.h +++ libvirt-7.1.0/src/conf/domain_conf.h @@ -2474,6 +2474,7 @@ struct _virDomainMemtune { int source; /* enum virDomainMemorySource */ int access; /* enum virDomainMemoryAccess */ int allocation; /* enum virDomainMemoryAllocation */ + unsigned int allocation_threads; virTristateBool discard; }; Index: libvirt-7.1.0/docs/schemas/domaincommon.rng =================================================================== --- libvirt-7.1.0.orig/docs/schemas/domaincommon.rng +++ libvirt-7.1.0/docs/schemas/domaincommon.rng @@ -696,12 +696,19 @@ </optional> <optional> <element name="allocation"> - <attribute name="mode"> - <choice> - <value>immediate</value> - <value>ondemand</value> - </choice> - </attribute> + <optional> + <attribute name="mode"> + <choice> + <value>immediate</value> + <value>ondemand</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="threads"> + <ref name="unsignedInt"/> + </attribute> + </optional> </element> </optional> <optional>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor