On 08/10/2007 10:42 AM, Andrea Gasparini wrote:
i have a structure that could grow while time goes on.
rather that have a biiig static structure, we want to make it possible
allocate it in block in order to don't make kmalloc call each single time,
but don't make it to big if requests are a few.
we have a code like that:
too_little_mystruct = mystruct;
mystruct =kmalloc(bunch_of_struct * sizeof(struct
mystruct_type),GFP_KERNEL);
memcpy(mystruct,too_little_mystruct,oldsize *sizeof(struct
mystruct_type));
kfree(old_head);
but i think it could lead to waste of memory, or fragmentation. or at least
it cuold be better have a single growing area.
Are there some support for this kind of allocation inside the kernel?
It could be enough using kmalloc and kfree?
whatever?
krealloc() was recently merged, but using a linked list of mystruct_type's
is the normal answer.
Rene.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ