diff options
author | Keir Fraser <keir@xen.org> | 2010-12-24 10:10:45 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-12-24 10:10:45 +0000 |
commit | 5814ca6b9c845e77c22fb034e8e7a9b35fe6b59a (patch) | |
tree | 2537340f7328351fb2f462d325a89c42befffc3d /xen/common | |
parent | 53ecc28f0e91051cf7874012ea13a6899910b105 (diff) | |
download | xen-5814ca6b9c845e77c22fb034e8e7a9b35fe6b59a.tar.gz xen-5814ca6b9c845e77c22fb034e8e7a9b35fe6b59a.tar.bz2 xen-5814ca6b9c845e77c22fb034e8e7a9b35fe6b59a.zip |
Use bool_t for various boolean variables
... decreasing cache footprint. As a prerequisite this requires making
cmdline_parse() a little more flexible.
Also remove a few variables altogether, and adjust sections
annotations for several others.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common')
-rw-r--r-- | xen/common/domain.c | 2 | ||||
-rw-r--r-- | xen/common/kernel.c | 53 | ||||
-rw-r--r-- | xen/common/page_alloc.c | 2 | ||||
-rw-r--r-- | xen/common/sched_credit.c | 4 | ||||
-rw-r--r-- | xen/common/schedule.c | 2 | ||||
-rw-r--r-- | xen/common/shutdown.c | 2 | ||||
-rw-r--r-- | xen/common/tmem_xen.c | 12 |
7 files changed, 47 insertions, 30 deletions
diff --git a/xen/common/domain.c b/xen/common/domain.c index 803c640a7f..02327d1e9f 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -42,7 +42,7 @@ unsigned int xen_processor_pmbits = XEN_PROCESSOR_PM_PX; /* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */ -static unsigned int opt_dom0_vcpus_pin; +static bool_t opt_dom0_vcpus_pin; boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin); /* set xen as default cpufreq */ diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 2a1aabfc60..c061a0d838 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -26,6 +26,28 @@ int tainted; xen_commandline_t saved_cmdline; +static void __init assign_integer_param( + struct kernel_param *param, uint64_t val) +{ + switch ( param->len ) + { + case sizeof(uint8_t): + *(uint8_t *)param->var = val; + break; + case sizeof(uint16_t): + *(uint16_t *)param->var = val; + break; + case sizeof(uint32_t): + *(uint32_t *)param->var = val; + break; + case sizeof(uint64_t): + *(uint64_t *)param->var = val; + break; + default: + BUG(); + } +} + void __init cmdline_parse(char *cmdline) { char opt[100], *optval, *optkey, *q; @@ -79,34 +101,29 @@ void __init cmdline_parse(char *cmdline) strlcpy(param->var, optval, param->len); break; case OPT_UINT: - *(unsigned int *)param->var = simple_strtol(optval, NULL, 0); + assign_integer_param( + param, + simple_strtoll(optval, NULL, 0)); break; case OPT_BOOL: case OPT_INVBOOL: if ( !parse_bool(optval) ) bool_assert = !bool_assert; - if ( param->type == OPT_INVBOOL ) - bool_assert = !bool_assert; - *(int *)param->var = bool_assert; + assign_integer_param( + param, + (param->type == OPT_BOOL) == bool_assert); break; - case OPT_SIZE: { - uint64_t sz = parse_size_and_unit(optval, NULL); - switch ( param->len ) - { - case sizeof(uint32_t): - *(uint32_t *)param->var = sz; - break; - case sizeof(uint64_t): - *(uint64_t *)param->var = sz; - break; - default: - BUG(); - } + case OPT_SIZE: + assign_integer_param( + param, + parse_size_and_unit(optval, NULL)); break; - } case OPT_CUSTOM: ((void (*)(const char *))param->var)(optval); break; + default: + BUG(); + break; } } } diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 08616405cf..a3f890f733 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -52,7 +52,7 @@ string_param("badpage", opt_badpage); /* * no-bootscrub -> Free pages are not zeroed during boot. */ -static int opt_bootscrub __initdata = 1; +static bool_t opt_bootscrub __initdata = 1; boolean_param("bootscrub", opt_bootscrub); /* diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index bfe20d30d0..b53c2ad31f 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -111,7 +111,7 @@ /* * Boot parameters */ -int sched_credit_default_yield = 0; +static bool_t __read_mostly sched_credit_default_yield; boolean_param("sched_credit_default_yield", sched_credit_default_yield); /* @@ -247,7 +247,7 @@ static void burn_credits(struct csched_vcpu *svc, s_time_t now) svc->start_time += (credits * MILLISECS(1)) / CSCHED_CREDITS_PER_MSEC; } -static int opt_tickle_one_idle __read_mostly = 1; +static bool_t __read_mostly opt_tickle_one_idle = 1; boolean_param("tickle_one_idle_cpu", opt_tickle_one_idle); DEFINE_PER_CPU(unsigned int, last_tickle_cpu); diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 69996b2f60..dd348c952a 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -44,7 +44,7 @@ string_param("sched", opt_sched); * scheduler will give preferrence to partially idle package compared to * the full idle package, when picking pCPU to schedule vCPU. */ -int sched_smt_power_savings = 0; +bool_t sched_smt_power_savings = 0; boolean_param("sched_smt_power_savings", sched_smt_power_savings); /* Various timer handlers. */ diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index 6e0b412308..e356e86591 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -11,7 +11,7 @@ #include <public/sched.h> /* opt_noreboot: If true, machine will need manual reset on error. */ -int opt_noreboot; +bool_t __read_mostly opt_noreboot; boolean_param("noreboot", opt_noreboot); static void maybe_reboot(void) diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c index 0221355ea7..fdf24f3425 100644 --- a/xen/common/tmem_xen.c +++ b/xen/common/tmem_xen.c @@ -15,22 +15,22 @@ #define EXPORT /* indicates code other modules are dependent upon */ -EXPORT int opt_tmem = 1; +EXPORT bool_t __read_mostly opt_tmem = 1; boolean_param("tmem", opt_tmem); -EXPORT int opt_tmem_compress = 0; +EXPORT bool_t __read_mostly opt_tmem_compress = 0; boolean_param("tmem_compress", opt_tmem_compress); -EXPORT int opt_tmem_dedup = 0; +EXPORT bool_t __read_mostly opt_tmem_dedup = 0; boolean_param("tmem_dedup", opt_tmem_dedup); -EXPORT int opt_tmem_tze = 0; +EXPORT bool_t __read_mostly opt_tmem_tze = 0; boolean_param("tmem_tze", opt_tmem_tze); -EXPORT int opt_tmem_shared_auth = 0; +EXPORT bool_t __read_mostly opt_tmem_shared_auth = 0; boolean_param("tmem_shared_auth", opt_tmem_shared_auth); -EXPORT int opt_tmem_lock = 0; +EXPORT int __read_mostly opt_tmem_lock = 0; integer_param("tmem_lock", opt_tmem_lock); EXPORT atomic_t freeable_page_count = ATOMIC_INIT(0); |