]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.33 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 29 Mar 2010 19:58:19 +0000 (12:58 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 29 Mar 2010 19:58:19 +0000 (12:58 -0700)
queue-2.6.33/series
queue-2.6.33/tty-keep-the-default-buffering-to-sub-page-units.patch [new file with mode: 0644]
queue-2.6.33/tty-take-a-256-byte-padding-into-account-when-buffering-below-sub-page-units.patch [new file with mode: 0644]

index f0046f7ee21403115f681abe6320cde640dd55ea..e0ae837cfe900031852bc1ca0086d7df879fc034 100644 (file)
@@ -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 (file)
index 0000000..c917d56
--- /dev/null
@@ -0,0 +1,66 @@
+From d9661adfb8e53a7647360140af3b92284cbe52d4 Mon Sep 17 00:00:00 2001
+From: Alan Cox <alan@linux.intel.com>
+Date: Thu, 18 Feb 2010 16:43:47 +0000
+Subject: tty: Keep the default buffering to sub-page units
+
+From: Alan Cox <alan@linux.intel.com>
+
+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 <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(-)
+
+--- 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 (file)
index 0000000..2d5a5ab
--- /dev/null
@@ -0,0 +1,47 @@
+From 352fa6ad16b89f8ffd1a93b4419b1a8f2259feab Mon Sep 17 00:00:00 2001
+From: Mel Gorman <mel@csn.ul.ie>
+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 <mel@csn.ul.ie>
+
+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 <mel@csn.ul.ie>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ 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 {