tty: Take a 256 byte padding into account when buffering below sub-page units
commit27f5d838191d05b6d8d6e96b3e1e9e1a75d54cad
authorMel Gorman <mel@csn.ul.ie>
Tue, 2 Mar 2010 22:24:19 +0000 (2 22:24 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 23:01:35 +0000 (1 16:01 -0700)
treea39aa5513d7fbd3c1bc03f4b4047049faf48b51b
parentf0e053b3b4ddba41d6b238f1e8eb57852e13f593
tty: Take a 256 byte padding into account when buffering below sub-page units

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