From: Brice Goglin <Brice.Goglin@inria.fr>
To: Stefan Lankes <lankes@lfbs.rwth-aachen.de>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
'Andi Kleen' <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, linux-numa@vger.kernel.org,
Boris Bierbaum <boris@lfbs.RWTH-Aachen.DE>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [RFC PATCH 0/4]: affinity-on-next-touch
Date: Mon, 22 Jun 2009 21:10:25 +0200 [thread overview]
Message-ID: <4A3FD721.3050606@inria.fr> (raw)
In-Reply-To: <4A3FC68A.2030104@lfbs.rwth-aachen.de>
[-- Attachment #1: Type: text/plain, Size: 495 bytes --]
Stefan Lankes wrote:
> I am not able to reconstruct any performance drawbacks on my system.
> Could you send me your low-level benchmark?
It's attached. As you may see, it's fairly trivial. It just does several
iterations of mbind+touch_all_pages for different power-of-two buffer
sizes. Just replace mbind with madvise in the inner loop if you want to
try with your affinit-on-next-touch.
Which kernels are you using when comparing your next-touch
implementation with Lee's patchset?
Brice
[-- Attachment #2: next-touch-mof-cost.c --]
[-- Type: text/x-csrc, Size: 2044 bytes --]
#define _GNU_SOURCE 1
#include <unistd.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <numa.h>
#include <numaif.h>
#include <errno.h>
#include <sched.h>
#ifndef MPOL_MF_LAZY
#define MPOL_MF_LAZY (1<<3)
#endif
#define TOTALPAGES 262144
int nbpages, loop;
int pagesize;
int main(int argc, char **argv) {
void *buffer;
int i, err;
unsigned long nodemask;
int maxnode;
struct timeval tv1, tv2;
unsigned long us;
cpu_set_t cset;
/* put the thread on node 0 */
CPU_ZERO(&cset);
CPU_SET(0, &cset);
err = sched_setaffinity(0, sizeof(cset), &cset);
if (err < 0) {
perror("sched_setaffinity");
exit(-1);
}
pagesize = getpagesize();
maxnode = numa_max_node();
fprintf(stdout, "# Nb_pages\tCost(ns)\n");
for(nbpages=2 ; nbpages<=TOTALPAGES ; nbpages*=2) {
int loops = TOTALPAGES/nbpages;
if (loops > 128) loops = 128;
buffer = mmap(NULL, TOTALPAGES*pagesize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (buffer == MAP_FAILED) {
perror("mmap");
exit(-1);
}
/* bind to node 1 and prefault */
nodemask = 1<<1;
err = mbind(buffer, TOTALPAGES*pagesize, MPOL_BIND, &nodemask, maxnode+2, MPOL_MF_MOVE);
if (err < 0) {
perror("mbind");
exit(-1);
}
for(i=0 ; i<TOTALPAGES ; i++)
*(int*)(buffer+i*pagesize) = 0;
gettimeofday(&tv1, NULL);
for(loop=0 ; loop<loops ; loop++) {
/* mark subbuf as next-touch and touch it */
void *subbuf = buffer + loop*nbpages*pagesize;
err = mbind(subbuf, nbpages*pagesize, MPOL_PREFERRED, NULL, 0, MPOL_MF_MOVE|MPOL_MF_LAZY);
if (err < 0) {
perror("mbind");
exit(-1);
}
for(i=0;i<nbpages;i++)
*(int*)(subbuf + i*pagesize) = 42;
}
gettimeofday(&tv2, NULL);
us = (tv2.tv_sec - tv1.tv_sec) * 1000000 + (tv2.tv_usec - tv1.tv_usec);
fprintf(stdout, "%d\t%ld\n", nbpages, us * 1000/loops);
fflush(stdout);
munmap(buffer, TOTALPAGES*pagesize);
}
return 0;
}
next prev parent reply other threads:[~2009-06-22 19:10 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <000c01c9d212$4c244720$e46cd560$@rwth-aachen.de>
2009-05-11 13:22 ` [RFC PATCH 0/4]: affinity-on-next-touch Andi Kleen
2009-05-11 13:32 ` Brice Goglin
2009-05-11 14:54 ` Stefan Lankes
2009-05-11 16:37 ` Andi Kleen
2009-05-11 17:22 ` Stefan Lankes
2009-06-11 18:45 ` Stefan Lankes
2009-06-12 10:32 ` Andi Kleen
2009-06-12 11:46 ` Stefan Lankes
2009-06-12 12:30 ` Brice Goglin
2009-06-12 13:21 ` Stefan Lankes
2009-06-12 13:48 ` Stefan Lankes
2009-06-16 2:39 ` Lee Schermerhorn
2009-06-16 13:58 ` Stefan Lankes
2009-06-16 14:59 ` Lee Schermerhorn
2009-06-17 1:22 ` KAMEZAWA Hiroyuki
2009-06-17 12:02 ` Lee Schermerhorn
2009-06-17 7:45 ` Stefan Lankes
2009-06-18 4:37 ` Lee Schermerhorn
2009-06-18 19:04 ` Lee Schermerhorn
2009-06-19 15:26 ` Lee Schermerhorn
2009-06-19 15:41 ` Balbir Singh
2009-06-19 15:59 ` Lee Schermerhorn
2009-06-19 21:19 ` Stefan Lankes
2009-06-22 12:34 ` Brice Goglin
2009-06-22 14:24 ` Lee Schermerhorn
2009-06-22 15:28 ` Brice Goglin
2009-06-22 16:55 ` Lee Schermerhorn
2009-06-22 17:06 ` Brice Goglin
2009-06-22 17:59 ` Stefan Lankes
2009-06-22 19:10 ` Brice Goglin [this message]
2009-06-22 20:16 ` Stefan Lankes
2009-06-22 20:34 ` Brice Goglin
2009-06-22 14:32 ` Stefan Lankes
2009-06-22 14:56 ` Lee Schermerhorn
2009-06-22 15:42 ` Stefan Lankes
2009-06-22 16:38 ` Lee Schermerhorn
2009-06-16 2:25 ` Lee Schermerhorn
2009-06-20 7:24 ` Brice Goglin
2009-06-22 13:49 ` Lee Schermerhorn
2009-06-16 2:21 ` Lee Schermerhorn
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=4A3FD721.3050606@inria.fr \
--to=brice.goglin@inria.fr \
--cc=Lee.Schermerhorn@hp.com \
--cc=andi@firstfloor.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=boris@lfbs.RWTH-Aachen.DE \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=lankes@lfbs.rwth-aachen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-numa@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;
as well as URLs for NNTP newsgroup(s).