Skip to content

Commit

Permalink
erts: Optimize PSD cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sverker committed Jul 11, 2024
1 parent 84b9a73 commit f9b07e1
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions erts/emulator/beam/erl_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -13275,41 +13275,41 @@ delete_process(Process* p)
/* free all pending messages */
erts_proc_sig_cleanup_queues(p);

scb = ERTS_PROC_SET_SAVED_CALLS_BUF(p, NULL);
/* Cleanup psd */

psd = (ErtsPSD *) erts_atomic_read_nob(&p->psd);
if (psd) {
scb = ERTS_PROC_SET_SAVED_CALLS_BUF(p, NULL);

if (scb) {
if (scb) {
#ifndef BEAMASM
p->fcalls += CONTEXT_REDS; /* Reduction counting depends on this... */
p->fcalls += CONTEXT_REDS; /* Reduction counting depends on this... */
#endif

erts_free(ERTS_ALC_T_CALLS_BUF, (void *) scb);
}

pbt = ERTS_PROC_SET_CALL_TIME(p, NULL);
while (pbt) {
process_breakpoint_trace_t *next = pbt->next;
erts_free(ERTS_ALC_T_BPD, (void *) pbt);
pbt = next;
}
pbt = ERTS_PROC_SET_CALL_MEMORY(p, NULL);
while (pbt) {
process_breakpoint_trace_t *next = pbt->next;
erts_free(ERTS_ALC_T_BPD, (void *) pbt);
pbt = next;
}

erts_destroy_nfunc(p);
erts_free(ERTS_ALC_T_CALLS_BUF, (void *) scb);
}

/* Cleanup psd */
pbt = ERTS_PROC_SET_CALL_TIME(p, NULL);
while (pbt) {
process_breakpoint_trace_t *next = pbt->next;
erts_free(ERTS_ALC_T_BPD, (void *) pbt);
pbt = next;
}
pbt = ERTS_PROC_SET_CALL_MEMORY(p, NULL);
while (pbt) {
process_breakpoint_trace_t *next = pbt->next;
erts_free(ERTS_ALC_T_BPD, (void *) pbt);
pbt = next;
}

psd = (ErtsPSD *) erts_atomic_read_nob(&p->psd);
erts_destroy_nfunc(p);

if (psd) {
if (psd->data[ERTS_PSD_SYSMON_MSGQ_LEN_LOW]) {
erts_clear_all_msgq_low_sessions(p);
}
erts_atomic_set_nob(&p->psd, (erts_aint_t) NULL); /* Reduction counting depends on this... */
erts_free(ERTS_ALC_T_PSD, psd);

erts_atomic_set_nob(&p->psd, (erts_aint_t) NULL); /* Reduction counting depends on this... */
erts_free(ERTS_ALC_T_PSD, psd);
}

/* Clean binaries and funs */
Expand Down

0 comments on commit f9b07e1

Please sign in to comment.