Re: [PATCH 2/4] mm: cma: Contiguous Memory Allocator added

From: FUJITA Tomonori
Date: Thu Jul 22 2010 - 01:38:17 EST


On Tue, 20 Jul 2010 18:12:39 -0600
Jonathan Corbet <corbet@xxxxxxx> wrote:

> One other thing occurred to me as I was thinking about this...
>
> > + There are four calls provided by the CMA framework to devices. To
> > + allocate a chunk of memory cma_alloc() function needs to be used:
> > +
> > + unsigned long cma_alloc(const struct device *dev,
> > + const char *kind,
> > + unsigned long size,
> > + unsigned long alignment);
>
> The purpose behind this interface, I believe, is pretty much always
> going to be to allocate memory for DMA buffers. Given that, might it
> make more sense to integrate the API with the current DMA mapping
> API?

IMO, having separate APIs for allocating memory and doing DMA mapping
is much better. The DMA API covers the latter well. We could extend
the current API to allocate memory or create new one similar to the
current.

I don't see any benefit of a new abstraction that does both magically.


About the framework, it looks too complicated than we actually need
(the command line stuff looks insane).

Why can't we have something simpler, like using memblock to reserve
contiguous memory at boot and using kinda mempool to share such memory
between devices?
--
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/