From: David Laight <david.laight.linux@gmail.com>
To: Christian Kujau <lists@nerdbynature.de>
Cc: linux-kernel@vger.kernel.org,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: maple_tree.c:3738:1: error: the frame size of 1040 bytes is larger than 1024 bytes
Date: Thu, 30 Oct 2025 20:56:41 +0000 [thread overview]
Message-ID: <20251030205641.47b2241f@pumpkin> (raw)
In-Reply-To: <aee90be9-4816-592e-632b-21cbea4bb3dd@nerdbynature.de>
On Thu, 30 Oct 2025 18:13:33 +0100 (CET)
Christian Kujau <lists@nerdbynature.de> wrote:
> On Thu, 30 Oct 2025, David Laight wrote:
> > It is horrendous - best part of 4k code, the stack frame is 0x408.
> > Which means I must be building with a larger stack frame limit.
> > Is one of your debug options reducing it?
>
> No that I know of. I've attached the config to my initial posting.
>
> > OTOH it looks as though the actual place to force a stack frame 'break' is to
> > stop mas_rebalance() and mas_split() being inlined into mas_commit_b_node().
> > (Probably instead of all the current noinline_for_kasan.)
> > Both those functions are large and don't have many parameters.
>
> Cool, that helped! Leaving mas_wr_bnode() as it was, and only changed:
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 39bb779cb311..949fd2a0554b 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2746,7 +2746,7 @@ static void mas_spanning_rebalance(struct ma_state *mas,
> * Rebalance two nodes into a single node or two new nodes that are sufficient.
> * Continue upwards until tree is sufficient.
> */
> -static inline void mas_rebalance(struct ma_state *mas,
> +static noinline void mas_rebalance(struct ma_state *mas,
> struct maple_big_node *b_node)
> {
> char empty_count = mas_mt_height(mas);
> @@ -2967,7 +2967,7 @@ static inline bool mas_push_data(struct ma_state *mas,
> * @mas: The maple state
> * @b_node: The maple big node
> */
> -static void mas_split(struct ma_state *mas, struct maple_big_node *b_node)
> +static noinline void mas_split(struct ma_state *mas, struct maple_big_node *b_node)
> {
> struct maple_subtree_state mast;
> int height = 0;
Someone really ought to look at that code though.
1k stack frames tend to indicate 'sub-optimal' coding.
Especially since there are several 'rep stosd' to zero 64byte items
and an inlined (unrolled) copy of two larger on-stack structures.
I've implemented a balanced tree in the past, I don't what to try and
work out how a 'maple tree' is expected to work.
But the sheer amount of code makes be think there are better ways
to do things.
David
>
> > Oh, and the WARN_ON_ONCE() in there is all wrong.
> > A WARN_ON_ONCE(type != wr_split_store) after the call to mas_rebalance()
> > might make sense.
>
> I'll leave that for someone else to fix :-)
>
> Thanks,
> Christian.
next prev parent reply other threads:[~2025-10-30 20:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 13:35 maple_tree.c:3738:1: error: the frame size of 1040 bytes is larger than 1024 bytes Christian Kujau
2025-10-30 14:34 ` David Laight
2025-10-30 14:48 ` Christian Kujau
2025-10-30 16:51 ` David Laight
2025-10-30 17:13 ` Christian Kujau
2025-10-30 17:25 ` Christian Kujau
2025-10-30 20:56 ` David Laight [this message]
2025-11-25 23:09 ` Tiffany Yang
2025-12-05 0:49 ` Christian Kujau
2025-12-05 9:05 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251030205641.47b2241f@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.