From: Ivo Sieben <meltedpianoman@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-serial@vger.kernel.org, Alan Cox <alan@linux.intel.com>,
RT <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 2/3] RFC: Solved unnecessary schedule latency in the TTY layer (2/3)
Date: Mon, 7 May 2012 09:45:51 +0200 [thread overview]
Message-ID: <CAMSQXEEofb_4mLjNffTK1ZEHXA0UcY1dXm5NR-GD1jJzDgDu+w@mail.gmail.com> (raw)
In-Reply-To: <20120503162529.GB3063@kroah.com>
Hi,
2012/5/3 Greg KH <gregkh@linuxfoundation.org>:
>
> Why, what does this cause to have happen? What's the difference here
> that causes any speedups or latency fixes?
>
This patch solves the following scenario:
- A low priority process starts to send data to serial port A
- In order to do this, the low priority process calls the
tty_ldisc_ref_wait() function to retrieve a reference to its line
discipline.
- In the tty_ldisc_ref_wait() function, the global ldisc spinlock is locked.
- While the spin lock is still locked, a context switch takes place
and a second process on high real-time priority starts reading data
from another serial port B (this is a possible scenario on a
PREEMPT_RT system where a "normal" spin lock behaves like a mutex and
no interrupts are actually disabled, although the "irqsave" postfix in
the spinlock function name suggests otherwise)
- The second project also calls the tty_ldisc_ref_wait() function, and
therefor gets blocked on the global ldisc spin lock.
- As a result priority inversion takes place, and the second process
is scheduled out, the first process is scheduled in on high priority.
After the first process has released the spin lock, the second process
is scheduled again.
The above scenario is not wrong, it works fine... but the scheduling &
mutex handling requires a lot of extra processing time what makes that
a normal read operation of about 50us sometimes can last up to 230us.
By using raw spin locks this situation is prevented. I think it is
legitimate to use raw spin locks because the critical sections in
ldisc are small.
Regards,
Ivo Sieben
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-05-07 7:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 12:37 [PATCH 1/3] RFC: Solved unnecessary schedule latency in the TTY layer (1/3) Ivo Sieben
2012-05-03 12:37 ` [PATCH 2/3] RFC: Solved unnecessary schedule latency in the TTY layer (2/3) Ivo Sieben
2012-05-03 16:25 ` Greg KH
2012-05-07 7:45 ` Ivo Sieben [this message]
2012-05-03 12:37 ` [PATCH 3/3] RFC: Solved unnecessary schedule latency in the TTY layer (3/3) Ivo Sieben
2012-05-03 16:24 ` Greg KH
2012-05-10 15:28 ` Alan Cox
2012-05-07 14:10 ` [PATCH 1/3] RFC: Solved unnecessary schedule latency in the TTY layer (1/3) Ivo Sieben
2012-05-10 15:26 ` Alan Cox
2012-05-14 12:25 ` Ivo Sieben
2012-05-15 15:04 ` Steven Rostedt
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=CAMSQXEEofb_4mLjNffTK1ZEHXA0UcY1dXm5NR-GD1jJzDgDu+w@mail.gmail.com \
--to=meltedpianoman@gmail.com \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-rt-users@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).