From: Jiri Slaby <jslaby@suse.cz>
To: Ivo Sieben <meltedpianoman@gmail.com>
Cc: linux-serial@vger.kernel.org, Alan Cox <alan@linux.intel.com>,
Greg KH <gregkh@linuxfoundation.org>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] tty: Only wakeup the line discipline idle queue when queue is active
Date: Wed, 02 Jan 2013 10:29:30 +0100 [thread overview]
Message-ID: <50E3FDFA.4070203@suse.cz> (raw)
In-Reply-To: <1355842130-15482-1-git-send-email-meltedpianoman@gmail.com>
On 12/18/2012 03:48 PM, Ivo Sieben wrote:
> Before waking up the tty line discipline idle queue first check if the queue is
> active (non empty). This prevents unnecessary entering the critical section in
> the wake_up() function and therefore avoid needless scheduling overhead on a
> PREEMPT_RT system caused by two processes being in the same critical section.
>
> Signed-off-by: Ivo Sieben <meltedpianoman@gmail.com>
> ---
>
> Remark:
> This patch has kind of a long history... I first tried to prevent the critical
> section in the wakeup() function itself by a change in the scheduler. But after
> review remarks from Oleg Nesterov it turned out that using the
> waitqueue_active() was a much nicer way to prevent it. See also
> https://lkml.org/lkml/2012/10/25/159
>
> drivers/tty/tty_ldisc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
> index c578229..e96d187 100644
> --- a/drivers/tty/tty_ldisc.c
> +++ b/drivers/tty/tty_ldisc.c
> @@ -64,7 +64,9 @@ static void put_ldisc(struct tty_ldisc *ld)
> return;
> }
> raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
> - wake_up(&ld->wq_idle);
> +
> + if (waitqueue_active(&ld->wq_idle))
> + wake_up(&ld->wq_idle);
Looks good, but I would prefer the layer to provide us with
wake_up_if_active...
--
js
suse labs
next prev parent reply other threads:[~2013-01-02 9:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 14:48 [PATCH] tty: Only wakeup the line discipline idle queue when queue is active Ivo Sieben
2012-12-18 14:48 ` Ivo Sieben
2013-01-02 9:29 ` Jiri Slaby [this message]
2013-01-02 11:43 ` Alan Cox
2013-01-02 15:21 ` Ivo Sieben
2013-01-02 19:06 ` Jiri Slaby
2013-01-03 9:49 ` Ivo Sieben
2013-01-03 18:36 ` Oleg Nesterov
2013-01-15 9:16 ` Ivo Sieben
2013-01-15 18:03 ` Oleg Nesterov
2013-01-16 8:13 ` Preeti U Murthy
2013-01-16 9:16 ` Ivo Sieben
2013-01-16 10:41 ` Preeti U Murthy
2013-01-16 12:02 ` Ivo Sieben
2013-01-17 10:56 ` Preeti U Murthy
2013-01-18 15:45 ` Oleg Nesterov
2013-01-21 2:56 ` Preeti U Murthy
2013-01-21 7:20 ` Ivo Sieben
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=50E3FDFA.4070203@suse.cz \
--to=jslaby@suse.cz \
--cc=alan@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=meltedpianoman@gmail.com \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.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.