All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Con Kolivas <ckolivas@yahoo.com.au>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>,
	Roland McGrath <roland@redhat.com>
Subject: Re: [BENCHMARK] 2.5.60 with contest
Date: Tue, 11 Feb 2003 02:10:54 -0800	[thread overview]
Message-ID: <20030211021054.0ea47494.akpm@digeo.com> (raw)
In-Reply-To: <200302112036.38710.ckolivas@yahoo.com.au>

Con Kolivas <ckolivas@yahoo.com.au> wrote:
>
> interestingly dbench_load wouldnt give me a number because dbench never
> quite started - a whole swag of processes visible but not doing anything

Signal problems...

What dbench is doing is:

- Install a SIGCONT handler
- fork N times, children drop into a pause()
- parent does kill(0, SIGCONT);

It appears that the SIGCONT is not causing the children to drop out of the
pause().

Changing it to SIGINT makes it work.

The tarball is at http://samba.org/ftp/tridge/dbench/dbench-2.0.tar.gz

Here's the relevant snippet:

static double create_procs(int nprocs, void (*fn)(struct child_struct * ))
{
	int i, status;
	int synccount;

	signal(SIGCONT, sigcont);

	start_timer();

	synccount = 0;

	if (nprocs < 1) {
		fprintf(stderr,
			"create %d procs?  you must be kidding.\n",
			nprocs);
		return 1;
	}

	children = shm_setup(sizeof(struct child_struct)*nprocs);
	if (!children) {
		printf("Failed to setup shared memory\n");
		return end_timer();
	}

	memset(children, 0, sizeof(*children)*nprocs);

	for (i=0;i<nprocs;i++) {
		children[i].id = i;
		children[i].nprocs = nprocs;
	}

	for (i=0;i<nprocs;i++) {
		if (fork() == 0) {
			setbuffer(stdout, NULL, 0);
			nb_setup(&children[i]);
			children[i].status = getpid();
			pause();
			fn(&children[i]);
			_exit(0);
		}
	}

	do {
		synccount = 0;
		for (i=0;i<nprocs;i++) {
			if (children[i].status) synccount++;
		}
		if (synccount == nprocs) break;
		sleep(1);
	} while (end_timer() < 30);

	if (synccount != nprocs) {
		printf("FAILED TO START %d CLIENTS (started %d)\n", nprocs, synccount);
		return end_timer();
	}

	start_timer();
	kill(0, SIGCONT);



      parent reply	other threads:[~2003-02-11 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-11  9:38 [BENCHMARK] 2.5.60 with contest Con Kolivas
2003-02-11  9:47 ` Jens Axboe
2003-02-11 10:10 ` Andrew Morton [this message]

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=20030211021054.0ea47494.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=ckolivas@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=torvalds@transmeta.com \
    /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.