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)