On Wed, Nov 04, 2020 at 09:46:39PM +0100, Mark Kettenis wrote:
> stride is not a factor, so your description makes no sense to me.
ldomctl/config.c uses it as factor:
SIMPLEQ_FOREACH(domain, &conf.domain_list, entry) {
if (strcmp(domain->name, "primary") == 0) {
primary_num_cpus = domain->vcpu;
primary_stride = domain->vcpu_stride;
primary_memory = domain->memory;
}
num_cpus += (domain->vcpu * domain->vcpu_stride);
memory += domain->memory;
}
> a stride of 4 means we allocate VCPUs 4-at-a-time but only assign 1 of
> those to the domain. It is a step size.
Let's reword, is that any better?
Index: ldom.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/ldom.conf.5,v
retrieving revision 1.14
diff -u -p -r1.14 ldom.conf.5
--- ldom.conf.5 14 Sep 2020 19:42:16 -0000 1.14
+++ ldom.conf.5 4 Nov 2020 21:37:20 -0000
@@ -38,8 +38,11 @@ If no configuration for the primary doma
all CPU and memory resources not used by any guest domains.
.It Ic vcpu Ar number Ns Op : Ns Ar stride
Declare the number of virtual CPUs assigned to a domain.
-Optionally a stride can be specified to allocate additional virtual CPUs
-but not assign them to a domain.
+Optionally a stride can be specified to allocate
+.Ar stride
+VCPUs at a time but assign only
+.Ar number
+VCPUs to the domain.
This can be used to distribute virtual CPUs over the available CPU cores.
.It Ic memory Ar bytes
Declare the amount of memory assigned to a domain, in bytes.
@@ -117,6 +120,20 @@ domain "salmah" {
.Pp
On a machine with 32 cores and 64GB physical memory, this leaves 12 cores and
58GB memory to the primary domain.
+.Pp
+Use a
+.Ar stride
+step size to distribute VCPUs:
+.Bd -literal -offset indent
+domain "sun" {
+ vcpu 2:4
+ memory 4G
+ vdisk "/home/sun/vdisk0"
+}
+.Ed
+On a machine with eight threads per physical core, this allocates two strides
+of four VCPUs each for the guest domain but assigns only two VCPUs to it, i.e.
+make it occupy an entire physical core while running on two threads only.
.Sh SEE ALSO
.Xr eeprom 8 ,
.Xr ldomctl 8 ,