kmalloc issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
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?

thanks.
-- 
-gaspa-
-----------------------------------------------
--------- Powered by Debian GNU/Linux ---------
------ HomePage: iogaspa.altervista.org -------
-Il lunedi'dell'arrampicatore: www.lunedi.org -

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux