maple_tree: reduce stack usage with gcc-9 and earlier
commit 44081c77e8a4aac9c5a010ed0d9ccdcf684041e1 Author: Arnd Bergmann <arnd@arndb.de> Date: Tue Feb 14 11:30:24 2023 +0100 maple_tree: reduce stack usage with gcc-9 and earlier 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. Link: https://lkml.kernel.org/r/20230214103030.1051950-1-arnd@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: Vernon Yang <vernon2gm@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2166668 Signed-off-by: Nico Pache <npache@redhat.com>
This commit is contained in:
parent
26dc7386c3
commit
76246a2e26
|
@ -146,6 +146,13 @@ struct maple_subtree_state {
|
||||||
struct maple_big_node *bn;
|
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
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
static inline struct maple_node *mt_alloc_one(gfp_t gfp)
|
static inline struct maple_node *mt_alloc_one(gfp_t gfp)
|
||||||
{
|
{
|
||||||
|
@ -2107,7 +2114,7 @@ static inline void mas_bulk_rebalance(struct ma_state *mas, unsigned char end,
|
||||||
*
|
*
|
||||||
* Return: The actual end of the data stored in @b_node
|
* Return: The actual end of the data stored in @b_node
|
||||||
*/
|
*/
|
||||||
static inline void mas_store_b_node(struct ma_wr_state *wr_mas,
|
static noinline_for_kasan void mas_store_b_node(struct ma_wr_state *wr_mas,
|
||||||
struct maple_big_node *b_node, unsigned char offset_end)
|
struct maple_big_node *b_node, unsigned char offset_end)
|
||||||
{
|
{
|
||||||
unsigned char slot;
|
unsigned char slot;
|
||||||
|
@ -3579,7 +3586,7 @@ static inline bool mas_reuse_node(struct ma_wr_state *wr_mas,
|
||||||
* @b_node: The maple big node
|
* @b_node: The maple big node
|
||||||
* @end: The end of the data.
|
* @end: The end of the data.
|
||||||
*/
|
*/
|
||||||
static inline int mas_commit_b_node(struct ma_wr_state *wr_mas,
|
static noinline_for_kasan int mas_commit_b_node(struct ma_wr_state *wr_mas,
|
||||||
struct maple_big_node *b_node, unsigned char end)
|
struct maple_big_node *b_node, unsigned char end)
|
||||||
{
|
{
|
||||||
struct maple_node *node;
|
struct maple_node *node;
|
||||||
|
|
Loading…
Reference in New Issue