malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread m silverstri
Hi, I am writing a kernel driver, can you please tell me how can I allocate a buffer which is 32 byte aligned? Thank you. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Re: malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread anish singh
On Tue, Jan 28, 2014 at 11:20 AM, m silverstri michael.j.silvers...@gmail.com wrote: Hi, I am writing a kernel driver, can you please tell me how can I allocate a buffer which is 32 byte aligned? malloc already aligns memory for basic data types AFAIK Thank you.

Re: malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread m silverstri
Thanks. How big should be my slab cache and how to allocate from that? And to declare a struct ' __attribute__(aligned(32))'', does that mean I do that for every file in my struct? On Tue, Jan 28, 2014 at 4:15 PM, valdis.kletni...@vt.edu wrote: On Tue, 28 Jan 2014 15:32:37 -0800, anish singh

Re: malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread Valdis . Kletnieks
On Tue, 28 Jan 2014 17:00:13 -0800, m silverstri said: Thanks. How big should be my slab cache and how to allocate from that? kmem_cache_alloc() and kmem_cache_free() are your friends. And to declare a struct ' __attribute__(aligned(32))'', does that mean I do that for every file in my