[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwHGUB7R6kpNPc7vDYF8dhYCKm4Riso-rpS2Fiqjg8hQg@mail.gmail.com>
Date: Sun, 19 Feb 2012 17:03:42 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Michael Neuling <mikey@...ling.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
benh@...nel.crashing.org, anton@...ba.org
Subject: Re: [PATCH 0/2] More i387 state save/restore work
On Sun, Feb 19, 2012 at 4:53 PM, Michael Neuling <mikey@...ling.org> wrote:
>
> Does "2476844 loops in 2 seconds" imply 2476844 context switches in 2
> sec? With Anton's context_switch [1] benchmark, we don't even hit 100K
> context switches per sec.
>
> Do you have this test program anywhere?
Here. No guarantees that this is at all sane, it's special-cased code
literally for testing only this one issue. The only indication I have
that this works at all is that the numbers did change roughly as
expected, and the kernel profile changes made sense.
You may have to do something else than just do some FP calculation to
force it to use VSX on PPC, obviously.
Linus
---
[torvalds@i5 ~]$ cat fp-switch.c
#define _GNU_SOURCE
#include <sched.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#define SECONDS (2)
unsigned long loops = 0, child;
static void use_math(void)
{
double x = 0;
asm volatile("":"+m" (x));
x += 1;
asm volatile("":"+m" (x));
}
static void end(int signr)
{
printf("%d loops in %d seconds\n", loops, SECONDS);
kill(child, SIGKILL);
exit(0);
}
int main(int argc, char **argv)
{
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
child = fork();
if (!child) {
for (;;)
sched_yield();
}
signal(SIGALRM, end);
alarm(SECONDS);
for (;;) {
use_math();
sched_yield();
loops++;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists