All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Cc: bmatthews@redhat.com
Subject: Re: [TEST] page tables filling non-highmem
Date: Mon, 18 Feb 2002 16:03:18 -0800	[thread overview]
Message-ID: <20020219000318.GE3511@holomorphy.com> (raw)
In-Reply-To: <20020215045106.GB26322@holomorphy.com>
In-Reply-To: <20020215045106.GB26322@holomorphy.com>

Okay, I hereby place this testcase under the GPL:

/*
 * death.c -- Testcase for pagetable memory management.
 *
 *   Copyright (C) 2002  William Irwin
 *
 *   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; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#define __USE_LARGEFILE64
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#define __USE_LARGEFILE64
#include <fcntl.h>
#include <errno.h>

#define MAPPING_START 0x20000000
#define MAPPING_SIZE  (0x80000000/sizeof(unsigned long))
#define MAPPING_END   (MAPPING_START + MAPPING_SIZE*sizeof(unsigned long))

int main(void)
{
	int fd;
	unsigned long *data = NULL;
	unsigned long try = 64;
	unsigned long k = 0;

	fd = open("/home/wli/bench/mapfile", O_RDWR|O_LARGEFILE);

	if (fd < 0) {
		perror("death");
		printf("could not open mapfile!\n");
		exit(1);
	}

	data = mmap((void *)MAPPING_START,
			MAPPING_SIZE,
			PROT_READ|PROT_WRITE, 
			MAP_FIXED | MAP_SHARED,
			fd,
			0);

	if (!try || data == MAP_FAILED) {
		printf("mmap() failed, tries = %lu!\n", 64 - try + 1);
		exit(1);
	}

	printf("managed to mmap() at %p\n", (void *)data);

	sleep(60);

	try = 0;
	while (1) {
		printf("entered iteration %lu\n", k);
		data[k++] = try++;
		k %= MAPPING_SIZE;
		if (k >= MAPPING_SIZE-1)
			k = 0;
	}
	return 0;
}

  parent reply	other threads:[~2002-02-19  0:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-15  4:51 [TEST] page tables filling non-highmem William Lee Irwin III
2002-02-15  8:59 ` Daniel Phillips
2002-02-15  8:56   ` William Lee Irwin III
2002-02-18  1:38   ` Andrea Arcangeli
2002-02-18  1:59     ` Daniel Phillips
2002-02-18  3:02       ` Marcelo Tosatti
2002-02-18 12:39       ` Andrea Arcangeli
2002-02-18  3:26     ` William Lee Irwin III
2002-02-18 12:27       ` Andrea Arcangeli
2002-02-18 12:59         ` Daniel Phillips
2002-02-18 13:15           ` Andrea Arcangeli
2002-02-19  0:06             ` Daniel Phillips
2002-02-18  4:25     ` William Lee Irwin III
2002-02-19  0:03 ` William Lee Irwin III [this message]
     [not found]   ` <Pine.LNX.4.33.0202181914350.5124-100000@coffee.psychology.mcmaster.ca>
2002-02-19  0:16     ` William Lee Irwin III

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=20020219000318.GE3511@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=bmatthews@redhat.com \
    --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.