Re: JFFS3 & performance

Jörn Engel
2004-12-22T16:19:26Z

On Wed, 22 December 2004 15:59:46 +0000, jasmine@linuxgrrls.org wrote:
> On Wed, 22 Dec 2004, Joakim Tjernlund wrote:
> [going backwards]
> >Prefetching may work well for some archs, but for low end embedded CPUs
> >I am not so sure. You will probably need to add arch specific code also to
> >do prefetching.
>
> This is nothing to do with prefetching.

Maybe we could do both? Adding a prefetch now and then inside the
loop, using <linux/prefetch.h> may help as well.

> Imagine you have three functions, a(), b() and c(). They all
> work through a block of data D[] which is of a size >> cache size.
>
> a() runs, loading data into cache as it works through the data.
> At the end of a()'s run, the cache predominantly contains data from
> the end of D[], because that was the last part to be accessed.
>
> b() then runs, and needs data from the start of D[], so the cache
> discards all the lines it loaded for a() and reloads them. At the
> end of b()'s runm the cache predominantly contains data from the
> last part of D[], again, because that was the last part to be accessed.
>
> c() finally runs, needs the start of D[]. The cache dumps all those
> lines once more and reloads them again.
>
>
> Now: what happens if b() starts from the end of D[]? You save a little
> time because the data b() needs to start with is already in cache. And
> you save a little more because at the end of b(), the cache is full of the
> start of D[], so c() is ready to run.
>
> Does this clarify?

Sure does. Actually, your earlier mail already did. Very simple
concept, yet totally new to me. Thanks!

Jörn

--
"Error protection by error detection and correction."
-- from a university class