Re: [PATCH] new tty buffering locking fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Olaf:

Try this patch and let me know how it works.
(it is against 2.6.16-rc2-git1)

This change prevents claiming a partially filled
buffer if it has already been committed by the
driver calling a tty scheduling function, but not
yet processed by the tty layer.

Individual drivers can no longer stall committed
data by calling any of the tty buffering functions.
(example: calling tty_buffer_request_room
and not immediately adding receive data with an
associated tty scheduling call)

This remains relatively efficient. 
1. partially filled active buffer can be reused
2. already allocated empty buffer can be reused

Thanks,
Paul


--- linux-2.6.16-rc2/drivers/char/tty_io.c	2006-02-07 13:18:40.000000000 -0600
+++ b/drivers/char/tty_io.c	2006-02-07 13:46:28.000000000 -0600
@@ -324,8 +324,14 @@ int tty_buffer_request_room(struct tty_s
 	   remove this conditional if its worth it. This would be invisible
 	   to the callers */
 	if ((b = tty->buf.tail) != NULL) {
-		left = b->size - b->used;
-		b->active = 1;
+		if (!b->active) {
+			if (!b->used) {
+				left = b->size;
+				b->active = 1;
+			} else
+				left = 0;
+		} else
+			left = b->size - b->used;
 	} else
 		left = 0;
 


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux