[PATCH (mtd-utils)] mtd_write: fall back to old method on ENOMEM

Voss, Nikolaus N.Voss at weinmann.de
Mon Apr 23 03:43:08 EDT 2012


Brian Norris wrote on 2012-04-23:
> On Sun, Apr 22, 2012 at 10:45 PM, Voss, Nikolaus <N.Voss at weinmann.de> wrote:
>> MEMWRITE ioctl tries to kmalloc the whole data. With usual
>> eraseblock sizes of 128 KiB, on memory constrained systems
>> this can easily lead to ENOMEM due to memory fragmentation
>> even if there are plenty of free pages left e.g.:
>> 
>> --------------------------------------------------------------
>> 
>> libmtd: error!: MEMWRITE ioctl failed for eraseblock 55 (mtd6)
>>        error 12 (Cannot allocate memory)
>> ubiformat: error!: cannot write eraseblock 55
>>           error 12 (Cannot allocate memory)
> 
> What version of mtd-utils are using? I don't think ubiformat should be
> utilizing the MEMWRITE codepath anymore, since commit 71c76e7.

I used the latest release, 1.4.9. Commit 71c76e7 fixes my ubiformat
issue, thanks for hint.

[...]
> the "fall back" is because this ioctl doesn't exist on
> older kernels. If MEMWRITE is causing real problems for the intended
> use case (writing page data + OOB), then userspace or kernel-space
> should be tweaked. But it's really not a problem AFAIK, since it's
> real use is for page-at-a-time (data+OOB) writes from tools like
> nandwrite.

Ok, I see your point, thanks for the explanation. I agree completely.

Niko





More information about the linux-mtd mailing list