Messages in this thread | | | Date | Tue, 6 Mar 2001 00:06:52 +0000 | From | Kenn Humborg <> | Subject | Re: kmalloc() alignment |
| |
On Sun, Mar 04, 2001 at 11:41:12PM +0100, Manfred Spraul wrote: > > > > Does kmalloc() make any guarantees of the alignment of allocated > > blocks? Will the returned block always be 4-, 8- or 16-byte > > aligned, for example? > > > > 4-byte alignment is guaranteed on 32-bit cpus, 8-byte alignment on > 64-bit cpus.
So, to summarise (for 32-bit CPUs):
o Alan Cox & Manfred Spraul say 4-byte alignment is guaranteed.
o If you need larger alignment, you need to alloc a larger space, round as necessary, and keep the original pointer for kfree()
Maybe I'll just use get_free_pages, since it's a 64KB chunk that I need (and it's only a once-off).
Thanks for your advice.
Later, Kenn
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |