From f8164c5c83b0b16c2841d0dd8b8f0e54480014a0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 18 Aug 2018 20:34:16 +0100 Subject: [PATCH] tty: note an optimization area --- Kernel/tty.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Kernel/tty.c b/Kernel/tty.c index eba4444f..1116c4b1 100644 --- a/Kernel/tty.c +++ b/Kernel/tty.c @@ -123,6 +123,15 @@ int tty_write(uint8_t minor, uint8_t rawflag, uint8_t flag) if (psleep_flags_io(&t->flag, flag)) return udata.u_done; } + /* We could optimize this significantly by + a) looping here if not sleeping rather than repeating all + the checks except for STOP/DISCARD + b) possibly batching for the case where tty never blocks + if we have a way to report that. We could then batch except + for conversions and also fast path in vt for 'normal char + next char normal' + c) look at hint/batching for ugetc into a local work buffer + */ if (!(t->flag & TTYF_DISCARD)) { if (udata.u_sysio) c = *udata.u_base; -- 2.34.1