All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH tty-next 6/7] n_tty: Only perform wakeups for waiters
Date: Sat, 23 Nov 2013 21:29:17 -0500	[thread overview]
Message-ID: <5291647D.2070703@hurleysoftware.com> (raw)
In-Reply-To: <20131124002324.2fe609d6@alan.etchedpixels.co.uk>

On 11/23/2013 07:23 PM, One Thousand Gnomes wrote:
> On Fri, 22 Nov 2013 10:59:24 -0500
> Peter Hurley <peter@hurleysoftware.com> wrote:
>
>> Only wakeup the _waiting_ reader, polls and/or writer(s).
>>
>> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
>> ---
>>   drivers/tty/n_tty.c | 18 ++++++++++++------
>>   1 file changed, 12 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
>> index 8f2356e..aae28a6 100644
>> --- a/drivers/tty/n_tty.c
>> +++ b/drivers/tty/n_tty.c
>> @@ -275,7 +275,8 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
>>   			return;
>>   		n_tty_set_room(tty);
>>   		n_tty_write_wakeup(tty->link);
>> -		wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
>> +		if (waitqueue_active(&tty->link->write_wait))
>> +			wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
>
> Does this actually microbenchmark faster ?

Getting on and off the write_wait queue is actually pretty expensive for
the "other" pty (the writer), and the unnecessary wakeup from the reader
doesn't help.

The other chunks are gratuitous.

Regards,
Peter Hurley

PS - This came up because there is some worst-case behavior that I'm looking
into fixing.  When the userspace reader is very far behind (say because it's
reading char-by-char), it doesn't make sense to keep restarting the input
processing worker.


  reply	other threads:[~2013-11-24  2:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 15:59 [PATCH tty-next 0/7] n_tty cleanup + trace additions Peter Hurley
2013-11-22 15:59 ` [PATCH tty-next 1/7] n_tty: Merge .receive_buf() flavors Peter Hurley
2013-11-22 15:59 ` [PATCH tty-next 2/7] n_tty: Un-inline slow-path n_tty_receive_char() Peter Hurley
2013-11-22 15:59 ` [PATCH tty-next 3/7] n_tty: Un-inline slow-path n_tty_receive_char_closing() Peter Hurley
2013-11-22 15:59 ` [PATCH tty-next 4/7] n_tty: Refactor PARMRK doubling checks Peter Hurley
2013-11-22 15:59 ` [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site Peter Hurley
2013-11-24  0:22   ` One Thousand Gnomes
2013-11-24  0:26   ` One Thousand Gnomes
2013-11-24  2:01     ` Peter Hurley
2013-11-24 16:18       ` One Thousand Gnomes
2013-11-22 15:59 ` [PATCH tty-next 6/7] n_tty: Only perform wakeups for waiters Peter Hurley
2013-11-24  0:23   ` One Thousand Gnomes
2013-11-24  2:29     ` Peter Hurley [this message]
2013-11-22 15:59 ` [PATCH tty-next 7/7] n_tty: trace input/read flow control Peter Hurley
2013-11-24  0:25   ` One Thousand Gnomes
2013-11-24  2:38     ` Peter Hurley
2013-11-26 13:00       ` Peter Hurley
2013-12-02 19:24 ` [PATCH v2 tty-next 0/8] n_tty cleanup + trace additions Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 1/8] n_tty: Merge .receive_buf() flavors Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 2/8] n_tty: Un-inline slow-path n_tty_receive_char() Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 3/8] n_tty: Un-inline slow-path n_tty_receive_char_closing() Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 4/8] n_tty: Refactor PARMRK doubling checks Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 5/8] n_tty: Refactor input_available_p() by call site Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 6/8] n_tty: Only perform wakeups for waiters Peter Hurley
2013-12-02 19:24   ` [PATCH v2 tty-next 7/8] n_tty: Extend debug tracing Peter Hurley
2013-12-09  0:54     ` Greg Kroah-Hartman
2013-12-02 19:24   ` [PATCH v2 tty-next 8/8] n_tty: Trace echo output with separate trace configuration Peter Hurley

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=5291647D.2070703@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.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.