All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH tty-next 5/5] tty: Halve flip buffer GFP_ATOMIC memory consumption
Date: Sun, 8 Dec 2013 17:01:12 -0800	[thread overview]
Message-ID: <20131209010112.GA31052@kroah.com> (raw)
In-Reply-To: <1385140198-5822-6-git-send-email-peter@hurleysoftware.com>

On Fri, Nov 22, 2013 at 12:09:58PM -0500, Peter Hurley wrote:
> tty flip buffers use GFP_ATOMIC allocations for received data
> which is to be processed by the line discipline. For each byte
> received, an extra byte is used to indicate the error status of
> that byte.
> 
> Instead, if the received data is error-free, encode the entire
> buffer without status bytes.
> 
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> ---
>  drivers/tty/tty_buffer.c | 45 +++++++++++++++++++++++++++++++++++----------
>  include/linux/tty.h      |  4 ++++
>  include/linux/tty_flip.h |  8 ++++++--
>  3 files changed, 45 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> index 6a3620e..c4fe20e 100644
> --- a/drivers/tty/tty_buffer.c
> +++ b/drivers/tty/tty_buffer.c
> @@ -100,6 +100,7 @@ static void tty_buffer_reset(struct tty_buffer *p, size_t size)
>  	p->next = NULL;
>  	p->commit = 0;
>  	p->read = 0;
> +	p->flags = 0;
>  }
>  
>  /**
> @@ -230,31 +231,49 @@ void tty_buffer_flush(struct tty_struct *tty)
>   *	tty_buffer_request_room		-	grow tty buffer if needed
>   *	@tty: tty structure
>   *	@size: size desired
> + *	@flags: buffer flags if new buffer allocated (default = 0)
>   *
>   *	Make at least size bytes of linear space available for the tty
>   *	buffer. If we fail return the size we managed to find.
> + *
> + *	Will change over to a new buffer if the current buffer is encoded as
> + *	TTY_NORMAL (so has no flags buffer) and the new buffer requires
> + *	a flags buffer.
>   */
> -int tty_buffer_request_room(struct tty_port *port, size_t size)
> +int __tty_buffer_request_room(struct tty_port *port, size_t size, int flags)
>  {
>  	struct tty_bufhead *buf = &port->buf;
>  	struct tty_buffer *b, *n;
> -	int left;
> +	int left, change;
>  
>  	b = buf->tail;
> -	left = b->size - b->used;
> +	if (b->flags & TTYB_NORMAL)
> +		left = 2 * b->size - b->used;
> +	else
> +		left = b->size - b->used;
>  
> -	if (left < size) {
> +	change = (b->flags & TTYB_NORMAL) && (~flags & TTYB_NORMAL);
> +	if (change || left < size) {
>  		/* This is the slow path - looking for new buffers to use */
>  		if ((n = tty_buffer_alloc(port, size)) != NULL) {
> +			n->flags = flags;
>  			buf->tail = n;
>  			b->commit = b->used;
>  			smp_mb();
>  			b->next = n;
> -		} else
> +		} else if (change)
> +			size = 0;
> +		else
>  			size = left;
>  	}
>  	return size;
>  }
> +EXPORT_SYMBOL_GPL(__tty_buffer_request_room);

Why are you exporting this?  There is no function prototype anywhere, so
no one can even try to call it, it should just be static, right?

I've applied the first 4 patches in this series, care to fix this one
up?

thanks,

greg k-h

  reply	other threads:[~2013-12-09  1:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 17:09 [PATCH tty-next 0/5] Halve tty buffer memory consumption Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 1/5] tty: Always handle NULL flag ptr Peter Hurley
2013-11-22 22:20   ` Dmitry Torokhov
2013-11-26  2:00     ` Peter Hurley
2013-12-02 18:56     ` [PATCH v2 " Peter Hurley
2013-12-02 19:09       ` Dmitry Torokhov
2013-11-22 17:09 ` [PATCH tty-next 2/5] tty: Enable configurable tty flip buffer limit Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 3/5] tty: Rename tty buffer memory_used field Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 4/5] tty: Remove tty_prepare_flip_string_flags() Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 5/5] tty: Halve flip buffer GFP_ATOMIC memory consumption Peter Hurley
2013-12-09  1:01   ` Greg Kroah-Hartman [this message]
2013-12-09 13:27     ` Peter Hurley
2013-12-09 14:23     ` [PATCH tty-next v3 " Peter Hurley

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=20131209010112.GA31052@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    /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.