From: Manfred Spraul <manfred@colorfullife.com>
To: Valdis.Kletnieks@vt.edu
Cc: Andrew Morton <akpm@osdl.org>,
Andries.Brouwer@cwi.nl, torvalds@osdl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] select fix
Date: Tue, 29 Jul 2003 20:09:20 +0200 [thread overview]
Message-ID: <3F26B850.10600@colorfullife.com> (raw)
In-Reply-To: <200307291748.h6THma3o007162@turing-police.cc.vt.edu>
Valdis.Kletnieks@vt.edu wrote:
>On Tue, 29 Jul 2003 10:36:30 PDT, Andrew Morton said:
>
>
>
>>>- if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
>>>+ if (!tty->stopped && tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
>>> mask |= POLLOUT | POLLWRNORM;
>>>
>>>
>>Manfred sent a patch through esterday which addresses it this way:
>>
>>- if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
>>+ if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
>>+ tty->driver->write_room(tty) > 0)
>>
>>Any preferences?
>>
>>
>
>Would including all 3 conditions make sense? Not sure if it should be A&B&C, or
>A&(B|C) though, but it certainly smells like the write_room() and tty->stopped
>checks are covering 2 different corner cases....
>
>
No. select() and write() must agree when -EAGAIN happens.
write() will fail if write_room() returns 0. Additionally, we want to
delay wakeups a bit, to reduce context switches.
The problem is that the console driver implements stopping by returning
0 from ->write_room() - therefore "less than WAKEUP_CHARS in buffer" is
not equivalent to "write will not return -EAGAIN", and thus user space
loops. My patch fixes that by checking ->write_room() in normal_poll.
Perhaps the Right Thing (tm) is
> if (tty->driver->write_room(tty) > WAKEUP_CHARS)
> mask |= POLLOUT | POLLWRNORM;
but I simply to not understand the tty layer at all, thus I proposed the
minimal patch.
--
Manfred
next prev parent reply other threads:[~2003-07-29 18:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-29 14:12 [PATCH] select fix Andries.Brouwer
2003-07-29 17:36 ` Andrew Morton
2003-07-29 17:48 ` Valdis.Kletnieks
2003-07-29 18:09 ` Manfred Spraul [this message]
2003-07-29 17:57 ` Manfred Spraul
-- strict thread matches above, loose matches on Subject: below --
2003-07-29 19:58 Andries.Brouwer
2003-07-29 20:18 Andries.Brouwer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F26B850.10600@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=Andries.Brouwer@cwi.nl \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.