Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185206
b: refs/heads/master
c: d9661ad
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent f036547 commit f434d05
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4165fe4ef7305609a96c7f248cefb9c414d0ede5
refs/heads/master: d9661adfb8e53a7647360140af3b92284cbe52d4
6 changes: 4 additions & 2 deletions trunk/drivers/char/tty_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
10 changes: 10 additions & 0 deletions trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f434d05

Please sign in to comment.