From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Greg KH <gregkh@suse.de>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Jef Driesen <jefdriesen@telenet.be>,
linux-kernel@vger.kernel.org
Subject: Re: Slow pty's (was Re: libdivecomputer interfaces?)
Date: Fri, 11 Jun 2010 03:07:05 +0900 [thread overview]
Message-ID: <87typan4mu.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <AANLkTinLth4iKXAwszEEsPm_9ZDlj8HtqsiG5cdFE1cZ@mail.gmail.com> (Linus Torvalds's message of "Thu, 10 Jun 2010 10:25:36 -0700")
Linus Torvalds <torvalds@linux-foundation.org> writes:
>>From Jef's original lkml report linked to above:
>
>> You can reproduce the problem by running these commands in three
>> different terminals:
>>
>> # Terminal 1: Setup the pty's.
>> socat PTY,link=/tmp/ttyS0 PTY,link=/tmp/ttyS1
>> # Terminal 2: Send some data.
>> dd if=/dev/urandom of=input.bin bs=538368 count=1
>> sx input.bin >>/tmp/ttyS0 </tmp/ttyS0
>> # Terminal 2: Receive the data data.
>> time rx output.bin >/tmp/ttyS1 </tmp/ttyS1
>
> and yeah, it's pretty clear to see. A "perf report" on that receiving
> side just shows queue_delayed_work_on(), but that doesn't mean much.
> It's clearly just sleeping all the time...
I'm not reading all of this thread yet, so sorry if I'm missing the
point of this thread.
FWIW, I remember there was the unnecessary waiting related to background
flusher. It was in input_available_p(). I'm not sure at all whether
this is related to the problem, and totally untested patch (this patch
calls tty_flush_to_ldisc() only when data is unavailable). Someone can
test the following or something (is there any change)?
Well, anyway, I'll read this thread at this weekend, and will see if
someone didn't already fix it.
I.e. the following or something,
static inline int input_available_p(struct tty_struct *tty, int amt)
{
int try = 0;
retry:
if (tty->icanon) {
if (tty->canon_data)
return 1;
} else if (tty->read_cnt >= (amt ? amt : 1))
return 1;
if (!checked) {
tty_flush_to_ldisc(tty);
try = 1;
goto retry;
}
return 0;
}
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2010-06-10 18:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 17:25 Slow pty's (was Re: libdivecomputer interfaces?) Linus Torvalds
2010-06-10 18:07 ` OGAWA Hirofumi [this message]
2010-06-10 18:10 ` Chris Wedgwood
2010-06-10 22:25 ` Brian Bloniarz
2010-06-10 22:30 ` Linus Torvalds
2010-06-16 15:03 ` Jiri Kosina
2010-06-16 15:16 ` Mike Galbraith
2010-06-17 6:39 ` Mike Galbraith
2010-06-17 7:00 ` Mike Galbraith
2010-06-17 10:50 ` Mike Galbraith
2010-06-17 13:24 ` Peter Zijlstra
2010-06-17 14:11 ` Thomas Gleixner
2010-06-17 14:14 ` Mike Galbraith
2010-06-17 14:56 ` Brian Bloniarz
2010-06-17 16:02 ` [PATCH] nohz: Fix nohz ratelimit Peter Zijlstra
2010-06-17 17:39 ` [tip:timers/urgent] " tip-bot for Peter Zijlstra
2010-11-12 18:45 ` Slow pty's (was Re: libdivecomputer interfaces?) Jef Driesen
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=87typan4mu.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@suse.de \
--cc=jefdriesen@telenet.be \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox