Re: [PATCH] generic device DMA (dma_pool update)

James Bottomley
2002-12-31T17:15:07Z

david-b@pacbell.net said:
> The same is true of the slab code, which is a better allocator. Why
> should kernels require an extra allocator, when pci_pool can safely be
> eliminated on quite a few systems?

I agree in principle. But the way to get this to work is to allow the slab
allocater to specify its getpages and freepages in the same way as ctor and
dtor, so it can be fed by dma_alloc_coherent. Then you can wrapper the slab
allocator to be used across all platforms (rather than only those which are
coherent and have no IOMMU).

The benefit mempool has over slab is its guaranteed minimum pool size and
hence guaranteed non-failing allocations as long as you manage pool resizing
correctly. I suppose this is primarily useful for storage devices, which
sometimes need memory that cannot be obtained from doing I/O.

However, you can base mempool off slab modified to use dma_alloc_coherent()
and get the benefits of everything.

James