From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
cl@linux-foundation.org,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
minchan.kim@gmail.com, mingo@elte.hu
Subject: Re: [RFC mm][PATCH 0/5] per mm counter updates
Date: Thu, 10 Dec 2009 17:03:39 +0900 [thread overview]
Message-ID: <20091210170339.072b24a7.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20091210163115.463d96a3.kamezawa.hiroyu@jp.fujitsu.com>
This is test program I used. This is tuned for 4core/socket.
==
/*
* multi-fault.c :: causes 60secs of parallel page fault in multi-thread.
* % gcc -O2 -o multi-fault multi-fault.c -lpthread
* % multi-fault # of cpus.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <sched.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#define CORE_PER_SOCK 4
#define NR_THREADS 8
pthread_t threads[NR_THREADS];
/*
* For avoiding contention in page table lock, FAULT area is
* sparse. If FAULT_LENGTH is too large for your cpus, decrease it.
*/
#define MMAP_LENGTH (8 * 1024 * 1024)
#define FAULT_LENGTH (2 * 1024 * 1024)
void *mmap_area[NR_THREADS];
#define PAGE_SIZE 4096
pthread_barrier_t barrier;
int name[NR_THREADS];
void segv_handler(int sig)
{
sleep(100);
}
void *worker(void *data)
{
cpu_set_t set;
int cpu;
cpu = *(int *)data;
CPU_ZERO(&set);
CPU_SET(cpu, &set);
sched_setaffinity(0, sizeof(set), &set);
cpu /= CORE_PER_SOCK;
while (1) {
char *c;
char *start = mmap_area[cpu];
char *end = mmap_area[cpu] + FAULT_LENGTH;
pthread_barrier_wait(&barrier);
//printf("fault into %p-%p\n",start, end);
for (c = start; c < end; c += PAGE_SIZE)
*c = 0;
pthread_barrier_wait(&barrier);
madvise(start, FAULT_LENGTH, MADV_DONTNEED);
}
return NULL;
}
int main(int argc, char *argv[])
{
int i, ret;
unsigned int num;
if (argc < 2)
return 0;
num = atoi(argv[1]);
pthread_barrier_init(&barrier, NULL, num);
mmap_area[0] = mmap(NULL, MMAP_LENGTH * num, PROT_WRITE|PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
for (i = 1; i < num; i++) {
mmap_area[i] = mmap_area[i - 1]+ MMAP_LENGTH;
}
for (i = 0; i < num; ++i) {
name[i] = i * CORE_PER_SOCK;
ret = pthread_create(&threads[i], NULL, worker, &name[i]);
if (ret < 0) {
perror("pthread create");
return 0;
}
}
sleep(60);
return 0;
}
--
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>
prev parent reply other threads:[~2009-12-10 8:06 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 7:31 KAMEZAWA Hiroyuki
2009-12-10 7:33 ` [RFC mm][PATCH 1/5] mm counter cleanup KAMEZAWA Hiroyuki
2009-12-10 17:30 ` Christoph Lameter
2009-12-10 23:42 ` KAMEZAWA Hiroyuki
2009-12-11 0:07 ` Minchan Kim
2009-12-10 7:34 ` [RFC mm][PATCH 2/5] percpu cached mm counter KAMEZAWA Hiroyuki
2009-12-10 7:54 ` Ingo Molnar
2009-12-10 8:20 ` KAMEZAWA Hiroyuki
2009-12-10 8:33 ` Ingo Molnar
2009-12-10 8:42 ` KAMEZAWA Hiroyuki
2009-12-10 17:35 ` Christoph Lameter
2009-12-10 17:38 ` Ingo Molnar
2009-12-10 18:04 ` Christoph Lameter
2009-12-10 18:54 ` Ingo Molnar
2009-12-11 0:11 ` KAMEZAWA Hiroyuki
2009-12-10 17:34 ` Christoph Lameter
2009-12-10 17:51 ` Christoph Lameter
2009-12-11 0:30 ` KAMEZAWA Hiroyuki
2009-12-11 0:40 ` Minchan Kim
2009-12-11 0:51 ` KAMEZAWA Hiroyuki
2009-12-11 1:25 ` Minchan Kim
2009-12-11 1:26 ` KAMEZAWA Hiroyuki
2009-12-10 7:59 ` [RFC mm][PATCH 3/5] counting swap ents per mm KAMEZAWA Hiroyuki
2009-12-10 17:55 ` Christoph Lameter
2009-12-11 0:33 ` KAMEZAWA Hiroyuki
2009-12-11 1:07 ` Minchan Kim
2009-12-10 8:00 ` [RFC mm][PATCH 4/5] add a lowmem check function KAMEZAWA Hiroyuki
2009-12-10 17:59 ` Christoph Lameter
2009-12-11 0:39 ` KAMEZAWA Hiroyuki
2009-12-11 13:35 ` Christoph Lameter
2009-12-11 1:09 ` Minchan Kim
2009-12-10 8:01 ` [RFC mm][PATCH 5/5] counting lowmem rss per mm KAMEZAWA Hiroyuki
2009-12-11 1:12 ` Minchan Kim
2009-12-10 8:03 ` KAMEZAWA Hiroyuki [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=20091210170339.072b24a7.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--cc=mingo@elte.hu \
/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