UBI memory usage on large page nand

Nicholas ciliwung36 at gmail.com
Fri Apr 15 05:23:52 EDT 2011


Dear Artem,

Thanks for the information. Indeed it has flexibility to be freed or consumed.
Due to my case, i need to use maximum memory space while in the
meantime i also need to write files into nand via ubi.
8KB page of nand flash will consume 16MB for a single volume on a
single UBI MTD.

1. Is there any idea to reduce the memory consumption ?
2. For smaller buffer allocation, can it be made for several attempts
of read / write ?

Regards,
Alex

On Fri, Apr 1, 2011 at 11:31 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> Hi,
>
> I agree UBI/UBIFS uses more memory than it could. There is some room for
> optimizations.
>
> On Thu, 2011-03-31 at 11:07 +0800, Nicholas wrote:
>> Hi there,
>>
>> I've a short of memory usage issue while using large page size of nand flash.
>> Before, i was using 2KB page size of nand flash, i found UBI/UBIFS memory
>> consumption on normal zone are :
>>
>> 7 0xC0180858:   1024K, ubi_attach_mtd_de,
>> 8 0xC0180834:   1024K, ubi_attach_mtd_de,
>> 9 0xC00ED300:   1008K,      ubifs_get_sb,
>> 10 0xC00ED31C:   1008K,      ubifs_get_sb,
>> 11 0xC00FE7EC:   1008K,    ubifs_lpt_init,
>> 11 0xC00F95AC:   1008K, ubifs_mount_orpha,
>>
>> Then, i'm using 8KB page size of nand flash, and found the result as below :
>> 4 0xC0180858:   4096K, ubi_attach_mtd_de,
>> 5 0xC0180834:   4096K, ubi_attach_mtd_de,
>> 6 0xC00FE7EC:   4064K,    ubifs_lpt_init,
>> 7 0xC00ED31C:   4064K,      ubifs_get_sb,
>> 8 0xC00F95AC:   4064K, ubifs_mount_orpha,
>> 9 0xC00ED300:   4064K,      ubifs_get_sb,
>>
>> My environment contains 2 mtd partitions for UBI.
>>
>> Before, it took 6MB of memory consumption and now it takes 24MB.
>> Do you have any suggestion how to reduce the memory consumption since dram size
>> is pretty limited for other usage.
>
> I think this is mainly because your eraseblock size became larger. UBI
> and UBIFS allocate many buffers of eraseblock size for various purposes.
> The buffers are often allocated once on attach/mount and released only
> on detach/unmount. All of these buffers are allocated with vmalloc()
> call, so you can find them by grepping.
>
> The simplest thing you can try is to allocate these buffers when they
> are actually needed, and then free them when they are not needed. This
> should help.
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>



More information about the linux-mtd mailing list