aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-09-02 15:07:42 +0200
committerRickard Green <[email protected]>2010-09-02 15:07:42 +0200
commit68b47f68edadf2bbea608e37bdd2c426180c2d99 (patch)
treeafcec5ccc2d15539a4314b0ed3c65874a56f1016 /erts/emulator/beam
parente687346cace88b81053d603481f881be49915973 (diff)
parent9ec4e178b59ded6cd8bf420d7ed0e0ef1178a168 (diff)
downloadotp-68b47f68edadf2bbea608e37bdd2c426180c2d99.tar.gz
otp-68b47f68edadf2bbea608e37bdd2c426180c2d99.tar.bz2
otp-68b47f68edadf2bbea608e37bdd2c426180c2d99.zip
Merge branch 'rickard/cpu-info-testcase/OTP-8765' into dev
* rickard/cpu-info-testcase/OTP-8765: Fix crash when calling erlang:system_info(update_cpu_info) Add testcase for erlang:system_info(update_cpu_info)
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_process.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 761096e9ad..2609457415 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -4009,7 +4009,7 @@ signal_schedulers_bind_change(erts_cpu_topology_t *cpudata, int size)
int s_ix = 1;
int cpu_ix;
- if (cpu_bind_order != ERTS_CPU_BIND_NONE) {
+ if (cpu_bind_order != ERTS_CPU_BIND_NONE && size) {
cpu_bind_order_sort(cpudata, size, cpu_bind_order, 1);
@@ -5523,7 +5523,6 @@ late_cpu_bind_init(void)
erts_cpu_topology_t *cpudata;
int cpudata_size;
create_tmp_cpu_topology_copy(&cpudata, &cpudata_size);
- ASSERT(cpudata);
signal_schedulers_bind_change(cpudata, cpudata_size);
destroy_tmp_cpu_topology_copy(cpudata);
}
@@ -5538,23 +5537,29 @@ erts_update_cpu_info(void)
if (changed) {
erts_cpu_topology_t *cpudata;
int cpudata_size;
- erts_free(ERTS_ALC_T_CPUDATA, system_cpudata);
-
- system_cpudata_size = erts_get_cpu_topology_size(erts_cpuinfo);
- system_cpudata = erts_alloc(ERTS_ALC_T_CPUDATA,
- (sizeof(erts_cpu_topology_t)
- * system_cpudata_size));
- if (!erts_get_cpu_topology(erts_cpuinfo, system_cpudata)
- || ERTS_INIT_CPU_TOPOLOGY_OK != verify_topology(system_cpudata,
- system_cpudata_size)) {
+ if (system_cpudata)
erts_free(ERTS_ALC_T_CPUDATA, system_cpudata);
+
+ system_cpudata_size = erts_get_cpu_topology_size(erts_cpuinfo);
+ if (!system_cpudata_size)
system_cpudata = NULL;
- system_cpudata_size = 0;
+ else {
+ system_cpudata = erts_alloc(ERTS_ALC_T_CPUDATA,
+ (sizeof(erts_cpu_topology_t)
+ * system_cpudata_size));
+
+ if (!erts_get_cpu_topology(erts_cpuinfo, system_cpudata)
+ || (ERTS_INIT_CPU_TOPOLOGY_OK
+ != verify_topology(system_cpudata,
+ system_cpudata_size))) {
+ erts_free(ERTS_ALC_T_CPUDATA, system_cpudata);
+ system_cpudata = NULL;
+ system_cpudata_size = 0;
+ }
}
create_tmp_cpu_topology_copy(&cpudata, &cpudata_size);
- ASSERT(cpudata);
signal_schedulers_bind_change(cpudata, cpudata_size);
destroy_tmp_cpu_topology_copy(cpudata);
}