From: Greg Kroah-Hartman Date: Mon, 29 Mar 2010 19:58:19 +0000 (-0700) Subject: .33 patches X-Git-Tag: v2.6.27.46~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ebdd38692c829679f629ef56aca29108b03aabc;p=thirdparty%2Fkernel%2Fstable-queue.git .33 patches --- diff --git a/queue-2.6.33/series b/queue-2.6.33/series index f0046f7ee21..e0ae837cfe9 100644 --- a/queue-2.6.33/series +++ b/queue-2.6.33/series @@ -63,3 +63,5 @@ nfs-prevent-another-deadlock-in-nfs_release_page.patch revert-sunrpc-fix-peername-failed-on-closed-listener.patch revert-sunrpc-move-the-close-processing-after-do-recvfrom-method.patch nfsd-ensure-sockets-are-closed-on-error.patch +tty-keep-the-default-buffering-to-sub-page-units.patch +tty-take-a-256-byte-padding-into-account-when-buffering-below-sub-page-units.patch diff --git a/queue-2.6.33/tty-keep-the-default-buffering-to-sub-page-units.patch b/queue-2.6.33/tty-keep-the-default-buffering-to-sub-page-units.patch new file mode 100644 index 00000000000..c917d56cf73 --- /dev/null +++ b/queue-2.6.33/tty-keep-the-default-buffering-to-sub-page-units.patch @@ -0,0 +1,66 @@ +From d9661adfb8e53a7647360140af3b92284cbe52d4 Mon Sep 17 00:00:00 2001 +From: Alan Cox +Date: Thu, 18 Feb 2010 16:43:47 +0000 +Subject: tty: Keep the default buffering to sub-page units + +From: Alan Cox + +commit d9661adfb8e53a7647360140af3b92284cbe52d4 upstream. + +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 +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/tty_buffer.c | 6 ++++-- + include/linux/tty.h | 10 ++++++++++ + 2 files changed, 14 insertions(+), 2 deletions(-) + +--- a/drivers/char/tty_buffer.c ++++ b/drivers/char/tty_buffer.c +@@ -247,7 +247,8 @@ int tty_insert_flip_string(struct tty_st + { + 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 + { + 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)) +--- 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; diff --git a/queue-2.6.33/tty-take-a-256-byte-padding-into-account-when-buffering-below-sub-page-units.patch b/queue-2.6.33/tty-take-a-256-byte-padding-into-account-when-buffering-below-sub-page-units.patch new file mode 100644 index 00000000000..2d5a5abbb77 --- /dev/null +++ b/queue-2.6.33/tty-take-a-256-byte-padding-into-account-when-buffering-below-sub-page-units.patch @@ -0,0 +1,47 @@ +From 352fa6ad16b89f8ffd1a93b4419b1a8f2259feab Mon Sep 17 00:00:00 2001 +From: Mel Gorman +Date: Tue, 2 Mar 2010 22:24:19 +0000 +Subject: tty: Take a 256 byte padding into account when buffering below sub-page units + +From: Mel Gorman + +commit 352fa6ad16b89f8ffd1a93b4419b1a8f2259feab upstream. + +The TTY layer takes some care to ensure that only sub-page allocations +are made with interrupts disabled. It does this by setting a goal of +"TTY_BUFFER_PAGE" to allocate. Unfortunately, while TTY_BUFFER_PAGE takes the +size of tty_buffer into account, it fails to account that tty_buffer_find() +rounds the buffer size out to the next 256 byte boundary before adding on +the size of the tty_buffer. + +This patch adjusts the TTY_BUFFER_PAGE calculation to take into account the +size of the tty_buffer and the padding. Once applied, tty_buffer_alloc() +should not require high-order allocations. + +Signed-off-by: Mel Gorman +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/tty.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/include/linux/tty.h ++++ b/include/linux/tty.h +@@ -70,12 +70,13 @@ struct tty_buffer { + + /* + * 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 ++ * in order to avoid multiple page allocations. We know the size of ++ * tty_buffer itself but it must also be taken into account that the ++ * the buffer is 256 byte aligned. See tty_buffer_find for the allocation ++ * logic this must match + */ + +-#define TTY_BUFFER_PAGE ((PAGE_SIZE - 256) / 2) ++#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) + + + struct tty_bufhead {