Re: [PATCH] alloc_tty_struct() wastage?

Russell King (rmk@arm.linux.org.uk)
Fri, 2 Mar 2001 23:37:26 +0000 (GMT)


Hugh Dickins writes:
> I've been puzzling over alloc_tty_struct(), which seems determined
> to waste memory on a machine of page size 8KB.

Maybe you could change the ">" to ">="?

> I've come to the conclusion that it represents great caution on
> Russell's part when introducing ARM, not to interfere with
> existing code of other architectures - is that so, Russell?

My understanding of the usage of get_free_page there is as follows:
The problem was that sizeof(struct tty_struct) was very close to
the page size of x86 machines (4K), and kmalloc wasted space
unnecessarily. Therefore get_free_page was used by x86 to allocate
this structure. I think I'm right in saying that allocating
anything larger than half your page size is best done with
get_free_page.

Someone will probably correct me on that comment above though.
Can someone confirm please: is it safe and reasonable to use
kmalloc on allocating tty_struct on all architectures now?

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/