回复:ubifs:Questions About Garbage Collection

辉少 wang502742203 at qq.com
Thu Jun 23 07:10:14 PDT 2016


Thank you for reply.
You said"the caller (where you measure the time) will be blocked
until GC produce some space", my question is that since GC thread has default priority, how can the caller be blocked without context switch when another thread is working in my embedded system? Does block happen as sychronizing function is always tring to synchronize data to flash until GC thread frees enough space in synchronised mode?
Many Thanks,
Andy

---原始邮件---
发件人: "Richard Weinberger"<richard.weinberger at gmail.com>
发送时间: 2016年6月19日 22:50:59
收件人: "辉少"<wang502742203 at qq.com>;
抄送: "linux-mtd"<linux-mtd at lists.infradead.org>;
主题: Re: ubifs:Questions About Garbage Collection

Hi!

On Sun, Jun 19, 2016 at 3:56 PM, 辉少 <wang502742203 at qq.com> wrote:
> Hi,MTD  lists
> I meet some problems while using UBI file system recently.I make an experiment in which I write 2 files(1KB each) to UBI frequently.Normally it takes only several millseconds to finish writting 2 files every time,but what puzzles me is that it takes about 4 minutes to write once nearly every 20 to 30 minutes.I am wondering how can this problem happen?Does Garbage Collection lead to this? I mount UBIFS to a 33MiB MTD partion with "o -sync" option.By the way,if UBI is mounted in asynchronous mode, this problem never happens. Does GC(Garbage Collecton) differ in synchronous mode andasynchronous mode?  What I've leared from some documents is that GC thread is sleeping while writting files without interval until UBIFS is full in synchronous mode and at that point writing will become very slow, but in asynchronous mode, before data is  moved into flash media, GC thread will work when there is not enough free space, am I right?

You observe the issue only in sync mode because every write is done
immediately and therefore the garbage collector needs to
produce empty space. This can take some time and as you are in sync
mode the caller (where you measure the time) will be blocked
until GC produce some space.
In asynchronous mode you will hardly notice since writing do the flash
will be done in a different thread by the write back mechanism.

-- 
Thanks,
//richard


More information about the linux-mtd mailing list