File 2853-Don-t-steal-task-when-there-is-a-single-one.patch of Package erlang
From d86d313ee6f62423208ac696986f45bad3350f6b Mon Sep 17 00:00:00 2001
From: Robin Morisset <rmorisset@meta.com>
Date: Wed, 26 Mar 2025 09:40:26 -0700
Subject: [PATCH 13/15] Don't steal task when there is a single one
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MichaĆ suggested this change to me, the idea is that if there is a
single task in a queue, stealing it is not balancing the load, it is
just exchanging which scheduler is starved for work.
---
erts/emulator/beam/erl_process.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index bff19558c6..b67e03a52b 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -4525,8 +4525,6 @@ try_steal_task_from_victim(ErtsRunQueue *rq, ErtsRunQueue *vrq, Uint32 flags, Pr
continue;
}
rpq = &vrq->procs.prio[prio_q];
- /* Steal at least one task, even if there is a single one */
- max_processes_to_steal++;
/* Only steal half the tasks (to balance the load between the victim runqueue and this one) */
max_processes_to_steal /= 2;
/* Don't steal too many tasks at once, to keep the critical section from getting too long */
--
2.43.0