Commit 838be4f
committed
fix(flowcontrol/bench): restore L backpressure in benchDetector self-heal
The previous detector fix (f527a2b) stopped the L=1 hang but over-corrected:
it reclaimed the prior grant on every Saturation call, pinning inFlight at <=1
so the mock never reported saturated for any limit>=1. That silently removed the
W>L backpressure the PerformanceMatrix sweep exists to measure -- every L
behaved as free-flow.
Restore the original reserve-in-read accounting (inFlight accumulates to L under
load and Saturation returns 1.0 once exceeded), and self-heal only the genuine
leak source: the processor's 1ms dispatch ticker reserves a permit on empty-queue
idle cycles that never dispatch and so are never Released. Distinguish leaked idle
grants from real load saturation via releaseCount -- while releases are flowing
the saturation is genuine; two consecutive saturated reads with zero releases
between them mean the outstanding grants are leaked idle permits, so reclaim one.
This keeps L=1 from latching (no hang) without capping accumulation.
Known approximation: under severe scheduler starvation a saturated band may
over-admit by ~1; this only perturbs the d/s numbers, never fails (the matrix
does not assert on dispatch outcomes).
Tests: add TestBenchDetector_SaturatesAtLimit (the backpressure assertion whose
absence let the regression through); reframe the no-leak test as a no-permanent-
latch/self-heal guard; replace the pendingGrant-specific test with a
release-recovers-capacity test. All deterministic, pass under -race.
Verified: L=1 vs L=100 throughput now separates by ~10x (was identical);
full bench smoke completes with no hang.1 parent b322a55 commit 838be4f
2 files changed
Lines changed: 99 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
35 | 62 | | |
36 | | - | |
| 63 | + | |
37 | 64 | | |
38 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
39 | 69 | | |
40 | 70 | | |
41 | 71 | | |
| |||
57 | 87 | | |
58 | 88 | | |
59 | 89 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
65 | 94 | | |
66 | | - | |
| 95 | + | |
67 | 96 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
72 | 102 | | |
| 103 | + | |
| 104 | + | |
73 | 105 | | |
74 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
75 | 111 | | |
76 | 112 | | |
77 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
97 | 96 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
101 | 107 | | |
102 | 108 | | |
103 | 109 | | |
104 | | - | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
108 | 117 | | |
109 | 118 | | |
110 | | - | |
111 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
112 | 125 | | |
113 | 126 | | |
114 | 127 | | |
115 | 128 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 129 | + | |
| 130 | + | |
119 | 131 | | |
120 | 132 | | |
121 | | - | |
122 | | - | |
| 133 | + | |
| 134 | + | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
126 | 138 | | |
127 | 139 | | |
128 | 140 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 141 | | |
135 | 142 | | |
136 | | - | |
| 143 | + | |
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
142 | 166 | | |
143 | 167 | | |
144 | 168 | | |
| |||
0 commit comments