public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* JFFS2 is broken
@ 2001-06-29  0:14 Vipin Malik
  2001-06-29  2:32 ` Nicolas Pitre
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Vipin Malik @ 2001-06-29  0:14 UTC (permalink / raw)
  To: David Woodhouse; +Cc: jffs-dev, MTD for Linux, elw_dev_list

For all practical purposes, JFFS2, in its present form, IMHO,  is
broken.

I've been doing a lot of "jitter" or "blocking" time testing for various
tasks running on a system where there is JFFS2 activity going on (info
for those that have not been following my posts).

Here are the results:

Task interacting with JFFS2 fs directly. JFFS2 compression enabled. (the
latest code in CVS):

Worst case jitter on a POSIX real time task interacting with
JFFS2~>30*seconds*

POSIX RT Tast NOT directly interacting with JFFS2. JFFS2 compression
enabled, but another task reading/writing to JFFS2 system.

Worst case jitter on *task NOT interacting with JFFS2* ~>30 seconds!
(same for task interacting with JFFS2).

Ok, so I turned compression off (hacked the code. There is no option to
do this).

Worst case jitter on task interacting with JFFS2, ~>4 seconds! Quite am
improvement!

Worst case jitter on task NOT interacting with JFFS2, ~>4seconds! :(

So, in other words, if you use JFFS2 in your embedded system, you cannot
expect a guranteed response to anything in less than 30 seconds if you
use the stock code.
If you turn compression off, that time is ~4 seconds.

Note that these times are HIGHLY system speed dependent. My test system
is a AMD SC520 (486 DX4 w/16MB L1 cache) @133MHz w/ 64MB 66MHz SDRAM.
(~61 VAX MIPS). 8MB of AMD flash connected 32 bits wide.

The problem is that JFFS2 tries to be a good guy and tries its hand at
GC'ing dirty flash, _from within a write() system call_

Now, I don't know if this can be made schedulable or not, but at this
time, *all other* activity in the system stops.
When the GC is complete, life resumes as before, but more than 30-40
seconds may have elapsed.

To test my hypothesis, I hacked the code, to refuse to try to GC from
within a write() to the JFFS2 fs. all GC is now done by the gc thread
(as it should).
In the compression turned off case, my block times for the task not
interacting with JFFS2 WENT DOWN TO 49.9 *ms* worst case, with the test
going
from an empty JFFS2 to a completely full JFFS2 fs (as in all cases
above).

Unfortunately, there is a problem with this approach. If write() cannot
find space and now we refuse to GC inside the write and return with
-ENOSPC, a lot of stock programs may break. I am returning -ENSPC
because I just didn't take the time to figure out how to return 0, which

IMHO is the right thing to do.

Under POSIX write() can return 0, and it not be an error. The system is
not ready for the write yet- exactly as in our case.
However, I think stock programs will break with this too.

The only solution, that I think will work, is to find a way to block the
write() to JFFS2 but allow kernel schedduling to go on. I really don't
know
if this is possible under Linux as it exists today, maybe someone else
can answer this question.

Comments welcome

Vipin

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: JFFS2 is broken
@ 2001-08-13 18:34 Frederic Giasson
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Giasson @ 2001-08-13 18:34 UTC (permalink / raw)
  To: 'Vipin Malik', MTD mailing list (E-mail)

Hi again Vipin,

I ran your JitterTest program on my MPC860T 50MHz embedded platform.  I
experienced worst case around 40 seconds like you did.  I think that such
jitter time is unacceptable in a real time embedded system like mine, so I
wonder what can be done to patch JFFS2 so it relinquish the CPU from time to
time... I spinkled a lot of loops into JFFS2 compression files with "if(
current->need_resched) schedule();" and the worst case was 4 seconds. 

After having spinkled the code with schedule(), I ran another application
which accessses JFFS2 too at the same time that JitterTest, and the
execution of my program took 17% more time, which in my opinion is
acceptable because now JFFS2 has to cope with 2 applications accessing it at
the same time. 

Do you think that something sharp and clean could be done with JFFS2 to fix
that problem once and for all? 

Regards,

Frédéric Giasson





-----Original Message-----
From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
Sent: Friday, August 10, 2001 10:47 PM
To: Frederic Giasson
Subject: RE: JFFS2 is broken


At 08:31 AM 8/10/2001 -0400, Frederic Giasson wrote:
>Hi Vipin,
>
>I'd be interested in having your testcase programs.  It would be much
>appreciated if you send me the sources.

Hi Frederic,

I've released the code under GPL and sent the entire CVS tree for the 
jitter test program to David to put under the MTD tree.

He should have that done (hopefully) sometime this weekend or by Monday.

Let me know if it's not there by monday and I'll send you a private copy.

Vipin

^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <F1BED55F35F4D3118C0F00E0295CFF4D9955F7@webmail.mediatrix.c om>]
* RE: JFFS2 is broken
@ 2001-08-14 16:46 Frederic Giasson
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Giasson @ 2001-08-14 16:46 UTC (permalink / raw)
  To: 'Vipin Malik', David Woodhouse; +Cc: MTD mailing list (E-mail)

[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]

It guess it is.  But is it possible (and not too time-consuming) for you to
take that new one I just created with ssh-keygen and put in
/root/.ssh/identity.pub along with /root/.ssh/identity and the config file
you ask me to create?  Here it is, should you decide to use it....

Frédéric Giasson





-----Original Message-----
From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
Sent: Monday, August 13, 2001 10:40 PM
To: David Woodhouse
Cc: Frederic Giasson; MTD mailing list (E-mail)
Subject: Re: JFFS2 is broken 


At 01:00 AM 8/14/2001 +0100, David Woodhouse wrote:

>vipin@embeddedlinuxworks.com said:
> > David once mentioned that there are some obvious optimizations that
> > can be carried out in the JFFS2 code. Maybe he could list out his
> > favorite ones  and maybe someone could volunteer to tackle them one by
> > one.
>
>I committed the cleanup to jffs2_remove_node_refs_from_ino_list()

Great! Frederic, since you just setup your system to do the jitter tests, 
could you pl run them again (with the new code from CVS) and see what 
difference it made (my own system is busy running the mird db power fail 
tests).

  Also enable profiling and see what else is on the  "CPU hog" list.

The LTT (Linux Trace Toolkit) seems to be an excellent tool to get more 
fine grained performance stats out of the system and
a new version was just released for 2.4.5 (though it may provide us with 
more info that we need/can handle :)

Vipin


[-- Attachment #2: identity.pub --]
[-- Type: application/octet-stream, Size: 333 bytes --]

1024 35 164358453018075670455790203200706540984393749504204243836036681422744008324009655150232134223034277415336613711914311755267437950808937418173965122857400339606006019692108436584787607289775427783920015394610085223007334556116082199981839573028213537755795029530359907389853830876722709464615820281008293377021 root@samlinux

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: JFFS2 is broken
@ 2001-08-14 17:39 Frederic Giasson
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Giasson @ 2001-08-14 17:39 UTC (permalink / raw)
  To: 'Vipin Malik'; +Cc: MTD mailing list (E-mail)

Good news!  

The jitter is now down to 3 seconds. 
In my test I ran JitterTest as a RT task reading I/P from jffs2.

When I run JitterTest with another task running in background which writes
to JFFS2, the jitter is up to 5 seconds.  No more 40 seconds waiting.


Frédéric Giasson





-----Original Message-----
From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
Sent: Monday, August 13, 2001 10:40 PM
To: David Woodhouse
Cc: Frederic Giasson; MTD mailing list (E-mail)
Subject: Re: JFFS2 is broken 


At 01:00 AM 8/14/2001 +0100, David Woodhouse wrote:

>vipin@embeddedlinuxworks.com said:
> > David once mentioned that there are some obvious optimizations that
> > can be carried out in the JFFS2 code. Maybe he could list out his
> > favorite ones  and maybe someone could volunteer to tackle them one by
> > one.
>
>I committed the cleanup to jffs2_remove_node_refs_from_ino_list()

Great! Frederic, since you just setup your system to do the jitter tests, 
could you pl run them again (with the new code from CVS) and see what 
difference it made (my own system is busy running the mird db power fail 
tests).

  Also enable profiling and see what else is on the  "CPU hog" list.

The LTT (Linux Trace Toolkit) seems to be an excellent tool to get more 
fine grained performance stats out of the system and
a new version was just released for 2.4.5 (though it may provide us with 
more info that we need/can handle :)

Vipin

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: JFFS2 is broken
@ 2001-08-14 17:57 Frederic Giasson
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Giasson @ 2001-08-14 17:57 UTC (permalink / raw)
  To: 'Vipin Malik', MTD mailing list (E-mail)

My other program running at the same time is my testcase which fills JFFS2
to 80% with various files, deletes them and continue to do on.  The Jitter
given by JitterTest is 5 seconds, and my testcase now takes 63 to 65 seconds
to complete, compared to 38-43 seconds when it runs alone.  It looks
resonable to me because 2 applications accesses JFFS2 at the same time.

I removed my schedule()'s and I gathered the new erase.c on the MTD before
doing my tests.

There is something else that I did and maybe you did'nt.  In my chip driver,
I put a "if( current->need_resched ) schedule();" in these fonctions:
atmel_0001_write(), atmel_0001_read() and atmel_0001_erase_varsize(), which
are the functions called by mtdblock driver through the mtd_info structure.
I put schedule()'s because I though that if an application request a write
of 1MB to JFFS2, atmel_0001_write() would not return until that 1MB of data
was compressed and written to JFFS2.  Same thing for read and writes.

Frédéric Giasson





-----Original Message-----
From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
Sent: Tuesday, August 14, 2001 1:58 PM
To: Frederic Giasson
Cc: MTD mailing list (E-mail)
Subject: RE: JFFS2 is broken 


At 01:39 PM 8/14/2001 -0400, Frederic Giasson wrote:
>Good news!
>
>The jitter is now down to 3 seconds.
>In my test I ran JitterTest as a RT task reading I/P from jffs2.
>
>When I run JitterTest with another task running in background which writes
>to JFFS2, the jitter is up to 5 seconds.  No more 40 seconds waiting.



But what about this other task _writing_ to JFFS2. How long does it block?
Plus is this still your code with liberally sprinkled schedules()?

Vipin




>Frédéric Giasson
>
>
>
>
>
>-----Original Message-----
>From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
>Sent: Monday, August 13, 2001 10:40 PM
>To: David Woodhouse
>Cc: Frederic Giasson; MTD mailing list (E-mail)
>Subject: Re: JFFS2 is broken
>
>
>At 01:00 AM 8/14/2001 +0100, David Woodhouse wrote:
>
> >vipin@embeddedlinuxworks.com said:
> > > David once mentioned that there are some obvious optimizations that
> > > can be carried out in the JFFS2 code. Maybe he could list out his
> > > favorite ones  and maybe someone could volunteer to tackle them one by
> > > one.
> >
> >I committed the cleanup to jffs2_remove_node_refs_from_ino_list()
>
>Great! Frederic, since you just setup your system to do the jitter tests,
>could you pl run them again (with the new code from CVS) and see what
>difference it made (my own system is busy running the mird db power fail
>tests).
>
>   Also enable profiling and see what else is on the  "CPU hog" list.
>
>The LTT (Linux Trace Toolkit) seems to be an excellent tool to get more
>fine grained performance stats out of the system and
>a new version was just released for 2.4.5 (though it may provide us with
>more info that we need/can handle :)
>
>Vipin

^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <F1BED55F35F4D3118C0F00E0295CFF4DD0DADF@webmail.mediatrix.c om>]
[parent not found: <F1BED55F35F4D3118C0F00E0295CFF4DD0DAE1@webmail.mediatrix.c om>]
* RE: JFFS2 is broken
@ 2001-08-15 15:09 Frederic Giasson
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Giasson @ 2001-08-15 15:09 UTC (permalink / raw)
  To: 'Vipin Malik'; +Cc: MTD mailing list (E-mail)

-----Original Message-----
From: Vipin Malik [mailto:vipin@embeddedlinuxworks.com]
Sent: Tuesday, August 14, 2001 5:57 PM
To: Frederic Giasson; MTD mailing list (E-mail)
Subject: RE: JFFS2 is broken 



Be careful, in my tests, the worst case blocking times came when the flash 
was >90+%
full. You may want to increase the full % on your flash full program and 
retest.


I ran JitterTest with -w 1000 bytes and after a while, it began to slow down
a lot.  Note that I had the kernel image file stored in jffs2 during that
test, so that JitterTest had 50% of the flash left for itself.  When I
stopped JitterTest, the worst case was 24 seconds and the instant average
jitter was probably around 5 seconds... What is happening?  Is JFFS2
constantly gargabe collecting after a while?  I looked at the size of the
file created by the -f option, and along with my kernel file it was using
95% of the flash.


Frédéric Giasson

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-08-15 15:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-29  0:14 JFFS2 is broken Vipin Malik
2001-06-29  2:32 ` Nicolas Pitre
2001-06-29  9:00 ` Alan Cox
2001-06-29 14:13   ` Vipin Malik
2001-07-01 19:10   ` David Woodhouse
2001-06-29 22:11 ` Vipin Malik
2001-08-09 17:00 ` A. Craig West
2001-08-09 22:36   ` Vipin Malik
  -- strict thread matches above, loose matches on Subject: below --
2001-08-13 18:34 Frederic Giasson
     [not found] <F1BED55F35F4D3118C0F00E0295CFF4D9955F7@webmail.mediatrix.c om>
2001-08-13 22:27 ` Vipin Malik
2001-08-14  0:00   ` David Woodhouse
2001-08-14  2:39     ` Vipin Malik
2001-08-14 16:46 Frederic Giasson
2001-08-14 17:39 Frederic Giasson
2001-08-14 17:57 Frederic Giasson
     [not found] <F1BED55F35F4D3118C0F00E0295CFF4DD0DADF@webmail.mediatrix.c om>
2001-08-14 17:57 ` Vipin Malik
     [not found] <F1BED55F35F4D3118C0F00E0295CFF4DD0DAE1@webmail.mediatrix.c om>
2001-08-14 21:57 ` Vipin Malik
2001-08-15 15:09 Frederic Giasson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox