[PATCH] make gcc -O1 in fs/reiserfs optional
Jeff Mahoney
jeffm at suse.de
Fri Oct 14 11:17:04 EST 2005
Andrew Morton wrote:
> Are you sure it's due to inline functions? I thought the problem was that
> certain versions of gcc did automatic inlining of non-inlined functions and
> we get excessive stack windup due to that. And iirc we put in global
> compiler options to defeat that behaviour. Andi would recall.
>
> Furthermore, we do have infrastructure for detecting the gcc version at
> build time. It would be better to use that for disabling `-O2', rather
> than a config option.
Andrew -
This "fix" has been in the kernel since I developed the endian safe
patches for ReiserFS in the 2.4 days; This patch just makes it optional
rather than required.
You could be correct regarding the behavior. I noticed it was related to
inline functions and stack usage. Since this was quite a few years ago
now, I don't recall the exact details, just that -O1 worked around it. I
was content blaming gcc and moving on with development. I seem to recall
thinking that was overaggressive aliasing avoidance between temporary
variables in static inline functions. The endian safe code frequently
uses static inlines for conversion of disk order bitfields (like key
type and offset). balance_leaf() is a beast of a function at around 1400
lines or so. When compiled with -O2, it wanted to allocate 6k of stack
space. With -O1, it ended up allocating about 230 bytes. It seemed to be
the only function really affected by the bug, but I wanted to be certain.
I do agree that using the kbuild infrastructure to determine the need
for this option would work quite a bit better.
-Jeff
--
Jeff Mahoney
SUSE Labs
More information about the Linuxppc-dev
mailing list