Thanks a lot! I was suspecting something like this, but was not sure.
Below is what I have now, and it solves my problems.
Question remains: can setting current->state in do_con_write affect something?
It is needed to avoid sleep on write_wait in write_chan.
BTW, this patch adds check for signals in opost case, this speeds up
interrupting a process writing to console. Umm, maybe such check should
be also added to do_con_write?
--- console.c.1 Fri Dec 11 18:43:24 1998
+++ console.c Fri Dec 11 18:46:13 1998
@@ -1912,6 +1912,15 @@
}
FLUSH
do_con_trol(tty, currcons, c);
+
+ if(current->need_resched)
+ {
+ /* To avoid stalls in chan_write (-opost case) */
+ current->state=TASK_RUNNING;
+ /* Can't call schedule here, return to caller.
+ Caller must schedule if it can. */
+ break;
+ }
}
FLUSH
enable_bh(CONSOLE_BH);
--- n_tty.c.1 Thu Dec 10 13:13:51 1998
+++ n_tty.c Fri Dec 11 18:36:36 1998
@@ -1081,7 +1081,17 @@
nr -= num;
if (nr == 0)
break;
+ if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
+ goto break_out;
+ }
get_user(c, b);
+ if (current->need_resched)
+ {
+ current->state = TASK_RUNNING;
+ schedule();
+ current->state = TASK_INTERRUPTIBLE;
+ }
if (opost(c, tty) < 0)
break;
b++; nr--;
Alexander.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/