linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux@rasmusvillemoes.dk, Peter Zijlstra <peterz@infradead.org>,
	Tejun Heo <tj@kernel.org>,
	Denis Vlasenko <vda.linux@googlemail.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: + lib-vsprintfc-even-faster-decimal-conversion.patch added to -mm tree
Date: Fri, 13 Mar 2015 15:56:01 +0300	[thread overview]
Message-ID: <CACVxJT-vtOVbM9wTFoJe01i2CxxcJYsMdg5kCR4S9tfzxe883Q@mail.gmail.com> (raw)
In-Reply-To: <CACVxJT_enpRNoBf3TizQ2U1Z77viP6sCy3CGTMnhpzpkjDpqcw@mail.gmail.com>

On Fri, Mar 13, 2015 at 3:49 PM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> Legend is "number avg+-1sigma min-max". Every number is CPU cycles.
> Great care was taken to remove interrupt noise.

To reproduce numbers:
* apply the patch which adds sys_nr_irq() system call.
* recompile without cpufreq, reboot with isolcpus=,
* shift interrupts off free CPU

* use new system call
static inline uint64_t sys_nr_irq(void)
{
        uint64_t rv;

        asm volatile ("syscall" : "=a" (rv) : "0" (323) : "memory",
"cc", "rcx", "r11");
        return rv;
}

* use measurement code
static inline void rdtsc(uint32_t *edx, uint32_t *eax)
{
        asm volatile ("rdtsc" : "=d" (*edx), "=a" (*eax));
}
static inline void lfence(void)
{
        asm volatile ("lfence" ::: "memory");
}
static inline uint64_t time_init(uint64_t *x)
{
        uint32_t edx, eax;

        *x = sys_nr_irq();

        lfence();
        rdtsc(&edx, &eax);
        return ((uint64_t)edx << 32) | eax;
}

static inline uint64_t time_fini(uint64_t *x)
{
        uint32_t edx, eax;

        lfence();
        rdtsc(&edx, &eax);

        *x = sys_nr_irq();

        return ((uint64_t)edx << 32) | eax;
}
----------------------------------------
* drop measurement where interrupt interfered
        i = 0;
        while (i < N) {
                uint64_t t0, t1;
                uint64_t x0, x1;

                t0 = time_init(&x0);
                f();
                t1 = time_fini(&x1);

                if (x1 != x0)
                        continue;

                T[i] = t1 - t0;
                i++;
        }
------------------------------------
* average results how you were taught in school :-)

  reply	other threads:[~2015-03-13 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5500b987.kerYYCYfIffruy3Z%akpm@linux-foundation.org>
2015-03-13 12:49 ` + lib-vsprintfc-even-faster-decimal-conversion.patch added to -mm tree Alexey Dobriyan
2015-03-13 12:56   ` Alexey Dobriyan [this message]
2015-03-13 13:00     ` Alexey Dobriyan
2015-03-13 23:53   ` Rasmus Villemoes
2015-03-14  9:21     ` Alexey Dobriyan
2015-03-16 15:19       ` Alexey Dobriyan
2015-03-17 22:04         ` Andrew Morton
2015-03-19 12:17           ` Alexey Dobriyan
2015-03-19 22:15             ` Rasmus Villemoes
2015-03-22 17:29             ` 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=CACVxJT-vtOVbM9wTFoJe01i2CxxcJYsMdg5kCR4S9tfzxe883Q@mail.gmail.com \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    --cc=vda.linux@googlemail.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;
as well as URLs for NNTP newsgroup(s).