[PATCH] Introduce CONFIG_DEFAULT_MIGRATION_COST

Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

The boot sequence on s390 sometimes takes ages and we spend a very long
time (up to one or two minutes) in calibrate_migration_costs. The time
spent there differs from boot to boot. Also the calculated costs differ
a lot. I've seen differences by up to a factor of 15 (yes, factor not
percent). Also I doubt that making these measurements make much sense on
a completely virtualized architecture where you cannot tell how much cpu
time you will get anyway.

So introduce the CONFIG_DEFAULT_MIGRATION_COST method for an architecture
to set the scheduler migration costs. This turns off automatic detection
of migration costs. Makes sense on virtual platforms, where migration
costs are hard to measure accurately.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Ingo Molnar and committed by Linus Torvalds 4bbf39c2 05efc67d

+16 -1
+4
arch/s390/Kconfig
··· 80 80 can be controlled through /sys/devices/system/cpu/cpu#. 81 81 Say N if you want to disable CPU hotplug. 82 82 83 + config DEFAULT_MIGRATION_COST 84 + int 85 + default "1000000" 86 + 83 87 config MATHEMU 84 88 bool "IEEE FPU emulation" 85 89 depends on MARCH_G5
+12 -1
kernel/sched.c
··· 5058 5058 #define MAX_DOMAIN_DISTANCE 32 5059 5059 5060 5060 static unsigned long long migration_cost[MAX_DOMAIN_DISTANCE] = 5061 - { [ 0 ... MAX_DOMAIN_DISTANCE-1 ] = -1LL }; 5061 + { [ 0 ... MAX_DOMAIN_DISTANCE-1 ] = 5062 + /* 5063 + * Architectures may override the migration cost and thus avoid 5064 + * boot-time calibration. Unit is nanoseconds. Mostly useful for 5065 + * virtualized hardware: 5066 + */ 5067 + #ifdef CONFIG_DEFAULT_MIGRATION_COST 5068 + CONFIG_DEFAULT_MIGRATION_COST 5069 + #else 5070 + -1LL 5071 + #endif 5072 + }; 5062 5073 5063 5074 /* 5064 5075 * Allow override of migration cost - in units of microseconds.