From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Alan Cox <alan@linux.intel.com>, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 33/36] tty: Keep the default buffering to sub-page units
Date: Tue, 2 Mar 2010 15:36:40 -0800 [thread overview]
Message-ID: <1267573003-782-33-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20100302230956.GC32287@kroah.com>
From: Alan Cox <alan@linux.intel.com>
We allocate during interrupts so while our buffering is normally diced up
small anyway on some hardware at speed we can pressure the VM excessively
for page pairs. We don't really need big buffers to be linear so don't try
so hard.
In order to make this work well we will tidy up excess callers to request_room,
which cannot itself enforce this break up.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/tty_buffer.c | 6 ++++--
include/linux/tty.h | 10 ++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
index 66fa4e1..f27c4d6 100644
--- a/drivers/char/tty_buffer.c
+++ b/drivers/char/tty_buffer.c
@@ -247,7 +247,8 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars,
{
int copied = 0;
do {
- int space = tty_buffer_request_room(tty, size - copied);
+ int goal = min(size - copied, TTY_BUFFER_PAGE);
+ int space = tty_buffer_request_room(tty, goal);
struct tty_buffer *tb = tty->buf.tail;
/* If there is no space then tb may be NULL */
if (unlikely(space == 0))
@@ -283,7 +284,8 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
{
int copied = 0;
do {
- int space = tty_buffer_request_room(tty, size - copied);
+ int goal = min(size - copied, TTY_BUFFER_PAGE);
+ int space = tty_buffer_request_room(tty, goal);
struct tty_buffer *tb = tty->buf.tail;
/* If there is no space then tb may be NULL */
if (unlikely(space == 0))
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 6abfcf5..d96e588 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -68,6 +68,16 @@ struct tty_buffer {
unsigned long data[0];
};
+/*
+ * We default to dicing tty buffer allocations to this many characters
+ * in order to avoid multiple page allocations. We assume tty_buffer itself
+ * is under 256 bytes. See tty_buffer_find for the allocation logic this
+ * must match
+ */
+
+#define TTY_BUFFER_PAGE ((PAGE_SIZE - 256) / 2)
+
+
struct tty_bufhead {
struct delayed_work work;
spinlock_t lock;
--
1.7.0.1
next prev parent reply other threads:[~2010-03-02 23:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 23:09 [GIT PATCH] TTY patches for 2.6.33-git Greg KH
2010-03-02 23:36 ` [PATCH 01/36] serial: fit blackfin uart over sport driver into common uart infrastructure Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 02/36] serial: copy UART properties of UPF_FIXED_TYPE ports provisioned using early_serial_setup Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 03/36] serial: 68328serial.c: remove BAUD_TABLE_SIZE macro Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 04/36] serial: atmel_serial: add poll_get_char and poll_put_char uart_ops Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 05/36] serial: synclink_gt: dropped transmit data bugfix Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 06/36] serial: 8250_pci: add support for MCS9865 / SYBA 6x Serial Port Card Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 07/36] serial: imx: fix NULL dereference Oops when pdata == NULL Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 08/36] serial: add support for Korenix JetCard Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 09/36] serial: fix test of unsigned Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 10/36] serial: Char: cyclades, fix compiler warning Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 11/36] serial: cyclades: allow overriding ISA defaults also when the driver is built-in Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 12/36] tty: char: mxser, remove unnecessary tty test Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 13/36] serial: isicom.c: use pr_fmt and pr_<level> Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 14/36] hvc_console: fix test on unsigned in hvc_console_print() Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 15/36] tty: moxa: remove #ifdef MODULE completely Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 16/36] ip2: remove #ifdef MODULE from ip2main.c Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 17/36] ip2: Add module parameter Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 18/36] tty: declare MODULE_FIRMWARE in various drivers Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 19/36] Char: synclink, remove unnecessary checks Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 20/36] serial: bfin_5xx: remove useless gpio handling with hard flow control Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 21/36] serial: bfin_5xx: need to disable DMA TX interrupt too Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 22/36] serial: bfin_5xx: kgdboc should accept gdb break only when it is active Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 23/36] serial: bfin_5xx: pull in linux/io.h for ioremap prototypes Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 24/36] serial: bcm63xx_uart: don't use kfree() on non kmalloced area Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 25/36] serial: bcm63xx_uart: allow more than one uart to be registered Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 26/36] sdio_uart: Use kfifo instead of the messy circ stuff Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 27/36] nozomi: Add tty_port usage Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 28/36] nozomi: Fix mutex handling Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 29/36] nozomi: Tidy up the PCI table Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 30/36] serial: timberdale: Remove dependancies Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 31/36] tty: Fix the ldisc hangup race Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 32/36] tty: Fix up char drivers request_room usage Greg Kroah-Hartman
2010-03-02 23:36 ` Greg Kroah-Hartman [this message]
2010-03-02 23:36 ` [PATCH 34/36] tty: Add a new VT mode which is like VT_PROCESS but doesn't require a VT_RELDISP ioctl call Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 35/36] jsm: removing the uart structure and filename on error Greg Kroah-Hartman
2010-03-02 23:36 ` [PATCH 36/36] jsm: fixing error if the driver fails to load Greg Kroah-Hartman
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=1267573003-782-33-git-send-email-gregkh@suse.de \
--to=gregkh@suse.de \
--cc=alan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
/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