* ubifs:Questions About Garbage Collection
@ 2016-06-19 13:56 =?gb18030?B?u9TJ2Q==?=
2016-06-19 14:50 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: =?gb18030?B?u9TJ2Q==?= @ 2016-06-19 13:56 UTC (permalink / raw)
To: =?gb18030?B?bGludXgtbXRk?=
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 980 bytes --]
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?
Many Thanks,
Best Regards.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ubifs:Questions About Garbage Collection
2016-06-19 13:56 ubifs:Questions About Garbage Collection =?gb18030?B?u9TJ2Q==?=
@ 2016-06-19 14:50 ` Richard Weinberger
[not found] ` <tencent_7ADEA65732A2B069166D1A41@qq.com>
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2016-06-19 14:50 UTC (permalink / raw)
To: 辉少; +Cc: linux-mtd
Hi!
On Sun, Jun 19, 2016 at 3:56 PM, 辉少 <wang502742203@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 回复:ubifs:Questions About Garbage Collection
[not found] ` <tencent_7ADEA65732A2B069166D1A41@qq.com>
@ 2016-06-19 17:05 ` Richard Weinberger
[not found] ` <CAOMqctT4Ftef-TTX+cC9HK5Fg4TTe9MDodGbSrJDBmsKBj_NWA@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2016-06-19 17:05 UTC (permalink / raw)
To: 辉少, linux-mtd@lists.infradead.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 2691 bytes --]
Am 19.06.2016 um 18:14 schrieb »ÔÉÙ:
> Thanks for your kind reply£¡Do you mean that in synchronous/asynchronous mode GC is also finished in synchronous
> /asynchronous way as writting is? A more question is£¬are all dirty spaces collected in the same time in synchronous mode(at this point the caller will be blocked for a long time) while in asynchronous mode dirty spaces will be collected little by little in asynchronous mode when i do not notice£¿Thank you£¡
Hmm, I don't fully understand your first question, can you elaborate?
As for dirty space, GC will not collect all dirty space. UBIFS tells GC how much free space an operation
will take. UBIFS calls this budget. The GC will try to produce as much free space as needed.
Thanks,
//richard
> ---ÔʼÓʼþ---
> *·¢¼þÈË:* "Richard Weinberger"<richard.weinberger@gmail.com>
> *·¢ËÍʱ¼ä:* 2016Äê6ÔÂ19ÈÕ 22:51:43
> *ÊÕ¼þÈË:* "»ÔÉÙ"<wang502742203@qq.com>;
> *³ËÍ:* "linux-mtd"<linux-mtd@lists.infradead.org>;
> *Ö÷Ìâ:* Re: ubifs:Questions About Garbage Collection
>
> Hi!
>
> On Sun, Jun 19, 2016 at 3:56 PM, »ÔÉÙ <wang502742203@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
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 回复:ubifs:Questions About Garbage Collection
[not found] ` <CAOMqctT4Ftef-TTX+cC9HK5Fg4TTe9MDodGbSrJDBmsKBj_NWA@mail.gmail.com>
@ 2016-06-23 17:34 ` Richard Weinberger
[not found] ` <CAOMqctTpTsTHd8tbVeA+X8bR0KQ77mufw4koDtwZV7rFquQ5xw@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2016-06-23 17:34 UTC (permalink / raw)
To: Michal Suchanek; +Cc: 辉少, linux-mtd@lists.infradead.org
Am 23.06.2016 um 19:20 schrieb Michal Suchanek:
> Hello,
>
> On 19 June 2016 at 19:05, Richard Weinberger <richard@nod.at> wrote:
>> Am 19.06.2016 um 18:14 schrieb 辉少:
>>> Thanks for your kind reply!Do you mean that in synchronous/asynchronous mode GC is also finished in synchronous
>>> /asynchronous way as writting is? A more question is,are all dirty spaces collected in the same time in synchronous mode(at this point the caller will be blocked for a long time) while in asynchronous mode dirty spaces will be collected little by little in asynchronous mode when i do not notice?Thank you!
>>
>> Hmm, I don't fully understand your first question, can you elaborate?
>> As for dirty space, GC will not collect all dirty space. UBIFS tells GC how much free space an operation
>> will take. UBIFS calls this budget. The GC will try to produce as much free space as needed.
>>
>
> I guess the issue here is that UBIFS appears to do this
>
> 1) write files while there is space
> 2) when space is 0 perform a GC run as part of write operation
>
> when writes are synchronous the GC run is timed as part of the write.
Exactly. :-)
> If GC was asynchronous it would not appear as part of the synchronous
> write operation and would not cause as much write time jitter. When
> mounting a filesystem synchronous having GC synchronous is likely not
> what the user asked for. It's part of the internal fs bookkeeping and
> not part of the operation the user wants to perform synchronously.
>
> For GC to run asynchronously it would have to start before the
> available space is 0 so writes can still happen.
How would the GC know how much space you need in future?
Sure, we would run the GC every X seconds/minutes/whatever but then the flash will wear out
faster since GC will always run and not only when you really need space.
> Is it possible to set a parameter somewhere that would make UBIFS do this?
Do we really need this? If your application behaves
correctly there is no need to mount the filesystem synchronous.
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 回复:ubifs:Questions About Garbage Collection
[not found] ` <CAOMqctTpTsTHd8tbVeA+X8bR0KQ77mufw4koDtwZV7rFquQ5xw@mail.gmail.com>
@ 2016-06-23 19:18 ` Richard Weinberger
0 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2016-06-23 19:18 UTC (permalink / raw)
To: Michal Suchanek; +Cc: 辉少, linux-mtd@lists.infradead.org
Am 23.06.2016 um 19:55 schrieb Michal Suchanek:
> On 23 June 2016 at 19:34, Richard Weinberger <richard@nod.at> wrote:
>> Am 23.06.2016 um 19:20 schrieb Michal Suchanek:
>>> Hello,
>>>
>>> On 19 June 2016 at 19:05, Richard Weinberger <richard@nod.at> wrote:
>>>> Am 19.06.2016 um 18:14 schrieb 辉少:
>>>>> Thanks for your kind reply!Do you mean that in synchronous/asynchronous mode GC is also finished in synchronous
>>>>> /asynchronous way as writting is? A more question is,are all dirty spaces collected in the same time in synchronous mode(at this point the caller will be blocked for a long time) while in asynchronous mode dirty spaces will be collected little by little in asynchronous mode when i do not notice?Thank you!
>>>>
>>>> Hmm, I don't fully understand your first question, can you elaborate?
>>>> As for dirty space, GC will not collect all dirty space. UBIFS tells GC how much free space an operation
>>>> will take. UBIFS calls this budget. The GC will try to produce as much free space as needed.
>>>>
>>>
>>> I guess the issue here is that UBIFS appears to do this
>>>
>>> 1) write files while there is space
>>> 2) when space is 0 perform a GC run as part of write operation
>>>
>>> when writes are synchronous the GC run is timed as part of the write.
>>
>> Exactly. :-)
>>
>>> If GC was asynchronous it would not appear as part of the synchronous
>>> write operation and would not cause as much write time jitter. When
>>> mounting a filesystem synchronous having GC synchronous is likely not
>>> what the user asked for. It's part of the internal fs bookkeeping and
>>> not part of the operation the user wants to perform synchronously.
>>>
>>> For GC to run asynchronously it would have to start before the
>>> available space is 0 so writes can still happen.
>>
>> How would the GC know how much space you need in future?
>> Sure, we would run the GC every X seconds/minutes/whatever but then the flash will wear out
>> faster since GC will always run and not only when you really need space.
>
> I would collect garbage when the unusable space is some % of free
> space or when the free space is less than a few blocks rather than
> based on time. Nonetheless, it can happen that some of the data the GC
> copied to fresh blocks gets deleted before new blocks are written.
>
>>
>>> Is it possible to set a parameter somewhere that would make UBIFS do this?
>>
>> Do we really need this?
>
> Waiting until the space is 0 probably hurts performance in general and
> not only in the specific case of synchronous writes. I did not
> benchmark flash writing, though.
Well, changing the semantics when GC runs is rather easy.
So feel free to do experiments. If we can do better, we'll find
a way to implement it.
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-23 19:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-19 13:56 ubifs:Questions About Garbage Collection =?gb18030?B?u9TJ2Q==?=
2016-06-19 14:50 ` Richard Weinberger
[not found] ` <tencent_7ADEA65732A2B069166D1A41@qq.com>
2016-06-19 17:05 ` 回复:ubifs:Questions " Richard Weinberger
[not found] ` <CAOMqctT4Ftef-TTX+cC9HK5Fg4TTe9MDodGbSrJDBmsKBj_NWA@mail.gmail.com>
2016-06-23 17:34 ` Richard Weinberger
[not found] ` <CAOMqctTpTsTHd8tbVeA+X8bR0KQ77mufw4koDtwZV7rFquQ5xw@mail.gmail.com>
2016-06-23 19:18 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).