From: Andrey Konovalov <andreyknvl@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@kernel.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Arnd Bergmann <arnd@arndb.de>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
kasan-dev@googlegroups.com, Vernon Yang <vernon2gm@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RFC] maple_tree: reduce stack usage with gcc-9 and earlier
Date: Fri, 17 Feb 2023 11:01:41 +0100 [thread overview]
Message-ID: <CA+fCnZebcevCZModJKRAVM_-WL0o_C+ooVxNpZtw+-Bwu3GMRA@mail.gmail.com> (raw)
In-Reply-To: <20230214114014.4ce0afb658fae97d81f32925@linux-foundation.org>
On Tue, Feb 14, 2023 at 8:40 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Tue, 14 Feb 2023 11:30:24 +0100 Arnd Bergmann <arnd@kernel.org> wrote:
>
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > gcc-10 changed the way inlining works to be less aggressive, but
> > older versions run into an oversized stack frame warning whenever
> > CONFIG_KASAN_STACK is enabled, as that forces variables from
> > inlined callees to be non-overlapping:
> >
> > lib/maple_tree.c: In function 'mas_wr_bnode':
> > lib/maple_tree.c:4320:1: error: the frame size of 1424 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >
> > Change the annotations on mas_store_b_node() and mas_commit_b_node()
> > to explicitly forbid inlining in this configuration, which is
> > the same behavior that newer versions already have.
> >
> > ...
> >
> > --- a/lib/maple_tree.c
> > +++ b/lib/maple_tree.c
> > @@ -146,6 +146,13 @@ struct maple_subtree_state {
> > struct maple_big_node *bn;
> > };
> >
> > +#ifdef CONFIG_KASAN_STACK
> > +/* Prevent mas_wr_bnode() from exceeding the stack frame limit */
> > +#define noinline_for_kasan noinline_for_stack
> > +#else
> > +#define noinline_for_kasan inline
> > +#endif
>
> Should noinline_for_kasan be defined in kasan.h? maple_tree.c is
> unlikely to be the only place in the kernel which could use this
> treatment?
We could also define it in include/linux/compiler_types.h along with
other KASAN attributes.
next prev parent reply other threads:[~2023-02-17 10:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 10:30 Arnd Bergmann
2023-02-14 12:07 ` David Hildenbrand
2023-02-14 19:40 ` Andrew Morton
2023-02-17 10:01 ` Andrey Konovalov [this message]
2023-02-15 17:22 ` Liam R. Howlett
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=CA+fCnZebcevCZModJKRAVM_-WL0o_C+ooVxNpZtw+-Bwu3GMRA@mail.gmail.com \
--to=andreyknvl@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.com \
--cc=vernon2gm@gmail.com \
--cc=vincenzo.frascino@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox