Skip to content

Commit 3ed28ca

Browse files
committed
tab: yield structural owner retries
1 parent a863906 commit 3ed28ca

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

notes/retry-wait-control-paths.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ Retry wait control-path pass
1313
(`ProfileState.state` or `ProfileState.callbacks`) while the TG is in native
1414
state. This removes blind sleeping, wakes promptly on state/callback release,
1515
and keeps the control path separate from warm mutator/JIT/FFI retry loops.
16+
- Table structural ownership is per-table, not universe-global. Same-table
17+
structural contention still serializes resize/compound array mutation, but
18+
the retry path now uses `lj_thr_retry_yield(L)` instead of a 1ms futex park,
19+
so independent tables do not serialize and contested same-table waits no
20+
longer carry fixed millisecond latency.

src/lj_tab.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,8 @@ static uint32_t tab_struct_tid(lua_State *L)
9595

9696
static void tab_struct_owner_wait(lua_State *L, GCtab *t, uint32_t owner)
9797
{
98-
TGState *tg = L ? L2TG(L) : lj_thr_get_tg();
99-
if (tg)
100-
lj_native_enter(tg); /* 06 section 6.2 bridge: same-table resize park. */
101-
lj_tab_struct_owner_futex_wait(t, owner, 1000000);
102-
if (L) {
103-
(void)lj_native_leave(L);
104-
} else if (tg) {
105-
(void)lj_tg_in_native_dec_rel(tg);
106-
}
98+
UNUSED(t); UNUSED(owner);
99+
(void)lj_thr_retry_yield(L); /* Same-table resize owner retry. */
107100
}
108101

109102
static LJ_AINLINE int tab_mt_concurrent(void)

0 commit comments

Comments
 (0)