linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: Olaf Hering <olh@suse.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] new tty buffering locking fix
Date: Tue, 07 Feb 2006 15:27:24 -0600	[thread overview]
Message-ID: <1139347644.3174.16.camel@amdx2.microgate.com> (raw)
In-Reply-To: <20060207171111.GA15912@suse.de>

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;
 



  parent reply	other threads:[~2006-02-07 21:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200602032312.k13NCbWb012991@hera.kernel.org>
2006-02-07 12:34 ` [PATCH] new tty buffering locking fix Olaf Hering
2006-02-07 16:21   ` Paul Fulghum
2006-02-07 17:11     ` Olaf Hering
2006-02-07 18:47       ` Paul Fulghum
2006-02-07 21:27       ` Paul Fulghum [this message]
2006-02-08  1:14         ` Alan Cox
2006-02-08  2:41           ` Paul Fulghum
2006-02-08  2:56             ` Paul Fulghum
2006-02-08 22:05           ` Paul Fulghum
2006-02-08 22:39             ` Olaf Hering
2006-01-26 20:33 Paul Fulghum

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=1139347644.3174.16.camel@amdx2.microgate.com \
    --to=paulkf@microgate.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olh@suse.de \
    /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).