[PATCH v5 0/3] Retry Large Buffer Allocations

Ben Gardiner bengardiner at nanometrics.ca
Mon Apr 11 08:40:07 EDT 2011


Hi Grant, Artem,

Thanks for this fix (again) :)

On Fri, Apr 8, 2011 at 11:51 AM, Grant Erickson <marathon96 at gmail.com> wrote:
> When handling user space read or write requests via mtd_{read,write}
> or JFFS2 medium scan requests, the operations can fail because the
> code backing these operations frequently requests large (128 KiB),
> contiguous blocks of memory using kmalloc.
>
> Under low-memory or highly-fragmented situations, particularly on
> embedded systems with no swap store, these allocations will frequently
> fail with -ENOMEM.
>
> This patch series adds a common function to handle these allocation
> requests in both the MTD driver and JFFS2 file system by exponentially
> backing off on the size of the requested kernel transfer buffer until
> it succeeds or until the requested transfer buffer size falls below
> the page size.
>
> This helps ensure the operation can succeed under low-memory,
> highly-fragmented situations albeit somewhat more slowly.
>
>  v2: Incorporated coding style and comment feedback from Artem.
>  v3: Incorporated more feedback from Artem. Retargeted patch against
>      l2-mtd-2.6.
>  v4: Incorporated feedback from Artem about compilation on 64-bit
>      architectures.
>  v5: Split the patch into a series.
>
> Signed-off-by: Grant Erickson <marathon96 at gmail.com>

I tested this on da850evm by cherry-picking commits:

8fa3c20 JFFS2: retry large buffer allocations
88ab142 mtd: mtdchar: retry large buffer allocations
99815a5 mtd: create function to perform large allocations

from
git://git.infradead.org/users/dedekind/l2-mtd-2.6.git

I have a memory hole @32M (bootargs: mem=32M at 0xc0000000
mem=64M at 0xc4000000) and I was also (like Bastian) getting "ubiformat:
page allocation failure" errors.  Cherry-picking these commits fixed the
problem for me; I was able to do 3x repeated ubiformats without error.

Tested-by: Ben Gardiner <bengardiner at nanometrics.ca>

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca



More information about the linux-mtd mailing list