From: Ingo Molnar <mingo@elte.hu>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mike Galbraith <efault@gmx.de>, Con Kolivas <kernel@kolivas.org>,
linux-kernel@vger.kernel.org
Subject: Re: BFS vs. mainline scheduler benchmarks and measurements
Date: Thu, 10 Sep 2009 09:04:43 +0200 [thread overview]
Message-ID: <20090910070443.GC29009@elte.hu> (raw)
In-Reply-To: <20090910065856.GL18599@kernel.dk>
[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]
* Jens Axboe <jens.axboe@oracle.com> wrote:
> On Thu, Sep 10 2009, Peter Zijlstra wrote:
> > On Wed, 2009-09-09 at 14:20 +0200, Jens Axboe wrote:
> > >
> > > One thing I also noticed is that when I have logged in, I run xmodmap
> > > manually to load some keymappings (I always tell myself to add this to
> > > the log in scripts, but I suspend/resume this laptop for weeks at the
> > > time and forget before the next boot). With the stock kernel, xmodmap
> > > will halt X updates and take forever to run. With BFS, it returned
> > > instantly. As I would expect.
> >
> > Can you provide a little more detail (I'm a xmodmap n00b), how
> > does one run xmodmap and maybe provide your xmodmap config?
>
> Will do, let me get the notebook and strace time it on both bfs
> and mainline.
A 'perf stat' comparison would be nice as well - that will show us
events strace doesnt show, and shows us the basic scheduler behavior
as well.
A 'full' trace could be done as well via trace-cmd.c (attached), if
you enable:
CONFIG_CONTEXT_SWITCH_TRACER=y
and did something like:
trace-cmd -s xmodmap ... > trace.txt
Ingo
[-- Attachment #2: trace-cmd.c --]
[-- Type: text/plain, Size: 6541 bytes --]
/*
* Copyright (C) 2008, Steven Rostedt <srostedt@redhat.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License (not later!)
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define VERSION "0.2"
#define _STR(x) #x
#define STR(x) _STR(x)
#define MAX_PATH 256
#define TRACE_CTRL "tracing_enabled"
#define TRACE "latency_trace"
#define AVAILABLE "available_tracers"
#define CURRENT "current_tracer"
#define ITER_CTRL "iter_ctrl"
#define MAX_LATENCY "tracing_max_latency"
#define THRESH "tracing_thresh"
static void die(char *fmt, ...)
{
va_list ap;
int ret = errno;
if (errno)
perror("trace-cmd");
else
ret = -1;
va_start(ap, fmt);
fprintf(stderr, " ");
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(ret);
}
static int search_mounts(char *path, int size)
{
FILE *fp;
static char debugfs[MAX_PATH+1];
static int debugfs_size;
if (!debugfs_size) {
char type[100];
if ((fp = fopen("/proc/mounts","r")) == NULL)
die("Can't open /proc/mounts for read");
while (fscanf(fp, "%*s %"
STR(MAX_PATH)
"s %99s %*s %*d %*d\n",
debugfs, type) == 2) {
if (strcmp(type, "debugfs") == 0)
break;
}
fclose(fp);
if (strcmp(type, "debugfs") != 0)
die("debugfs not mounted, please mount");
}
debugfs_size = strlen(debugfs)+1;
if (size > debugfs_size)
size = debugfs_size;
memcpy(path, debugfs, size);
return size;
}
/*
* Finds the path to the debugfs/tracing
* Allocates the string and stores it.
*/
static int tracing_dir(char *path, int size)
{
static char debugfs[MAX_PATH];
static int debugfs_size;
int ret;
if (!debugfs_size) {
ret = search_mounts(debugfs, MAX_PATH);
if (ret < 0)
return ret;
debugfs_size = MAX_PATH - ret;
strncat(debugfs, "/tracing", debugfs_size);
debugfs_size = strlen(debugfs)+1;
}
if (size > debugfs_size)
size = debugfs_size;
memcpy(path, debugfs, size);
return size;
}
static int tracing_type(char *path, const char *type, int size)
{
int len = strlen(type) + 1;
int ret;
ret = tracing_dir(path, size);
size -= ret;
if (len > size)
die ("debugfs path is too big!");
strcat(path, "/");
strcat(path, type);
return ret + len;
}
static void write_trace(const char *file, const char *val)
{
char path[MAX_PATH+1];
int fd;
tracing_type(path, file, MAX_PATH);
fd = open(path, O_WRONLY);
if (fd < 0)
die("writng %s", path);
write(fd, val, strlen(val));
close(fd);
}
static int find_trace_type(const char *type)
{
FILE *fp;
char path[MAX_PATH+1];
char scan[100];
int ret;
tracing_type(path, AVAILABLE, MAX_PATH);
fp = fopen(path, "r");
if (!fp)
die("reading %s", path);
do {
ret = fscanf(fp, "%99s", scan);
if (ret > 0 && strcmp(scan, type) == 0)
break;
} while (ret > 0);
fclose(fp);
return ret > 0;
}
static void set_ftrace(int set)
{
int fd;
char *val = set ? "1" : "0";
fd = open("/proc/sys/kernel/ftrace_enabled", O_WRONLY);
if (fd < 0)
die ("Can't %s ftrace", set ? "enable" : "disable");
write(fd, val, 1);
close(fd);
}
void run_cmd(int argc, char **argv)
{
int status;
int pid;
if ((pid = fork()) < 0)
die("failed to fork");
if (!pid) {
/* child */
if (execvp(argv[0], argv))
exit(-1);
}
waitpid(pid, &status, 0);
}
static void usage(char **argv)
{
char *arg = argv[0];
char *p = arg+strlen(arg);
while (p >= arg && *p != '/')
p--;
p++;
printf("\n"
"%s version %s\n\n"
"usage: %s OPTION [-f] command ...\n"
"\n"
" -s set context switch trace\n"
" -p set preemption off trace\n"
" -i set interrupts off trace\n"
" -b set preempt and interrupts off trace\n"
" -w set wakeup tracing\n"
" -e set event tracing\n"
" -f set function trace\n"
"\n"
" Note: only -f may be set with any other trace\n"
"\n", p, VERSION, p);
exit(-1);
}
int main (int argc, char **argv)
{
const char *type = NULL;
const char *config;
int function = 0;
int type_set = 0;
int max = 0;
int c;
while ((c = getopt(argc, argv, "+hspibfew")) >= 0) {
switch (c) {
case 'h':
usage(argv);
break;
case 's':
type = "sched_switch";
config = "CONFIG_CONTEXT_SWITCH_TRACER";
type_set++;
break;
case 'p':
type = "preemptoff";
config = "CONFIG_CRITICAL_PREEMPT_TIMING";
max = 1;
type_set++;
break;
case 'i':
type = "irqsoff";
config = "CONFIG_CRITICAL_IRQSOFF_TIMING";
max = 1;
type_set++;
break;
case 'b':
type = "preemptirqsoff";
config = "CONFIG_CRITICAL_IRQSOFF_TIMING and"
" CONFIG_CRITICAL_PREEMPT_TIMING";
max = 1;
type_set++;
break;
case 'w':
type = "wakeup";
config = "CONFIG_WAKEUP_TRACER";
max = 1;
type_set++;
break;
case 'e':
type = "events";
config = "CONFIG_EVENT_TRACER";
type_set++;
break;
case 'f':
if (!type) {
type = "ftrace";
config = "CONFIG_FTRACE";
}
function = 1;
break;
default:
/* yeah yeah, I know this is a dup! */
usage(argv);
break;
}
}
if (type_set > 1)
usage(argv);
if (!(argc - optind))
usage(argv);
if (!type)
usage(argv);
if (!find_trace_type(type))
die("Trace type %s not found.\n"
" Please configure the kernel with %s set\n",
type, config);
write_trace(TRACE_CTRL, "0");
if (function)
set_ftrace(1);
if (max)
write_trace(MAX_LATENCY, "0");
write_trace(CURRENT, type);
write_trace(TRACE_CTRL, "1");
run_cmd(argc - optind, &argv[optind]);
write_trace(TRACE_CTRL, "0");
if (function)
set_ftrace(0);
system("cat /debug/tracing/trace");
return 0;
}
next prev parent reply other threads:[~2009-09-10 7:04 UTC|newest]
Thread overview: 224+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-06 20:59 BFS vs. mainline scheduler benchmarks and measurements Ingo Molnar
2009-09-07 2:05 ` Frans Pop
2009-09-07 12:16 ` [quad core results] " Ingo Molnar
2009-09-07 12:36 ` Stefan Richter
2009-09-07 13:41 ` Markus Tornqvist
2009-09-07 13:59 ` Ingo Molnar
2009-09-09 5:54 ` Markus Tornqvist
2009-09-07 14:45 ` Arjan van de Ven
2009-09-07 15:20 ` Frans Pop
2009-09-07 15:36 ` Arjan van de Ven
2009-09-07 15:47 ` Frans Pop
2009-09-07 15:24 ` Xavier Bestel
2009-09-07 15:37 ` Arjan van de Ven
2009-09-07 16:00 ` Diego Calleja
2009-09-07 15:34 ` Nikos Chantziaras
2009-09-07 3:38 ` Nikos Chantziaras
2009-09-07 11:01 ` Frederic Weisbecker
2009-09-08 18:15 ` Nikos Chantziaras
2009-09-10 20:25 ` Frederic Weisbecker
2009-09-07 14:40 ` Arjan van de Ven
2009-09-08 7:19 ` Nikos Chantziaras
2009-09-08 8:31 ` Arjan van de Ven
2009-09-08 20:22 ` Frans Pop
2009-09-08 21:10 ` Michal Schmidt
2009-09-08 21:11 ` Frans Pop
2009-09-08 21:40 ` GeunSik Lim
2009-09-08 22:36 ` Frans Pop
2009-09-09 9:53 ` Benjamin Herrenschmidt
2009-09-09 11:14 ` David Newall
2009-09-09 11:32 ` Benjamin Herrenschmidt
2009-09-09 11:55 ` Frans Pop
2009-09-11 1:36 ` Benjamin Herrenschmidt
2009-09-16 18:27 ` Frans Pop
2009-09-17 1:29 ` Benjamin Herrenschmidt
2009-10-01 9:36 ` Frans Pop
2009-09-08 8:38 ` Arjan van de Ven
2009-09-08 10:13 ` Nikos Chantziaras
2009-09-08 11:32 ` Juergen Beisert
2009-09-08 22:00 ` Nikos Chantziaras
2009-09-08 23:20 ` Jiri Kosina
2009-09-08 23:38 ` Nikos Chantziaras
2009-09-08 12:03 ` Theodore Tso
2009-09-08 21:28 ` Nikos Chantziaras
2009-09-08 14:20 ` Arjan van de Ven
2009-09-08 22:53 ` Nikos Chantziaras
2009-09-07 23:54 ` Thomas Fjellstrom
2009-09-08 11:30 ` Nikos Chantziaras
2009-09-07 3:50 ` Con Kolivas
2009-09-07 18:20 ` Jerome Glisse
2009-09-07 9:49 ` Jens Axboe
2009-09-07 10:12 ` Nikos Chantziaras
2009-09-07 10:41 ` Jens Axboe
2009-09-07 11:57 ` Jens Axboe
2009-09-07 14:14 ` Ingo Molnar
2009-09-07 17:38 ` Jens Axboe
2009-09-07 20:44 ` Jens Axboe
2009-09-08 9:13 ` Jens Axboe
2009-09-08 15:23 ` Peter Zijlstra
2009-09-08 20:34 ` Jens Axboe
2009-09-09 6:13 ` Ingo Molnar
2009-09-09 8:34 ` Nikos Chantziaras
2009-09-09 8:52 ` Mike Galbraith
2009-09-09 9:02 ` Peter Zijlstra
2009-09-09 9:18 ` Mike Galbraith
2009-09-09 9:05 ` Nikos Chantziaras
2009-09-09 9:17 ` Peter Zijlstra
2009-09-09 9:40 ` Nikos Chantziaras
2009-09-09 10:17 ` Nikos Chantziaras
2009-09-10 19:45 ` Martin Steigerwald
2009-09-10 20:06 ` Ingo Molnar
2009-09-10 20:39 ` Martin Steigerwald
2009-09-10 20:42 ` Ingo Molnar
2009-09-10 21:19 ` Martin Steigerwald
2009-09-11 9:26 ` Mat
2009-09-12 11:26 ` Martin Steigerwald
2009-09-09 9:10 ` Jens Axboe
2009-09-09 11:54 ` Jens Axboe
2009-09-09 12:20 ` Jens Axboe
2009-09-09 18:04 ` Ingo Molnar
2009-09-09 20:12 ` Nikos Chantziaras
2009-09-09 20:50 ` Jens Axboe
2009-09-10 1:02 ` Con Kolivas
2009-09-10 11:03 ` Jens Axboe
2009-09-10 3:15 ` Mike Galbraith
2009-09-10 6:08 ` Ingo Molnar
2009-09-10 6:40 ` Ingo Molnar
2009-09-10 9:54 ` Jens Axboe
2009-09-10 10:03 ` Ingo Molnar
2009-09-10 10:11 ` Jens Axboe
2009-09-10 10:28 ` Jens Axboe
2009-09-10 10:57 ` Mike Galbraith
2009-09-10 11:09 ` Jens Axboe
2009-09-10 11:21 ` Mike Galbraith
2009-09-10 11:24 ` Jens Axboe
2009-09-10 11:28 ` Mike Galbraith
2009-09-10 11:35 ` Jens Axboe
2009-09-10 11:42 ` Mike Galbraith
2009-09-10 16:02 ` Bret Towe
2009-09-10 16:05 ` Peter Zijlstra
2009-09-10 16:12 ` Bret Towe
2009-09-10 16:26 ` Ingo Molnar
2009-09-10 16:33 ` Bret Towe
2009-09-10 17:03 ` Ingo Molnar
2009-09-10 17:53 ` Nikos Chantziaras
2009-09-10 18:46 ` Ingo Molnar
2009-09-10 18:51 ` [tip:sched/core] sched: Disable NEW_FAIR_SLEEPERS for now tip-bot for Ingo Molnar
2009-09-10 18:57 ` [tip:sched/core] sched: Fix sched::sched_stat_wait tracepoint field tip-bot for Ingo Molnar
2009-09-10 9:48 ` BFS vs. mainline scheduler benchmarks and measurements Jens Axboe
2009-09-10 9:59 ` Ingo Molnar
2009-09-10 10:01 ` Jens Axboe
2009-09-10 6:55 ` Peter Zijlstra
2009-09-10 6:58 ` Jens Axboe
2009-09-10 7:04 ` Ingo Molnar [this message]
2009-09-10 9:44 ` Jens Axboe
2009-09-10 9:45 ` Jens Axboe
2009-09-10 13:53 ` Steven Rostedt
2009-09-10 7:33 ` Jens Axboe
2009-09-10 7:49 ` Ingo Molnar
2009-09-10 7:53 ` Jens Axboe
2009-09-10 10:02 ` Ingo Molnar
2009-09-10 10:09 ` Jens Axboe
2009-09-10 18:00 ` [crash, bisected] Re: clocksource: Resolve cpu hotplug dead lock with TSC unstable Ingo Molnar
2009-09-11 7:37 ` Ingo Molnar
2009-09-11 7:48 ` Martin Schwidefsky
2009-09-11 13:33 ` Martin Schwidefsky
2009-09-11 18:22 ` [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable, fix crash tip-bot for Martin Schwidefsky
2009-09-14 15:19 ` [crash, bisected] Re: clocksource: Resolve cpu hotplug dead lock with TSC unstable Ingo Molnar
2009-09-14 15:37 ` Martin Schwidefsky
2009-09-14 17:59 ` Martin Schwidefsky
2009-09-10 6:59 ` BFS vs. mainline scheduler benchmarks and measurements Ingo Molnar
2009-09-09 12:48 ` Mike Galbraith
2009-09-09 15:37 ` [tip:sched/core] sched: Turn off child_runs_first tip-bot for Mike Galbraith
2009-09-09 17:57 ` Theodore Tso
2009-09-09 18:08 ` Ingo Molnar
2009-09-09 18:59 ` Chris Friesen
2009-09-09 19:48 ` Pavel Machek
2009-09-09 15:37 ` [tip:sched/core] sched: Re-tune the scheduler latency defaults to decrease worst-case latencies tip-bot for Mike Galbraith
2009-09-12 11:45 ` Martin Steigerwald
2009-09-09 15:37 ` [tip:sched/core] sched: Keep kthreads at default priority tip-bot for Mike Galbraith
2009-09-09 16:55 ` Dmitry Torokhov
2009-09-09 17:06 ` Peter Zijlstra
2009-09-09 17:34 ` Mike Galbraith
2009-09-12 11:48 ` Martin Steigerwald
2009-09-12 12:19 ` Mike Galbraith
2009-09-09 11:52 ` BFS vs. mainline scheduler benchmarks and measurements Nikos Chantziaras
2009-09-07 18:02 ` Avi Kivity
2009-09-07 18:46 ` Jens Axboe
2009-09-07 20:36 ` Ingo Molnar
2009-09-07 20:46 ` Jens Axboe
2009-09-07 21:03 ` Peter Zijlstra
2009-09-07 21:05 ` Jens Axboe
2009-09-07 22:18 ` Ingo Molnar
2009-09-09 7:38 ` Pavel Machek
2009-09-10 12:19 ` latt location (Was Re: BFS vs. mainline scheduler benchmarks and measurements) Jens Axboe
2009-09-07 15:16 ` BFS vs. mainline scheduler benchmarks and measurements Michael Buesch
2009-09-07 18:26 ` Ingo Molnar
2009-09-07 18:47 ` Daniel Walker
2009-09-07 18:51 ` Michael Buesch
2009-09-07 20:57 ` Ingo Molnar
2009-09-07 23:24 ` Pekka Pietikainen
2009-09-08 8:04 ` Ingo Molnar
2009-09-08 8:13 ` Nikos Chantziaras
2009-09-08 10:12 ` Ingo Molnar
2009-09-08 10:40 ` Nikos Chantziaras
2009-09-08 11:35 ` Ingo Molnar
2009-09-08 19:06 ` Nikos Chantziaras
2009-09-08 12:00 ` el_es
2009-09-08 15:45 ` Michael Buesch
2009-09-08 7:48 ` Ingo Molnar
2009-09-08 9:50 ` Benjamin Herrenschmidt
2009-09-08 13:09 ` Ralf Baechle
2009-09-09 1:36 ` Felix Fietkau
2009-09-08 13:09 ` Felix Fietkau
2009-09-09 0:28 ` Benjamin Herrenschmidt
2009-09-09 0:37 ` David Miller
2009-09-08 14:45 ` Michael Buesch
2009-09-18 11:24 ` Ingo Molnar
2009-09-18 14:46 ` Felix Fietkau
2009-09-19 18:01 ` Ingo Molnar
2009-09-19 18:43 ` Felix Fietkau
2009-09-19 19:39 ` Ingo Molnar
2009-09-19 20:15 ` Felix Fietkau
2009-09-19 20:22 ` Ingo Molnar
2009-09-19 20:33 ` Felix Fietkau
2009-09-20 18:10 ` Ingo Molnar
2009-09-08 12:57 ` Epic regression in throughput since v2.6.23 Serge Belyshev
2009-09-08 17:47 ` Jesse Brandeburg
2009-09-08 18:20 ` Nikos Chantziaras
2009-09-08 19:00 ` Jeff Garzik
2009-09-08 19:20 ` Serge Belyshev
2009-09-08 19:26 ` Jeff Garzik
2009-09-08 18:37 ` Nikos Chantziaras
2009-09-08 22:15 ` Serge Belyshev
2009-09-09 15:52 ` Ingo Molnar
2009-09-09 20:49 ` Serge Belyshev
2009-09-09 21:23 ` Cory Fields
2009-09-10 6:53 ` Ingo Molnar
2009-09-10 23:23 ` Serge Belyshev
2009-09-11 6:10 ` Ingo Molnar
2009-09-11 8:55 ` Serge Belyshev
2009-09-13 15:27 ` Serge Belyshev
2009-09-13 15:47 ` Ingo Molnar
2009-09-13 19:17 ` Mike Galbraith
2009-09-14 6:15 ` Mike Galbraith
2009-09-16 19:45 ` Ingo Molnar
2009-09-16 23:18 ` Serge Belyshev
2009-09-17 4:55 ` [patchlet] " Mike Galbraith
2009-09-17 5:06 ` Mike Galbraith
2009-09-17 7:21 ` Ingo Molnar
2009-09-10 7:43 ` [updated] BFS vs. mainline scheduler benchmarks and measurements Ingo Molnar
2009-09-14 9:46 ` Phoronix CFS vs BFS bencharks Nikos Chantziaras
2009-09-14 11:35 ` Mike Galbraith
[not found] ` <f42384a10909140727k463ff460q3859892dcb79bcc5@mail.gmail.com>
2009-09-14 15:32 ` Mike Galbraith
2009-09-14 19:14 ` Marcin Letyns
2009-09-14 20:49 ` Willy Tarreau
2009-09-15 8:37 ` Mike Galbraith
-- strict thread matches above, loose matches on Subject: below --
2009-09-10 21:17 BFS vs. mainline scheduler benchmarks and measurements Martin Steigerwald
2009-09-11 10:10 Mat
2009-09-11 18:33 Volker Armin Hemmann
2009-09-12 7:37 ` Nikos Chantziaras
2009-09-12 7:51 ` Arjan van de Ven
2009-09-12 8:27 ` Volker Armin Hemmann
2009-09-12 9:03 ` Nikos Chantziaras
2009-09-12 9:34 ` Volker Armin Hemmann
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=20090910070443.GC29009@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=jens.axboe@oracle.com \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.