Oliver Yang wrote:
Garrett D'Amore wrote:
Oliver Yang wrote:
Hi Guys,

If I use kmem_alloc to alloc a buffer less than 4K, can it ensure that buffer doesn't cross the page boundary(4k on x86)?

It probably won't cross a page boundary, but the DDI does not guarantee this.

If you want to provide guarantees like this, use ddi_dma_mem_alloc() with attributes that specify that page boundaries should not be crossed.

Yes, I knew. On the man page of kmem_alloc, it just ensures memory is at least double-word aligned, and no other guarantees.

But I really want to know whether current implementation of kmem_alloc or slab can guarantees this, if the request alloc size is less than 4k.
Since not only one guys told me, that is true.

I believe it is true, that the allocation will come from 4k slab, and you'll get nicely aligned pages. If this helps you for debug, then good. Do not write code that depends on it though.

   - Garrett

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to