linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: 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] mm: Outline copy_overflow()
Date: Tue, 8 Feb 2022 19:04:36 +0000	[thread overview]
Message-ID: <71382581-ffcb-dc1b-8719-ddbd7738fb4a@csgroup.eu> (raw)
In-Reply-To: <20220207124002.edd04bf6d2abac8a01e35144@linux-foundation.org>



Le 07/02/2022 à 21:40, Andrew Morton a écrit :
> On Mon,  7 Feb 2022 11:55:18 +0100 Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> 
>> While building a small config with CONFIG_CC_OPTIMISE_FOR_SIZE,
>> I ended up with more than 50 times the following function in vmlinux:
>>
>> 	c00243bc <copy_overflow>:
>> 	c00243bc:	94 21 ff f0 	stwu    r1,-16(r1)
>> 	c00243c0:	7c 85 23 78 	mr      r5,r4
>> 	c00243c4:	7c 64 1b 78 	mr      r4,r3
>> 	c00243c8:	3c 60 c0 62 	lis     r3,-16286
>> 	c00243cc:	7c 08 02 a6 	mflr    r0
>> 	c00243d0:	38 63 5e e5 	addi    r3,r3,24293
>> 	c00243d4:	90 01 00 14 	stw     r0,20(r1)
>> 	c00243d8:	4b ff 82 45 	bl      c001c61c <__warn_printk>
>> 	c00243dc:	0f e0 00 00 	twui    r0,0
>> 	c00243e0:	80 01 00 14 	lwz     r0,20(r1)
>> 	c00243e4:	38 21 00 10 	addi    r1,r1,16
>> 	c00243e8:	7c 08 03 a6 	mtlr    r0
>> 	c00243ec:	4e 80 00 20 	blr
>>
>> That function being a non conditional warning on an error path,
>> it is not worth inlining.
>>
>> Outline it.
> 
> "uninline" is the conventional term for this.
> 
>> This reduces the size of vmlinux by almost 4kbytes.
> 
> Did you consider uninlining check_copy_size() instead?
> 

If you uninline check_copy_size() you loose the benefit of constant 
folding and build time overflow detection for constant sizes, and I'm 
not sure __builtin_object_size() works at all if uninlined.

Christophe

      reply	other threads:[~2022-02-08 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 10:55 [PATCH] mm: Outline copy_overflow() Christophe Leroy
2022-02-07 13:46 ` kernel test robot
2022-02-07 20:40 ` Andrew Morton
2022-02-08 19:04   ` Christophe Leroy [this message]

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=71382581-ffcb-dc1b-8719-ddbd7738fb4a@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=akpm@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).