From: Valerie Henson <val_henson@linux.intel.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Ulrich Drepper <drepper@redhat.com>,
Blaisorblade <blaisorblade@yahoo.it>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
Linux Memory Management <linux-mm@kvack.org>,
Val Henson <val.henson@intel.com>
Subject: Re: [patch 00/14] remap_file_pages protection support
Date: Sat, 13 May 2006 11:19:46 -0700 [thread overview]
Message-ID: <20060513181945.GC9612@goober> (raw)
In-Reply-To: <4465E981.60302@yahoo.com.au>
On Sun, May 14, 2006 at 12:13:21AM +1000, Nick Piggin wrote:
>
> OK, I got interested again, but can't get Val's ebizzy to give me
> a find_vma constrained workload yet (though the numbers back up
> my assertion that the vma cache is crap for threaded apps).
Hey Nick,
Glad to see you're using it! There are (at least) two ways to do what
you want:
1. Increase the number of threads - this gives you two vma's per
thread, one for stack, one for guard page:
$ ./ebizzy -t 100
2. Apply the patch at the end of this email and use -p "prevent
coalescing", -m "always mmap" and appropriate number of chunks,
size, and records to search - this works for me:
$ ./ebizzy -p -m -n 10000 -s 4096 -r 100000
The original program mmapped everything with the same permissions and
no alignment restrictions, so all the mmaps were coalesced into one.
This version alternates PROT_WRITE permissions on the mmap'd areas
after they are written, so you get lots of vma's:
val@goober:~/ebizzy$ ./ebizzy -p -m -n 10000 -s 4096 -r 100000
[2]+ Stopped ./ebizzy -p -m -n 10000 -s 4096 -r 100000
val@goober:~/ebizzy$ wc -l /proc/`pgrep ebizzy`/maps
10019 /proc/10917/maps
I haven't profiled to see if this brings find_vma to the top, though.
(The patch also moves around some other stuff so that options are in
alphabetical order; apparently I thought 's' came after 'r' and before
'R'...)
-VAL
--- ebizzy.c.old 2006-05-13 10:18:58.000000000 -0700
+++ ebizzy.c 2006-05-13 11:01:42.000000000 -0700
@@ -52,9 +52,10 @@
static unsigned int always_mmap;
static unsigned int never_mmap;
static unsigned int chunks;
+static unsigned int prevent_coalescing;
static unsigned int records;
-static unsigned int chunk_size;
static unsigned int random_size;
+static unsigned int chunk_size;
static unsigned int threads;
static unsigned int verbose;
static unsigned int linear;
@@ -76,9 +77,10 @@
"-m\t\t Always use mmap instead of malloc\n"
"-M\t\t Never use mmap\n"
"-n <num>\t Number of memory chunks to allocate\n"
+ "-p \t\t Prevent mmap coalescing\n"
"-r <num>\t Total number of records to search for\n"
- "-s <size>\t Size of memory chunks, in bytes\n"
"-R\t\t Randomize size of memory to copy and search\n"
+ "-s <size>\t Size of memory chunks, in bytes\n"
"-t <num>\t Number of threads\n"
"-v[v[v]]\t Be verbose (more v's for more verbose)\n"
"-z\t\t Linear search instead of binary search\n",
@@ -98,7 +100,7 @@
cmd = argv[0];
opterr = 1;
- while ((c = getopt(argc, argv, "mMn:r:s:Rt:vz")) != -1) {
+ while ((c = getopt(argc, argv, "mMn:pr:Rs:t:vz")) != -1) {
switch (c) {
case 'm':
always_mmap = 1;
@@ -111,19 +113,22 @@
if (chunks == 0)
usage();
break;
+ case 'p':
+ prevent_coalescing = 1;
+ break;
case 'r':
records = atoi(optarg);
if (records == 0)
usage();
break;
+ case 'R':
+ random_size = 1;
+ break;
case 's':
chunk_size = atoi(optarg);
if (chunk_size == 0)
usage();
break;
- case 'R':
- random_size = 1;
- break;
case 't':
threads = atoi(optarg);
if (threads == 0)
@@ -141,7 +146,7 @@
}
if (verbose)
- printf("ebizzy 0.1, Copyright 2006 Intel Corporation\n"
+ printf("ebizzy 0.2, Copyright 2006 Intel Corporation\n"
"Written by Val Henson <val_henson@linux.intel.com\n");
/*
@@ -173,10 +178,11 @@
printf("always_mmap %u\n", always_mmap);
printf("never_mmap %u\n", never_mmap);
printf("chunks %u\n", chunks);
+ printf("prevent coalescing %u\n", prevent_coalescing);
printf("records %u\n", records);
printf("records per thread %u\n", records_per_thread);
- printf("chunk_size %u\n", chunk_size);
printf("random_size %u\n", random_size);
+ printf("chunk_size %u\n", chunk_size);
printf("threads %u\n", threads);
printf("verbose %u\n", verbose);
printf("linear %u\n", linear);
@@ -251,9 +257,13 @@
{
int i, j;
- for (i = 0; i < chunks; i++)
+ for (i = 0; i < chunks; i++) {
for(j = 0; j < chunk_size / record_size; j++)
mem[i][j] = (record_t) j;
+ /* Prevent coalescing by alternating permissions */
+ if (prevent_coalescing && (i % 2) == 0)
+ mprotect(mem[i], chunk_size, PROT_READ);
+ }
if (verbose)
printf("Wrote memory\n");
}
WARNING: multiple messages have this Message-ID (diff)
From: Valerie Henson <val_henson@linux.intel.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Ulrich Drepper <drepper@redhat.com>,
Blaisorblade <blaisorblade@yahoo.it>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
Linux Memory Management <linux-mm@kvack.org>,
Val Henson <val.henson@intel.com>
Subject: Re: [patch 00/14] remap_file_pages protection support
Date: Sat, 13 May 2006 11:19:46 -0700 [thread overview]
Message-ID: <20060513181945.GC9612@goober> (raw)
In-Reply-To: <4465E981.60302@yahoo.com.au>
On Sun, May 14, 2006 at 12:13:21AM +1000, Nick Piggin wrote:
>
> OK, I got interested again, but can't get Val's ebizzy to give me
> a find_vma constrained workload yet (though the numbers back up
> my assertion that the vma cache is crap for threaded apps).
Hey Nick,
Glad to see you're using it! There are (at least) two ways to do what
you want:
1. Increase the number of threads - this gives you two vma's per
thread, one for stack, one for guard page:
$ ./ebizzy -t 100
2. Apply the patch at the end of this email and use -p "prevent
coalescing", -m "always mmap" and appropriate number of chunks,
size, and records to search - this works for me:
$ ./ebizzy -p -m -n 10000 -s 4096 -r 100000
The original program mmapped everything with the same permissions and
no alignment restrictions, so all the mmaps were coalesced into one.
This version alternates PROT_WRITE permissions on the mmap'd areas
after they are written, so you get lots of vma's:
val@goober:~/ebizzy$ ./ebizzy -p -m -n 10000 -s 4096 -r 100000
[2]+ Stopped ./ebizzy -p -m -n 10000 -s 4096 -r 100000
val@goober:~/ebizzy$ wc -l /proc/`pgrep ebizzy`/maps
10019 /proc/10917/maps
I haven't profiled to see if this brings find_vma to the top, though.
(The patch also moves around some other stuff so that options are in
alphabetical order; apparently I thought 's' came after 'r' and before
'R'...)
-VAL
--- ebizzy.c.old 2006-05-13 10:18:58.000000000 -0700
+++ ebizzy.c 2006-05-13 11:01:42.000000000 -0700
@@ -52,9 +52,10 @@
static unsigned int always_mmap;
static unsigned int never_mmap;
static unsigned int chunks;
+static unsigned int prevent_coalescing;
static unsigned int records;
-static unsigned int chunk_size;
static unsigned int random_size;
+static unsigned int chunk_size;
static unsigned int threads;
static unsigned int verbose;
static unsigned int linear;
@@ -76,9 +77,10 @@
"-m\t\t Always use mmap instead of malloc\n"
"-M\t\t Never use mmap\n"
"-n <num>\t Number of memory chunks to allocate\n"
+ "-p \t\t Prevent mmap coalescing\n"
"-r <num>\t Total number of records to search for\n"
- "-s <size>\t Size of memory chunks, in bytes\n"
"-R\t\t Randomize size of memory to copy and search\n"
+ "-s <size>\t Size of memory chunks, in bytes\n"
"-t <num>\t Number of threads\n"
"-v[v[v]]\t Be verbose (more v's for more verbose)\n"
"-z\t\t Linear search instead of binary search\n",
@@ -98,7 +100,7 @@
cmd = argv[0];
opterr = 1;
- while ((c = getopt(argc, argv, "mMn:r:s:Rt:vz")) != -1) {
+ while ((c = getopt(argc, argv, "mMn:pr:Rs:t:vz")) != -1) {
switch (c) {
case 'm':
always_mmap = 1;
@@ -111,19 +113,22 @@
if (chunks == 0)
usage();
break;
+ case 'p':
+ prevent_coalescing = 1;
+ break;
case 'r':
records = atoi(optarg);
if (records == 0)
usage();
break;
+ case 'R':
+ random_size = 1;
+ break;
case 's':
chunk_size = atoi(optarg);
if (chunk_size == 0)
usage();
break;
- case 'R':
- random_size = 1;
- break;
case 't':
threads = atoi(optarg);
if (threads == 0)
@@ -141,7 +146,7 @@
}
if (verbose)
- printf("ebizzy 0.1, Copyright 2006 Intel Corporation\n"
+ printf("ebizzy 0.2, Copyright 2006 Intel Corporation\n"
"Written by Val Henson <val_henson@linux.intel.com\n");
/*
@@ -173,10 +178,11 @@
printf("always_mmap %u\n", always_mmap);
printf("never_mmap %u\n", never_mmap);
printf("chunks %u\n", chunks);
+ printf("prevent coalescing %u\n", prevent_coalescing);
printf("records %u\n", records);
printf("records per thread %u\n", records_per_thread);
- printf("chunk_size %u\n", chunk_size);
printf("random_size %u\n", random_size);
+ printf("chunk_size %u\n", chunk_size);
printf("threads %u\n", threads);
printf("verbose %u\n", verbose);
printf("linear %u\n", linear);
@@ -251,9 +257,13 @@
{
int i, j;
- for (i = 0; i < chunks; i++)
+ for (i = 0; i < chunks; i++) {
for(j = 0; j < chunk_size / record_size; j++)
mem[i][j] = (record_t) j;
+ /* Prevent coalescing by alternating permissions */
+ if (prevent_coalescing && (i % 2) == 0)
+ mprotect(mem[i], chunk_size, PROT_READ);
+ }
if (verbose)
printf("Wrote memory\n");
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-05-13 18:20 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-30 17:29 [patch 00/14] remap_file_pages protection support blaisorblade
2006-04-30 17:29 ` [patch 01/14] Fix comment about remap_file_pages blaisorblade
2006-04-30 17:29 ` [patch 02/14] remap_file_pages protection support: add needed macros blaisorblade
2006-04-30 17:29 ` [patch 03/14] remap_file_pages protection support: handle MANYPROTS VMAs blaisorblade
2006-04-30 17:29 ` [patch 04/14] remap_file_pages protection support: disallow mprotect() on manyprots mappings blaisorblade
2006-04-30 17:29 ` [patch 05/14] remap_file_pages protection support: cleanup syscall checks blaisorblade
2006-04-30 17:29 ` [patch 06/14] remap_file_pages protection support: enhance syscall interface blaisorblade
2006-04-30 17:30 ` [patch 07/14] remap_file_pages protection support: support private vma for MAP_POPULATE blaisorblade
2006-04-30 17:30 ` [patch 08/14] remap_file_pages protection support: use FAULT_SIGSEGV for protection checking blaisorblade
2006-04-30 17:30 ` [patch 09/14] remap_file_pages protection support: fix race condition with concurrent faults on same address space blaisorblade
2006-04-30 17:30 ` [patch 10/14] remap_file_pages protection support: fix get_user_pages() on VM_MANYPROTS vmas blaisorblade
2006-04-30 17:30 ` [patch 11/14] remap_file_pages protection support: pte_present should not trigger on PTE_FILE PROTNONE ptes blaisorblade
2006-05-02 3:53 ` Nick Piggin
2006-05-02 3:53 ` Nick Piggin
2006-05-03 1:29 ` Blaisorblade
2006-05-03 1:29 ` Blaisorblade
2006-05-06 10:03 ` Nick Piggin
2006-05-06 10:03 ` Nick Piggin
2006-05-07 17:50 ` Blaisorblade
2006-05-07 17:50 ` Blaisorblade
2006-04-30 17:30 ` [patch 12/14] remap_file_pages protection support: also set VM_NONLINEAR on nonuniform VMAs blaisorblade
2006-04-30 17:30 ` [patch 13/14] remap_file_pages protection support: uml, i386, x64 bits blaisorblade
2006-04-30 17:30 ` [patch 14/14] remap_file_pages protection support: adapt to uml peculiarities blaisorblade
2006-05-02 3:45 ` [patch 00/14] remap_file_pages protection support Nick Piggin
2006-05-02 3:45 ` Nick Piggin
2006-05-02 3:56 ` Nick Piggin
2006-05-02 3:56 ` Nick Piggin
2006-05-02 11:24 ` Ingo Molnar
2006-05-02 11:24 ` Ingo Molnar
2006-05-02 12:19 ` Nick Piggin
2006-05-02 12:19 ` Nick Piggin
2006-05-02 17:16 ` Lee Schermerhorn
2006-05-02 17:16 ` Lee Schermerhorn
2006-05-03 1:20 ` Blaisorblade
2006-05-03 1:20 ` Blaisorblade
2006-05-03 14:35 ` Lee Schermerhorn
2006-05-03 14:35 ` Lee Schermerhorn
2006-05-03 0:25 ` Blaisorblade
2006-05-03 0:25 ` Blaisorblade
2006-05-06 16:05 ` Ulrich Drepper
2006-05-07 4:22 ` Nick Piggin
2006-05-07 4:22 ` Nick Piggin
2006-05-13 14:13 ` Nick Piggin
2006-05-13 18:19 ` Valerie Henson [this message]
2006-05-13 18:19 ` Valerie Henson
2006-05-13 22:54 ` Valerie Henson
2006-05-13 22:54 ` Valerie Henson
2006-05-16 13:30 ` Nick Piggin
2006-05-16 13:30 ` Nick Piggin
2006-05-16 13:51 ` Andreas Mohr
2006-05-16 13:51 ` Andreas Mohr
2006-05-16 16:31 ` Valerie Henson
2006-05-16 16:31 ` Valerie Henson
2006-05-16 16:47 ` Andreas Mohr
2006-05-16 16:47 ` Andreas Mohr
2006-05-17 3:25 ` Nick Piggin
2006-05-17 3:25 ` Nick Piggin
2006-05-17 6:10 ` Blaisorblade
2006-05-17 6:10 ` Blaisorblade
2006-05-16 16:33 ` Valerie Henson
2006-05-16 16:33 ` Valerie Henson
2006-05-03 0:44 ` Blaisorblade
2006-05-03 0:44 ` Blaisorblade
2006-05-06 9:06 ` Nick Piggin
2006-05-06 9:06 ` Nick Piggin
2006-05-06 15:26 ` Ulrich Drepper
2006-05-02 10:21 ` Arjan van de Ven
2006-05-02 23:46 ` Valerie Henson
2006-05-03 0:26 ` Blaisorblade
2006-05-03 1:44 ` Ulrich Drepper
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=20060513181945.GC9612@goober \
--to=val_henson@linux.intel.com \
--cc=akpm@osdl.org \
--cc=blaisorblade@yahoo.it \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=val.henson@intel.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.