Re: + lib-vsprintfc-even-faster-decimal-conversion.patch added to -mm tree

From: Alexey Dobriyan
Date: Fri Mar 13 2015 - 08:56:11 EST


On Fri, Mar 13, 2015 at 3:49 PM, Alexey Dobriyan <adobriyan@xxxxxxxxx> 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 :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/