[lkml]   [2012]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 0/2] More i387 state save/restore work
On Sun, Feb 19, 2012 at 4:53 PM, Michael Neuling <> 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.

[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);

int main(int argc, char **argv)
cpu_set_t cpuset;

CPU_SET(0, &cpuset);

sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);

child = fork();
if (!child) {
for (;;)

signal(SIGALRM, end);

for (;;) {
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-02-20 02:07    [W:0.066 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site