public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <mkp@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [RFC] Convert pgtable cache to slab
Date: Wed, 13 Oct 2004 20:34:30 +0000	[thread overview]
Message-ID: <yq1acuqtl0p.fsf@wilson.mkp.net> (raw)
In-Reply-To: <yq1zn2qtpyo.fsf@wilson.mkp.net>

>>>>> "Robin" = Robin Holt <holt@sgi.com> writes:

Robin> Martin, can you send your updated test case.  I believe yours
Robin> is just mine with a higher resolution timer. 

Sure.  Included below.

-- 
Martin K. Petersen	Silicon Graphics, Inc.
mkp@sgi.com		http://www.sgi.com/

#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


#define	PAGE_SIZE		getpagesize()
#define PTES_PER_PMD		(PAGE_SIZE / 8)
#define STRIDE			PTES_PER_PMD * PAGE_SIZE
#define	FAULTS_TO_CAUSE		32
#define MAPPING_SIZE		FAULTS_TO_CAUSE * STRIDE

#define LOOPS_TO_TIME		128


int main(int argc, char **argv)
{
	long offset, i, j;
	char * mapping;
	volatile char z;
	pid_t child;
	int child_status;
	int fd;
	long long start, end;
	struct timespec ts;

	mapping = mmap(NULL, (size_t) MAPPING_SIZE, PROT_READ,
		       MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);

	if ((unsigned long) mapping = -1UL) {
		perror("Mapping failed.\n");
		exit(0);
	}

	for (j=0; j < LOOPS_TO_TIME; j++) {
		child = fork();
		if (child > 0) {
			wait(&child_status);
		} else if (child = 0) {
			clock_gettime(CLOCK_REALTIME, &ts);
			start = ts.tv_sec * 1000000000 + ts.tv_nsec;

			for (i = 0; i < FAULTS_TO_CAUSE; i++) {
				offset = i * STRIDE;
				z = mapping[offset];
			}

			clock_gettime(CLOCK_REALTIME, &ts);
			end = ts.tv_sec * 1000000000 + ts.tv_nsec;

			printf("Took %lld nanoseconds per fault\n",
			       (end-start) / FAULTS_TO_CAUSE);
			exit(0);
		} else {
			printf ("Fork failed\n");
		}
	}
	munmap(mapping, (size_t) MAPPING_SIZE);
	return 0;
}

  parent reply	other threads:[~2004-10-13 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-13 18:47 [RFC] Convert pgtable cache to slab Martin K. Petersen
2004-10-13 18:57 ` Jesse Barnes
2004-10-13 18:59 ` William Lee Irwin III
2004-10-13 19:07 ` Luck, Tony
2004-10-13 19:28 ` Jesse Barnes
2004-10-13 19:32 ` Martin K. Petersen
2004-10-13 19:32 ` Luck, Tony
2004-10-13 19:42 ` Martin K. Petersen
2004-10-13 19:49 ` Robin Holt
2004-10-13 19:50 ` Robin Holt
2004-10-13 20:23 ` Luck, Tony
2004-10-13 20:34 ` Martin K. Petersen [this message]
2004-10-13 20:37 ` Martin K. Petersen
2004-10-14  7:44 ` David Mosberger
2004-10-14 10:27 ` William Lee Irwin III
2004-10-14 11:00 ` David Mosberger
2004-10-14 11:07 ` Robin Holt
2004-10-14 11:10 ` David Mosberger

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=yq1acuqtl0p.fsf@wilson.mkp.net \
    --to=mkp@sgi.com \
    --cc=linux-ia64@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox