Re: preferred way of allocating a (fairly large) struct

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

 



On Sun, Feb 13, 2005 at 02:59:34PM -0500, Athul Acharya hit keys to express the following:
> Hey folks,
> 
> Next question: What's the preferred way of allocating a (fairly large)
what do you mean by fairly large?
> struct? Is it acceptable to just declare a struct foo bar; and have it
2.6.x has only 4kB kernel stack. So `fairly large` may or may not fit.
> on the stack?  Or should i explicitly allocate space with __kmalloc()?
allocating with kmalloc should be fine. Why do you want to use __kmalloc?
> Or perhaps something else entirely?
If you are considering a pool of structs, you can try kmem_cache_alloc to create
one.
HTH,
Om.
-- 
Memory should be the starting point of the present.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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