UBI memory usage on large page nand

Nicholas ciliwung36 at gmail.com
Tue Apr 19 23:19:31 EDT 2011


Dear Artem,

Sorry for my late reply .

My modification :

build.c

#define MTD_SMALL_SIZE_PAGE_BLOCK_SIZE	0x40000 // block size for 2KB
page of nand flash which we set as an offset.

	if (ubi->peb_size > MTD_SMALL_SIZE_PAGE_BLOCK_SIZE)
		ubi->peb_buf1 = vmalloc(MTD_SMALL_SIZE_PAGE_BLOCK_SIZE);
	else
		ubi->peb_buf1 = vmalloc(ubi->peb_size);

	if (!ubi->peb_buf1)
		goto out_free;

  if (ubi->peb_size > MTD_SMALL_SIZE_PAGE_BLOCK_SIZE)
		ubi->peb_buf2 = vmalloc(MTD_SMALL_SIZE_PAGE_BLOCK_SIZE);
	else
		ubi->peb_buf2 = vmalloc(ubi->peb_size);

	if (!ubi->peb_buf2)
		goto out_free;

orphan.c
In ubifs_mount_orphans()
c->orph_buf = vmalloc((c->leb_size)/4); // for temporary

lpt.c
In lpt_init_wr()
c->lpt_buf = vmalloc((c->leb_size)/4); // for temporary

These modification can work properly, and reduce a lot of memory usage .

I also made modification on super.c in mount_ubifs(), seems more
complicated to handle sbuf & ileb_buf allocation. But i recovered them
to original code since it couldn't boot up properly.

Thanks in advance.

Alex

On Mon, Apr 18, 2011 at 4:39 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Mon, 2011-04-18 at 16:29 +0800, Nicholas wrote:
>> Dear Artem,
>>
>> If I reduce ubi->peb_buf1 and ubi->peb_buf2 with allocation of smaller
>> memory spaces, will they affect to IO ( read / write ) ?
>> Will it cause block data wasted ? Since buffer is allocated less than
>> block size .
>
> Yes,  please, make the buffers smaller. Yes, on some setups this will
> make I/O a bit slower. But I have some ideas how to deal with that.
> Please, do your changes, I'll take a look and then suggest how to
> improve that - but I first want to see how you will do a simple
> thing :-)
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>



More information about the linux-mtd mailing list