On Wed, Sep 8, 2021 at 5:49 PM Linus Torvalds torvalds@linux-foundation.org wrote:
On Wed, Sep 8, 2021 at 7:50 AM Eric Dumazet edumazet@google.com wrote: In the past I've seen at least two patterns
(a) not merging stack slots at all
(b) some odd "pattern allocator" problems, where I think gcc ended up re-using previous stack slots if they were the right size, but failing when previous allocations were fragmented
that (a) thing is what -fconserve-stack is all about, and we also used to have (iirc) -fno-defer-pop to avoid having function call argument stacks stick around.
CONFIG_KASAN_STACK leads to (a), and this has been the source of long discussions about whether to turn it off altogether, the current state being that it's disabled for CONFIG_COMPILE_TEST on clang because this can explode the stack usage even further when it starts spilling registers.
gcc also runs into this problem, but at least newer versions at not nearly as bad as they used to be in the past.
Arnd