Skip to content

Commit 2f66340

Browse files
committed
Check for index == maxThreadsPerCore after failing to find slot for thread migration.
This fixes a segfault caused by index reaching maxThreadsPerCore because the only unoccupied contexts were pinned.
1 parent 9044a48 commit 2f66340

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Arachne.cc

+7
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,13 @@ migrateThreadsFromCore() {
15951595
index < maxThreadsPerCore)
15961596
index++;
15971597

1598+
// Not able to find a context, likely because unoccupied
1599+
// contexts were pinned.
1600+
if (index == maxThreadsPerCore) {
1601+
success = false;
1602+
break;
1603+
}
1604+
15981605
slotMap.occupied =
15991606
(slotMap.occupied | (1L << index)) & 0x00FFFFFFFFFFFFFF;
16001607
slotMap.numOccupied++;

0 commit comments

Comments
 (0)