Slabs are generally allocated in range from 2^5 to 2^17 or something. So even if you ask for 10 bytes you will get object from 2^5 slab i.e 32 bytes. Objects allocated from slab are actually L1 CPU cache aligned for optimal hardware use (other space is used to coloring.) I am pretty sure that it has be to 4 or 8 bytes aligned because unaligned accesses are expensive and linux won't do that. Shailesh Jain On Sun, Jul 25, 2010 at 12:15 AM, vichy <vichy.kuo@xxxxxxxxx> wrote: > hi: > > 2010/7/25 shailesh jain <coolworldofshail@xxxxxxxxx>: >> Nope. kmalloc uses slab allocator underneath it. So, No addresses will >> not be 4k aligned. >> >> If you care about 4k aligned addresses you should use >> __get_free_page() rather than kmalloc(). >> kmalloc's are used for small allocations - think about wastage of >> memory if we try to place 4k alignment >> requirements. > thanks for your reply. > so you mean we will have no idea what the alignment of memory address > returned by kmalloc? > thank you, > vichy > -- Shailesh Jain -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ