Re: [Bug #14388] keyboard under X with 2.6.31

From: Linus Torvalds
Date: Tue Oct 13 2009 - 12:51:31 EST




On Tue, 13 Oct 2009, Alan Cox wrote:
>
> I actually think you should make the tty_insert_flip_string internal
> length checking change because:
> - It makes the consistency of tty_insert_flip_string clearer to any
> future reader

It does that, although then you're still stuck looking at the (few)
tty_prepare_flip_*() calls that have that "racy feel".

But there aren't _that_ many callers, and it would probably be easier to
at least comment on those.

> - It's a very very mindbogglingly slight performance win

I suspect the loop is always done exactly once in practice, so I'm not
sure it will matter for performance one way or the other.

However, if we do hold the spinlock over the whole operation, what we
_could_ do is to then just combine it with tty_flip_buffer_push(), and do
that
tb->commit = tb->used;

part inside the lock. There's a number of people who effectively do

tty_tty_buffer_request_room(tty, size);
tty_insert_flip_string(tty, buffer, size);
tty_flip_buffer_push(tty);

and that just takes that silly spinlock _three_ times for no good reason.

> - It'll no doubt make you feel less grumpy ;)

Not likely. Grumpy is my baseline.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/