Re: Large stack usage in fs code (especially for PPC64)

From: Linus Torvalds
Date: Mon Nov 17 2008 - 16:43:46 EST




On Mon, 17 Nov 2008, Andrew Morton wrote:
>
> Yup. That being said, the younger me did assert that "this is a neater
> implementation anyway". If we can implement those loops without
> needing those on-stack temporary arrays then things probably are better
> overall.

Sure, if it actually ends up being nicer, I'll not argue with it. But from
an L1 I$ standpoint (and I$ is often very important, especially for kernel
loads where loops are fairly rare), it's often _much_ better to do two
"tight" loops over two subsystems (filesystem and block layer) than it is
to do one bigger loop that contains both. If the L1 can fit both subsystem
paths, you're fine - but if not, you may get a lot more misses.

So it's often nice if you can "stage" things so that you do a cluster of
calls to one area, followed by a cluster of calls to another, rather than
mix it up.

But numbers talk. And code cleanliness. If somebody has numbers that the
code size actually goes down for example, or the code is just more
readable, micro-optimizing cache patterns isn't worth it.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/