• Peter Hurley's avatar
    n_tty: Always wake up read()/poll() if new input · 33d71363
    Peter Hurley authored
    A read() in non-canonical mode when VMIN > 0 and VTIME == 0 does not
    complete until at least VMIN chars have been read (or the user buffer is
    full). In this infrequent read mode, n_tty_read() attempts to reduce
    wakeups by computing the amount of data still necessary to complete the
    read (minimum_to_wake) and only waking the read()/poll() when that much
    unread data has been processed. This is the only read mode for which
    new data does not necessarily generate a wakeup.
    
    However, this optimization is broken and commonly leads to hung reads
    even though the necessary amount of data has been received. Since the
    optimization is of marginal value anyway, just remove the whole
    thing. This also remedies a race between a concurrent poll() and
    read() in this mode, where the poll() can reset the minimum_to_wake
    of the read() (and vice versa).
    Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    33d71363
n_tty.c 60.8 KB