diff options
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index c2ca5a03f3..7a89df49e0 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -2508,7 +2508,7 @@ notify_reap_ports_relb(void) } erts_atomic32_t erts_halt_progress; -int erts_halt_code; +int erts_halt_code = INT_MIN; static ERTS_INLINE erts_aint32_t handle_reap_ports(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) @@ -2553,7 +2553,7 @@ handle_reap_ports(ErtsAuxWorkData *awdp, erts_aint32_t aux_work, int waiting) erts_port_release(prt); } if (erts_atomic32_dec_read_nob(&erts_halt_progress) == 0) { - erts_flush_async_exit(erts_halt_code, ""); + erts_flush_exit(erts_halt_code, ""); } } return aux_work & ~ERTS_SSI_AUX_WORK_REAP_PORTS; @@ -6307,7 +6307,7 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online, int no_poll_th erts_atomic32_init_relb(&erts_halt_progress, -1); - erts_halt_code = 0; + erts_halt_code = INT_MIN; } @@ -7397,7 +7397,7 @@ static ERTS_INLINE int have_dirty_work(void) { return !(ERTS_EMPTY_RUNQ(ERTS_DIRTY_CPU_RUNQ) - | ERTS_EMPTY_RUNQ(ERTS_DIRTY_IO_RUNQ)); + || ERTS_EMPTY_RUNQ(ERTS_DIRTY_IO_RUNQ)); } #define ERTS_MSB_NONE_PRIO_BIT PORT_BIT @@ -8665,6 +8665,7 @@ sched_thread_func(void *vesdp) erts_ets_sched_spec_data_init(esdp); erts_utils_sched_spec_data_init(); + erts_nif_sched_init(esdp); process_main(esdp); @@ -8715,6 +8716,8 @@ sched_dirty_cpu_thread_func(void *vesdp) erts_proc_lock_prepare_proc_lock_waiter(); + erts_nif_sched_init(esdp); + erts_dirty_process_main(esdp); /* No schedulers should *ever* terminate */ erts_exit(ERTS_ABORT_EXIT, @@ -8763,6 +8766,8 @@ sched_dirty_io_thread_func(void *vesdp) erts_proc_lock_prepare_proc_lock_waiter(); + erts_nif_sched_init(esdp); + erts_dirty_process_main(esdp); /* No schedulers should *ever* terminate */ erts_exit(ERTS_ABORT_EXIT, @@ -8776,7 +8781,7 @@ erts_start_schedulers(void) { ethr_tid tid; int res = 0; - char name[32]; + char name[ETHR_THR_NAME_MAX + 1]; ethr_thr_opts opts = ETHR_THR_OPTS_DEFAULT_INITER; int ix; @@ -8786,7 +8791,7 @@ erts_start_schedulers(void) if (erts_runq_supervision_interval) { opts.suggested_stack_size = 16; - erts_snprintf(opts.name, sizeof(name), "runq_supervisor"); + erts_snprintf(opts.name, sizeof(name), "erts_runq_sup"); erts_atomic_init_nob(&runq_supervisor_sleeping, 0); if (0 != ethr_event_init(&runq_supervision_event)) erts_exit(ERTS_ABORT_EXIT, "Failed to create run-queue supervision event\n"); @@ -8807,7 +8812,7 @@ erts_start_schedulers(void) for (ix = 0; ix < erts_no_schedulers; ix++) { ErtsSchedulerData *esdp = ERTS_SCHEDULER_IX(ix); ASSERT(ix == esdp->no - 1); - erts_snprintf(opts.name, sizeof(name), "%lu_scheduler", ix + 1); + erts_snprintf(opts.name, sizeof(name), "erts_sched_%d", ix + 1); res = ethr_thr_create(&esdp->tid, sched_thread_func, (void*)esdp, &opts); if (res != 0) { erts_exit(ERTS_ABORT_EXIT, "Failed to create scheduler thread %d, error = %d\n", ix, res); @@ -8821,7 +8826,7 @@ erts_start_schedulers(void) { for (ix = 0; ix < erts_no_dirty_cpu_schedulers; ix++) { ErtsSchedulerData *esdp = ERTS_DIRTY_CPU_SCHEDULER_IX(ix); - erts_snprintf(opts.name, sizeof(name), "%d_dirty_cpu_scheduler", ix + 1); + erts_snprintf(opts.name, sizeof(name), "erts_dcpus_%d", ix + 1); opts.suggested_stack_size = erts_dcpu_sched_thread_suggested_stack_size; res = ethr_thr_create(&esdp->tid,sched_dirty_cpu_thread_func,(void*)esdp,&opts); if (res != 0) @@ -8829,7 +8834,7 @@ erts_start_schedulers(void) } for (ix = 0; ix < erts_no_dirty_io_schedulers; ix++) { ErtsSchedulerData *esdp = ERTS_DIRTY_IO_SCHEDULER_IX(ix); - erts_snprintf(opts.name, sizeof(name), "%d_dirty_io_scheduler", ix + 1); + erts_snprintf(opts.name, sizeof(name), "erts_dios_%d", ix + 1); opts.suggested_stack_size = erts_dio_sched_thread_suggested_stack_size; res = ethr_thr_create(&esdp->tid,sched_dirty_io_thread_func,(void*)esdp,&opts); if (res != 0) @@ -8840,7 +8845,7 @@ erts_start_schedulers(void) ix = 0; while (ix < erts_no_aux_work_threads) { int id = ix == 0 ? 1 : ix + 1 - (int) erts_no_schedulers; - erts_snprintf(opts.name, sizeof(name), "%d_aux", id); + erts_snprintf(opts.name, sizeof(name), "erts_aux_%d", id); res = ethr_thr_create(&tid, aux_thread, (void *) (Sint) ix, &opts); if (res != 0) @@ -8867,7 +8872,7 @@ erts_start_schedulers(void) bpt->blocked = 0; bpt->id = ix; - erts_snprintf(opts.name, sizeof(name), "%d_poller", ix); + erts_snprintf(opts.name, sizeof(name), "erts_poll_%d", ix); res = ethr_thr_create(&tid, poll_thread, (void*) bpt, &opts); if (res != 0) @@ -13065,7 +13070,7 @@ delete_process(Process* p) { ErtsPSD *psd; struct saved_calls *scb; - process_breakpoint_time_t *pbt; + process_breakpoint_trace_t *pbt; Uint32 block_rla_ref = (Uint32) (Uint) p->u.terminate; VERBOSE(DEBUG_PROCESSES, ("Removing process: %T\n",p->common.id)); @@ -13088,6 +13093,9 @@ delete_process(Process* p) pbt = ERTS_PROC_SET_CALL_TIME(p, NULL); if (pbt) erts_free(ERTS_ALC_T_BPD, (void *) pbt); + pbt = ERTS_PROC_SET_CALL_MEMORY(p, NULL); + if (pbt) + erts_free(ERTS_ALC_T_BPD, (void *) pbt); erts_destroy_nfunc(p); @@ -14858,6 +14866,7 @@ void erts_halt(int code) ERTS_RUNQ_FLGS_SET(ERTS_DIRTY_CPU_RUNQ, ERTS_RUNQ_FLG_HALTING); ERTS_RUNQ_FLGS_SET(ERTS_DIRTY_IO_RUNQ, ERTS_RUNQ_FLG_HALTING); erts_halt_code = code; + erts_nif_notify_halt(); } } |