ref: e3ad3d6968f4fd4cbb325e081ac9027d24f01316
parent: b54c61c6174251736e0a6bf30fc1631eca79210c
author: cinap_lenrek <[email protected]>
date: Sat Mar 16 16:14:40 EDT 2024
qio: revert the change, i was not reading the code right actually, the initial condition for blocking was q->len/2 >= q->limit, which menas the queue grew over TWICE the size. thich makes this heuristic kick in later, which i think was fine. so revert and put comment to not getting confused again. sorry :(
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -1163,9 +1163,14 @@
QDEBUG if(!islo())
print("qwrite hi %#p\n", getcallerpc(&q));
-
- /* stop queue bloat before allocating blocks */
- if(q->len >= q->limit && q->noblock == 0 && q->bypass == nil){
+ /*
+ * when the queue length grew over twice the limit,
+ * block here before allocating more blocks.
+ * this can happen when qflow() is getting
+ * interrupted by notes, preventing effective
+ * flow control.
+ */
+ if(q->len/2 >= q->limit && q->noblock == 0 && q->bypass == nil){
while(waserror()){
if(up->procctl == Proc_exitme || up->procctl == Proc_exitbig)
error(Egreg);