mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
[XEN] Clamp dom0 memory and CPUs to fit in available resources.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
761d4da84e
commit
044aeaa616
1 file changed
+4
-1
@@ -286,7 +286,8 @@ int construct_dom0(struct domain *d,
|
||||
nr_pages = avail_domheap_pages() + initial_images_nrpages() +
|
||||
dom0_nrpages;
|
||||
else
|
||||
nr_pages = dom0_nrpages;
|
||||
nr_pages = min(avail_domheap_pages() + initial_images_nrpages(),
|
||||
(unsigned long)dom0_nrpages);
|
||||
|
||||
if ( (rc = parseelfimage(&dsi)) != 0 )
|
||||
return rc;
|
||||
@@ -668,6 +669,8 @@ int construct_dom0(struct domain *d,
|
||||
|
||||
if ( opt_dom0_max_vcpus == 0 )
|
||||
opt_dom0_max_vcpus = num_online_cpus();
|
||||
if ( opt_dom0_max_vcpus > num_online_cpus() )
|
||||
opt_dom0_max_vcpus = num_online_cpus();
|
||||
if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
|
||||
opt_dom0_max_vcpus = MAX_VIRT_CPUS;
|
||||
printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
|
||||
|
||||