Skip to content

Commit 1b3c8c1

Browse files
committed
Group the fields of ErtsRunQueue that are often accessed by other cores
This is a tiny change that should improve cache locality a bit during task stealing.
1 parent c817927 commit 1b3c8c1

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

erts/emulator/beam/erl_process.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -469,36 +469,37 @@ struct ErtsMigrationPaths_ {
469469

470470

471471
struct ErtsRunQueue_ {
472-
int ix;
473-
474472
erts_mtx_t mtx;
473+
erts_atomic32_t flags;
474+
475+
struct {
476+
ErtsRunQueueInfo prio_info[ERTS_NO_PROC_PRIO_LEVELS];
477+
/* We use the same prio queue for low and
478+
normal prio processes */
479+
ErtsRunPrioQueue prio[ERTS_NO_PROC_PRIO_LEVELS-1];
480+
Uint context_switches;
481+
Uint reductions;
482+
} procs;
483+
484+
erts_aint32_t max_len;
485+
erts_atomic32_t len;
486+
487+
/* The fields above are the ones that are commonly accessed by other cores during task stealing
488+
They are grouped together to improve cache locality. */
475489

490+
int ix;
476491
ErtsSchedulerSleepList sleepers;
477492

478493
ErtsSchedulerData *scheduler;
479494
int waiting;
480495
int woken;
481-
erts_atomic32_t flags;
482496
int check_balance_reds;
483497
int full_reds_history_sum;
484498
int full_reds_history[ERTS_FULL_REDS_HISTORY_SIZE];
485499
int out_of_work_count;
486-
erts_aint32_t max_len;
487-
erts_atomic32_t len;
488500
int wakeup_other;
489501
int wakeup_other_reds;
490502

491-
struct {
492-
Uint context_switches;
493-
Uint reductions;
494-
495-
ErtsRunQueueInfo prio_info[ERTS_NO_PROC_PRIO_LEVELS];
496-
497-
/* We use the same prio queue for low and
498-
normal prio processes */
499-
ErtsRunPrioQueue prio[ERTS_NO_PROC_PRIO_LEVELS-1];
500-
} procs;
501-
502503
struct {
503504
ErtsMiscOpList *start;
504505
ErtsMiscOpList *end;

0 commit comments

Comments
 (0)