[PATCH 07/11] fsmc/nand: Provide contiguous buffers to dma
computersforpeace at gmail.com
Mon Oct 15 12:27:53 EDT 2012
On Mon, Oct 15, 2012 at 6:18 AM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> First thing which comes to mind is that in modern kernels memory
> fragmentation is not that big issue as it used to be. So may be
> kmalloc() the memory is not that bad nowadays? We have page migration,
> memory compaction, etc?
> I'd really prefer to just switch to kmalloc() everywhere instead of
> adding hacks like this to the drivers. Then if this is a problem for
> someone, he can fix it by either switching to smaller buffers (possible
> in many places), or by improving memory fragmentation issues on his
> system, or by just using CMA.
I think I can suggest that this is already a problem on real systems.
In bringing up a board on v3.3 kernel, I experienced a kernel memory
allocation error when trying to memdup_user() in eraseblock-size
regions. I believe I would experience more of these if all
eraseblock-sized buffers were kmalloc()'d.
See the commit description for the following commit in mtd-utils.git:
libmtd: fix mtd_write() issues for large data-only writes
> We can even have an mtd-wide funcion which will try kmalloc(), and if
> that fails, fall-back to CMA.
I would prefer not building a solution that hopes kmalloc() can get a
large contiguous buffer (remember, eraseblock sizes come as large as
2MB these days). A real solution like CMA or scatter-gather seems like
a better idea.
More information about the linux-arm-kernel