Re: [PATCH] vsprintf.c: Reduce sizeof struct printf_spec from 24 to8 bytes
From: Linus Torvalds
Date: Sat Mar 06 2010 - 21:04:12 EST
On Sat, 6 Mar 2010, Joe Perches wrote:
>
> Reducing the size of struct printf_spec is a good thing
> because multiple instances are commonly passed on stack.
Sadly, this is not enough.
the 'pointer()' function has a 200+ byte stack footprint on x86-64. And
vsnprintf itself is about 100+ bytes. So that stack depth is way bigger
than I would have expected.
I'm not sure _why_ that stack footprint for 'pointer()' is so big, but I
bet it's due to some simple inlining, and gcc (once more) sucking at it
and not being able to combine stack frames. It's a damn shame.
I suspect it's mac_address_string() having 20-odd bytes of temporary data,
ip6_compressed_string() having some more, ip6_addr_string() having 50
bytes, uuid_string() adding thirty-odd bytes etc. Inline them all, suck up
merging stack slots, and 200 bytes is easy.
So no, I don't think we can do the recursion as things stand. I've applied
your cleanup patch, along with the two from Bjorn Helgaas (which he did
for his pnp set), but they don't help this fundamental problem.
A few noinlines might be appropriate. As would a good gcc cluestick about
inlining and stack usage. The latter is unlikely to materialize, I guess.
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/