diff options
author | Mel Gorman <mel@csn.ul.ie> | 2010-03-02 17:24:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-19 10:17:53 -0400 |
commit | 352fa6ad16b89f8ffd1a93b4419b1a8f2259feab (patch) | |
tree | b08df3f006762cc213543f2ccd1095f2d9afab52 /include | |
parent | 87a6aca504d65f242589583e04df5e74b5eae1fe (diff) |
tty: Take a 256 byte padding into account when buffering below sub-page units
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>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tty.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 568369a86306..593228a520e1 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -70,12 +70,13 @@ struct tty_buffer { | |||
70 | 70 | ||
71 | /* | 71 | /* |
72 | * We default to dicing tty buffer allocations to this many characters | 72 | * We default to dicing tty buffer allocations to this many characters |
73 | * in order to avoid multiple page allocations. We assume tty_buffer itself | 73 | * in order to avoid multiple page allocations. We know the size of |
74 | * is under 256 bytes. See tty_buffer_find for the allocation logic this | 74 | * tty_buffer itself but it must also be taken into account that the |
75 | * must match | 75 | * the buffer is 256 byte aligned. See tty_buffer_find for the allocation |
76 | * logic this must match | ||
76 | */ | 77 | */ |
77 | 78 | ||
78 | #define TTY_BUFFER_PAGE ((PAGE_SIZE - 256) / 2) | 79 | #define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) |
79 | 80 | ||
80 | 81 | ||
81 | struct tty_bufhead { | 82 | struct tty_bufhead { |