Re: mmap(2) performance netbsd-1-6 vs. -current

Bang Jun-Young <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel,gmane.os.netbsd.devel.performance
Message-ID <[email protected]>
On Sun, Oct 19, 2003 at 11:18:18AM -0700, Jason Thorpe wrote:
> 
> On Sunday, October 19, 2003, at 09:51  AM, Bang Jun-Young wrote:
> 
> >The test program used is as follows (please don't blame me for its
> >silliness, I just wanted to see a rough difference in minutes :-):
> 
> Ok, I'll ignore the silliness, but I will point out a couple of bugs :-)
> 
> >#include <stdio.h>
> >#include <sys/mman.h>
> >
> >main()
> >{
> >	void *ptr[15];
> >	int i, j;
> >	size_t size;
> >
> >	for (j = 0; j < 40960; j++) {
> >		for (i = 0; i < 15; i++) {
> >			size = 4096 << i;
> >			ptr[i] = mmap(NULL, size, PROT_READ|PROT_WRITE, 
> >			MAP_ANON, -1, 0);
> >			if (ptr == NULL)
> >				err("NULL returned, i=%d\n", i);
> 
> There are two problems with this code:
> 
> 	- mmap() returns MAP_FAILED, not NULL, on faulure.
> 	- "ptr" will never be null anyway!  I think you really want to
> 	  be testing ptr[i].
> 
> >			*((int *)ptr) = 0xdeadbeef;
> 
> ...and, here again, you want to be dereferencing ptr[i].

Oops, I was too lucky... :-)

After fixing the bugs you pointed out, the result is a bit more
interesting (and rather disappointing):

-current:
	real 17.606s user 0.580s sys 17.026s

netbsd-1-6:
	real 17.831s user 0.648s sys 16.985s

This time numbers varied slightly, so I took the median values of 10
trials. Here, -current was only marginally faster than netbsd-1-6,
and it's obvious that it had nothing to do with improvements made in
UVM in -current. This result makes me wonder why the previous silly
test showed such a noticable difference.

Jun-Young

-- 
Bang Jun-Young <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.