mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
tty: remove buffer special casing
Long long ago a 4K kmalloc allocated two pages so the tty layer used the page allocator, except on some machines where the page size was huge. This was removed from the core tty layer with the tty buffer re-implementation but not from tty_audit or the n_tty ldisc. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
aba6593bf7
commit
c481c707fe
2 changed files with 4 additions and 17 deletions
|
@ -76,19 +76,12 @@
|
||||||
static inline unsigned char *alloc_buf(void)
|
static inline unsigned char *alloc_buf(void)
|
||||||
{
|
{
|
||||||
gfp_t prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
|
gfp_t prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
|
||||||
|
return kmalloc(N_TTY_BUF_SIZE, prio);
|
||||||
if (PAGE_SIZE != N_TTY_BUF_SIZE)
|
|
||||||
return kmalloc(N_TTY_BUF_SIZE, prio);
|
|
||||||
else
|
|
||||||
return (unsigned char *)__get_free_page(prio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void free_buf(unsigned char *buf)
|
static inline void free_buf(unsigned char *buf)
|
||||||
{
|
{
|
||||||
if (PAGE_SIZE != N_TTY_BUF_SIZE)
|
kfree(buf);
|
||||||
kfree(buf);
|
|
||||||
else
|
|
||||||
free_page((unsigned long) buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
|
static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
|
||||||
|
|
|
@ -29,10 +29,7 @@ static struct tty_audit_buf *tty_audit_buf_alloc(int major, int minor,
|
||||||
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
|
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto err;
|
goto err;
|
||||||
if (PAGE_SIZE != N_TTY_BUF_SIZE)
|
buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
|
||||||
buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
|
|
||||||
else
|
|
||||||
buf->data = (unsigned char *)__get_free_page(GFP_KERNEL);
|
|
||||||
if (!buf->data)
|
if (!buf->data)
|
||||||
goto err_buf;
|
goto err_buf;
|
||||||
atomic_set(&buf->count, 1);
|
atomic_set(&buf->count, 1);
|
||||||
|
@ -52,10 +49,7 @@ err:
|
||||||
static void tty_audit_buf_free(struct tty_audit_buf *buf)
|
static void tty_audit_buf_free(struct tty_audit_buf *buf)
|
||||||
{
|
{
|
||||||
WARN_ON(buf->valid != 0);
|
WARN_ON(buf->valid != 0);
|
||||||
if (PAGE_SIZE != N_TTY_BUF_SIZE)
|
kfree(buf->data);
|
||||||
kfree(buf->data);
|
|
||||||
else
|
|
||||||
free_page((unsigned long)buf->data);
|
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue