All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	"H. Peter Anvin" <hpa@zytor.com>, Brian Gerst <brgerst@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/processor.h: Force inlining of cpu_relax()
Date: Fri, 25 Sep 2015 13:44:23 +0200	[thread overview]
Message-ID: <20150925114423.GD3568@pd.tnic> (raw)
In-Reply-To: <1443096149-27291-1-git-send-email-dvlasenk@redhat.com>

On Thu, Sep 24, 2015 at 02:02:29PM +0200, Denys Vlasenko wrote:
> On x86, cpu_relax() simply calls rep_nop(), which generates one
> instruction, PAUSE (aka REP NOP).
> 
> With this config:
> http://busybox.net/~vda/kernel_config_OPTIMIZE_INLINING_and_Os
> gcc-4.7.2 does not always inline rep_nop(): it generates
> several copies of this:
> 
> <rep_nop> (16 copies, 194 calls):
>        55                      push   %rbp
>        48 89 e5                mov    %rsp,%rbp
>        f3 90                   pause
>        5d                      pop    %rbp
>        c3                      retq
> 
> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122
> 
> This patch fixes this via s/inline/__always_inline/
> on rep_nop() and cpu_relax().
> (Forcing inlining only on rep_nop() causes gcc to
> deinline cpu_relax(), with almost no change in generated code).
> 
>     text     data      bss       dec     hex filename
> 88118971 19905208 36421632 144445811 89c1173 vmlinux.before
> 88118139 19905208 36421632 144444979 89c0e33 vmlinux

Looks ok to me, text even grows smaller.

Acked-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

  reply	other threads:[~2015-09-25 11:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 12:02 [PATCH] x86/processor.h: Force inlining of cpu_relax() Denys Vlasenko
2015-09-25 11:44 ` Borislav Petkov [this message]
2015-09-25 12:22 ` [tip:x86/asm] x86/asm: " tip-bot for Denys Vlasenko

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=20150925114423.GD3568@pd.tnic \
    --to=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.