From: David Laight <David.Laight@ACULAB.COM>
To: 'Anshuman Khandual' <anshuman.khandual@arm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: RE: [PATCH v6] mm: Uninline copy_overflow()
Date: Mon, 14 Feb 2022 11:31:20 +0000 [thread overview]
Message-ID: <1157d90c7335458cab4ef471c63a1d52@AcuMS.aculab.com> (raw)
In-Reply-To: <50eed483-9f0a-7aee-1bfd-e89106a80424@arm.com>
From: Anshuman Khandual
> Sent: 14 February 2022 09:54
...
> > With -Winline, GCC tells:
> >
> > /include/linux/thread_info.h:212:20: warning: inlining failed in call to 'copy_overflow': call
> is unlikely and code size would grow [-Winline]
> >
> > copy_overflow() is a non conditional warning called by
> > check_copy_size() on an error path.
> >
> > check_copy_size() have to remain inlined in order to benefit
> > from constant folding, but copy_overflow() is not worth inlining.
> >
> > Uninline the warning when CONFIG_BUG is selected.
> >
> > When CONFIG_BUG is not selected, WARN() does nothing so skip it.
> >
> > This reduces the size of vmlinux by almost 4kbytes.
>
> > +void __copy_overflow(int size, unsigned long count);
> > +
> > static inline void copy_overflow(int size, unsigned long count)
> > {
> > - WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
> > + if (IS_ENABLED(CONFIG_BUG))
> > + __copy_overflow(size, count);
> > }
> Just wondering, is this the only such scenario which results in
> an avoidable bloated vmlinux image ?
The more interesting question is whether the call to __copy_overflow()
is actually significantly smaller than the one to WARN()?
And if so why.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-02-14 11:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 6:26 Christophe Leroy
2022-02-14 9:23 ` David Laight
2022-02-14 9:54 ` Anshuman Khandual
2022-02-14 11:31 ` David Laight [this message]
2022-02-14 13:21 ` Christophe Leroy
2022-02-14 14:00 ` David Laight
2022-02-14 14:57 ` Christophe Leroy
2022-02-14 15:10 ` David Laight
2022-02-14 15:31 ` Christophe Leroy
2022-02-15 7:42 ` Christophe Leroy
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=1157d90c7335458cab4ef471c63a1d52@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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