direct-io.hg

changeset 11812:4d1b44450bdb

[XEN] Clamp dom0 memory and CPUs to fit in available resources.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Oct 18 17:45:19 2006 +0100 (2006-10-18)
parents 9943e06e966e
children bae52f5cc421
files xen/arch/x86/domain_build.c
line diff
     1.1 --- a/xen/arch/x86/domain_build.c	Wed Oct 18 17:41:36 2006 +0100
     1.2 +++ b/xen/arch/x86/domain_build.c	Wed Oct 18 17:45:19 2006 +0100
     1.3 @@ -286,7 +286,8 @@ int construct_dom0(struct domain *d,
     1.4          nr_pages = avail_domheap_pages() + initial_images_nrpages() +
     1.5              dom0_nrpages;
     1.6      else
     1.7 -        nr_pages = dom0_nrpages;
     1.8 +        nr_pages = min(avail_domheap_pages() + initial_images_nrpages(),
     1.9 +                       (unsigned long)dom0_nrpages);
    1.10  
    1.11      if ( (rc = parseelfimage(&dsi)) != 0 )
    1.12          return rc;
    1.13 @@ -668,6 +669,8 @@ int construct_dom0(struct domain *d,
    1.14  
    1.15      if ( opt_dom0_max_vcpus == 0 )
    1.16          opt_dom0_max_vcpus = num_online_cpus();
    1.17 +    if ( opt_dom0_max_vcpus > num_online_cpus() )
    1.18 +        opt_dom0_max_vcpus = num_online_cpus();
    1.19      if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
    1.20          opt_dom0_max_vcpus = MAX_VIRT_CPUS;
    1.21      printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);