[patch 02/13] jffs2 summary allocation: don't use vmalloc()

David Brownell david-b at pacbell.net
Thu Jul 31 02:57:52 EDT 2008


On Wednesday 30 July 2008, Artem Bityutskiy wrote:
> Can SPI driver detect if the memory was kmalloc()'ed or vmalloc()'ed?

The general driver policy is to use one or the other and never mix
them.  Pretty much like always calling with a lock held, or never;
or always calling in contexts that can sleep, etc.  (kmalloc and
siblings being an exception, with gfp_t.)

For clarity:  the stack in question is like

	jffs2, ubifs, etc
	mtd_dataflash or m25p80
	spi_master (generally SOC-specific) sometimes using DMA
	... talking to flash chip using 4 wire signaling ...

Inputs to the SPI stack are required to be DMA-safe -- vmalloc bad.
Not all the SPI controllers support DMA either.

Inputs to the MTD layer have previously been unspecified, but now seem
to be assumed to be DMA-unsafe -- vmalloc ok.


> Or if not, we could add one more argument to read()/write() which tells
> whether the memory is contiguous or not. Then the driver would chose how
> to deal with the buffer.

Is updating all the MTD users in such a way a real possibility?

- Dave
 





More information about the linux-mtd mailing list