Re: [PATCH 1/3] RFC: Solved unnecessary schedule latency in the TTY layer (1/3)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Mon, 2012-05-14 at 14:25 +0200, Ivo Sieben wrote:
> void tty_flip_buffer_push(struct tty_struct *tty)
> {
> unsigned long flags;
> spin_lock_irqsave(&tty->buf.lock, flags);
> if (tty->buf.tail != NULL)
> tty->buf.tail->commit = tty->buf.tail->used;
> spin_unlock_irqrestore(&tty->buf.lock, flags);
>
> #ifndef CONFIG_PREEMPT_RT_FULL
> if (tty->low_latency)
> flush_to_ldisc(&tty->buf.work);
> else
> schedule_work(&tty->buf.work);
> #else
> flush_to_ldisc(&tty->buf.work);
> #endif
> }
>
Note, just to keep ugly #ifdefs out of C code, or at least C functions,
it is usually better to wrap the above in something like:
#ifdef CONFIG_PREEMPT_RT_FULL
static inline void tty_flush_work(struct tty_struct *tty)
{
flush_to_ldisc(&tty->buf.work);
}
#else
static inline void tty_flush_work(struct tty_struct *tty)
{
if (tty->low_latency)
flush_to_ldisc(&tty->buf.work);
else
schedule_work(&tty->buf.work);
}
#endif
Then the C function would just look like:
void tty_flip_buffer_push(struct tty_struct *tty)
{
unsigned long flags;
spin_lock_irqsave(&tty->buf.lock, flags);
if (tty->buf.tail != NULL)
tty->buf.tail->commit = tty->buf.tail->used;
spin_unlock_irqrestore(&tty->buf.lock, flags);
tty_flush_work(tty);
}
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[RT Stable]
[Kernel Newbies]
[Share Photos]
[IDE]
[Security]
[Git]
[Netfilter]
[Bugtraq]
[Photo]
[Yosemite]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Linux ATA RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]
[Linux Resources]