2000-11-23 19:23:26

by Tigran Aivazian

[permalink] [raw]
Subject: alloc_tty_struct() question.

Hi,

The sizeof(struct tty_struct) = 3084. Why don't we have a private slab
cache for it instead of getting a page and wasting some precious bytes at
the end? Potentially, we can have thousands of tty_struct allocated
(assuming we have thousands of concurrent users)...

regards,
Tigran


2000-11-23 19:32:46

by Matti Aarnio

[permalink] [raw]
Subject: Re: alloc_tty_struct() question.

On Thu, Nov 23, 2000 at 06:54:48PM +0000, Tigran Aivazian wrote:
> Hi,
>
> The sizeof(struct tty_struct) = 3084. Why don't we have a private slab
> cache for it instead of getting a page and wasting some precious bytes at
> the end? Potentially, we can have thousands of tty_struct allocated
> (assuming we have thousands of concurrent users)...

Potentially thousands, in practice some 10-30.
Wastage will be worse with 8k pages, of course.

> regards,
> Tigran

2000-11-23 20:25:38

by Andi Kleen

[permalink] [raw]
Subject: Re: alloc_tty_struct() question.

On Thu, Nov 23, 2000 at 06:54:48PM +0000, Tigran Aivazian wrote:
> Hi,
>
> The sizeof(struct tty_struct) = 3084. Why don't we have a private slab
> cache for it instead of getting a page and wasting some precious bytes at
> the end? Potentially, we can have thousands of tty_struct allocated
> (assuming we have thousands of concurrent users)...

A slab cache could only save significant memory if it allocated in
order 2 slabs (order 1 would waste exactly the same memory because
you only had a ~2K gap) Order 2 is nasty and unreliable.


-Andi