RE: JFFS3 & performance

jasmine
2004-12-22T16:00:51Z

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.

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?

-J.