Re: [Intel-IOMMU 06/10] Intel IOMMU driver

From: Christoph Lameter
Date: Fri Jun 08 2007 - 18:30:55 EST


On Thu, 7 Jun 2007, Andrew Morton wrote:

> > +void *iommu_rpool_alloc(unsigned int size, gfp_t flag)
> > +{
> > + if (size == PAGE_SIZE_4K)
> > + return(void *)get_zeroed_page(flag);
> > + else
> > + return kzalloc(size, flag);
> > +}
>
> kmalloc(4k) is pretty efficient and (I think) is guaranteed to return a
> page-aligned address.

Page allocations should be done through the page allocator. 4k
allocations benefit from the per cpu caches of the page allocator which
makes the use of the page allocator fastest and best for 4k allocs.

kmalloc allocations are not guaranteed to be aligned to 4k boundaries.
They usually are but ...


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/