mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Salyzyn <salyzyn@android.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Dmitry Safonov <dsafonov@virtuozzo.com>,
	John Stultz <john.stultz@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Laura Abbott <labbott@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Andy Gross <andy.gross@linaro.org>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Andrew Pinski <apinski@cavium.com>,
	linux-arm-kernel@lists.infradead.org,
	Mark Salyzyn <salyzyn@google.com>
Subject: Re: [PATCH v3 04/12] arm: vdso: enforce monotonic and realtime as inline
Date: Tue, 31 Oct 2017 08:28:52 -0700	[thread overview]
Message-ID: <ca992b27-64f3-b160-215d-ce674fb25e7d@android.com> (raw)
In-Reply-To: <20171030155940.GR20805@n2100.armlinux.org.uk>

On 10/30/2017 08:59 AM, Russell King - ARM Linux wrote:
> On Fri, Oct 27, 2017 at 03:25:28PM -0700, Mark Salyzyn wrote:
>> Ensure monotonic and realtime are inline, small price to pay for
>> high volume common request.
> Is this just based on a hunch, or is it based on proper measurement?
> If proper measurement, where's the data?  What CPU was it measured
> with?  How does this change affect other CPUs?
>
I was tested faster in the past. Story today is less conclusive and the 
change is not worth it.

[TL;DR]

Code size in all cases is about 1/2 a 4K page, and change in size is not 
that much in or out.

Originally coded to match assembler for arm64. I tested it when I was 
first formulating the series and found a 2-4% improvement on arm 
(Nexus6, backport to 3.10) and arm64 (Nexus 6P, backport to 3.18). But 
that was (a technological) eon ago.

However, retested as-is, in and out, today side by side, clock_gettime 
for CLOCK_MONOTONIC, CLOCK_BOOTTIME and CLOCK_REALTIME, locked cores, 
affinity to littles (0-3), 50M iterations, device cooled down for 15 
minutes between (vdso64+vdso32) runs, 16 runs each averaged on a 
Hikey960, 4.9 kernel, GCC 4.9 -O2 and I get a slightly different story 
(with complete private patch stack that has vdso32):

vdso64

realtime: -4.8% (worse)

monotonic: +1.9% (better)

boottime: +3.2%

vdso32

realtime: +4.7% (better)

monotonic: +3.2%

boottime: +3.7%

The maximum deviation on the sample runs was in the order of +/-1%. I 
can not explain (the highly repeatable anomaly) as to why vdso64 
realtime is slower, yet vdso32 is equally faster. realtime is unique in 
the set as common routine serves for both __vdso_clock_gettime and 
__vdso_gettimeofday, and where I expected the gains (the hunch).

I have tried other combinations of forced inlines to try to cope with 
the clock_gettime(CLOCK_REALTIME) speed, and determined it was almost 
like a slippery tuning exercise. As such, I now come to the conclusion 
that given the (small?) gains, it is better to trust the C compiler 
(especially if this is used by a wider set of architectures) and drop 
this patch (and its side effect for boottime) from the series.

It should be noted on the same test bench that the new C coded vdso64 is 
+2.9% and +11% faster for realtime and monotonic respectively over the 
hand coded assembler it is replacing. Additional props for the C 
compiler doing the "right thing".

-- Mark

      reply	other threads:[~2017-10-31 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 22:25 Mark Salyzyn
2017-10-30 14:10 ` Mark Rutland
2017-10-30 15:59 ` Russell King - ARM Linux
2017-10-31 15:28   ` Mark Salyzyn [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=ca992b27-64f3-b160-215d-ce674fb25e7d@android.com \
    --to=salyzyn@android.com \
    --cc=andy.gross@linaro.org \
    --cc=apinski@cavium.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=dsafonov@virtuozzo.com \
    --cc=james.morse@arm.com \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=kevin.brodsky@arm.com \
    --cc=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luto@amacapital.net \
    --cc=mark.rutland@arm.com \
    --cc=salyzyn@google.com \
    --cc=will.deacon@arm.com \
    /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

Powered by JetHome