| To: | Kaigai Kohei <kaigai@xxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 2.6.11-rc4-mm1] connector: Add a fork connector |
| From: | Evgeniy Polyakov <johnpol@xxxxxxxxxxx> |
| Date: | Thu, 03 Mar 2005 14:51:29 +0300 |
| Cc: | Guillaume Thouvenin <guillaume.thouvenin@xxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, lkml <linux-kernel@xxxxxxxxxxxxxxx>, elsa-devel <elsa-devel@xxxxxxxxxxxxxxxxxxxxx>, Jay Lan <jlan@xxxxxxxxxxxx>, Gerrit Huizenga <gh@xxxxxxxxxx>, Erich Focht <efocht@xxxxxxxxxxxx>, Netlink List <netdev@xxxxxxxxxxx> |
| In-reply-to: | <20050303084656.A15197@2ka.mipt.ru> |
| Organization: | MIPT |
| References: | <1109240677.1738.196.camel@frecb000711.frec.bull.fr> <1109753292.8422.117.camel@frecb000711.frec.bull.fr> <42268201.80706@ak.jp.nec.com> <20050303084656.A15197@2ka.mipt.ru> |
| Reply-to: | johnpol@xxxxxxxxxxx |
| Sender: | netdev-bounce@xxxxxxxxxxx |
Simple program to test fork() performance.
#include <sys/signal.h>
#include <sys/time.h>
int main(int argc, char *argv[])
{
int pid;
int i = 0, max = 100000;
struct timeval tv0, tv1;
struct timezone tz;
long diff;
if (argc >= 2)
max = atoi(argv[1]);
signal(SIGCHLD, SIG_IGN);
gettimeofday(&tv0, &tz);
while (i++ < max) {
pid = fork();
if (pid == 0) {
sleep(1);
exit (0);
}
}
gettimeofday(&tv1, &tz);
diff = (tv1.tv_sec - tv0.tv_sec)*1000000 + (tv1.tv_usec - tv0.tv_usec);
printf("Average per process fork+exit time is %ld usecs [diff=%lu,
max=%d].\n", diff/max, diff, max);
return 0;
}
Creating 10k forks 100 times.
Results on 2-way SMP(1+1HT) Xeon for one fork()+exit():
2.6.11-rc4-mm1 494 usec
2.6.11-rc4-mm1-fork-connector-no_userspace 509 usec
2.6.11-rc4-mm1-fork-connector-userspace 520 usec
5% fork() degradation(connector with userspace vs. vanilla) with fork()
connector.
On my test system global fork lock does not cost anything
(tested both with and without userspace listener), but it is only 2-way(pseudo).
--
Evgeniy Polyakov
Crash is better than data corruption -- Arthur Grabowski
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: creating a netdevice, BZ Benny |
|---|---|
| Next by Date: | Re: [PATCH 2.6.11-rc4-mm1] connector: Add a fork connector, Evgeniy Polyakov |
| Previous by Thread: | Re: [PATCH 2.6.11-rc4-mm1] connector: Add a fork connector, Evgeniy Polyakov |
| Next by Thread: | Re: [PATCH 2.6.11-rc4-mm1] connector: Add a fork connector, Evgeniy Polyakov |
| Indexes: | [Date] [Thread] [Top] [All Lists] |