Subject: Re: NEWPIPE: benchmark performance diff microtime(9) vs. =
To: Alfred Perlstein <bright@mu.org>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 10/26/2001 00:12:54
Alfred Perlstein wrote:
> What about arches that have 16k pages or something? I know the
> 8192 is ugly, but it sort of makes sense as a hardcoded value
> rather than using some arbitrary multiple of PAGE_SIZE.
Well, the basic idea is that it doesn't seem to make too much sense
to loan piece of memory < PAGE_SIZE (Page Loan works by pages).
That's why I used PAGE_SIZE as basic atom. More recent tests
show up that the overhead of Page Loan setup seems to still
be higher than the gain for i386 page size (4k), so bumping it
to higher value is desirable.
It _may_ make more sense to just use hardcoded value. One issue
to consider is that the pages is marked COW while loaned.
If the pipe buffer only takes part of the buffer, some other
thread might touch other part of memory which happens to be on
same page and cause a page fault. This could eliminate quite
a big part of performance gain of page loan. At least this is
a theory I have :)
> Btw, if you wouldn't mind sharing, what would make this faster
> than FreeBSD's version? The optimized timestamp? Or is there
> something else FreeBSD can learn from your implementation?
Not much. The current performance gain on NetBSD is merely
due to using less accurate, but much faster way to determine current
time. FreeBSD seems to already have zippy microtime(9) implementation
using TSC, so the difference between version using vfs_timestamp()
and plain 'time' would not probably that big on FreeBSD.
There is implementation of microtime(9) using TSC on NetBSD i386
SMP branch, it's called tsc_microtime(). I'm currently experimenting
with the code. The results are very promising so far (hbench reports
further performance jump of like 30-100%). This is probably mainly due
to faster context switch (microtime(9) is called twice on every context
switch currently, as pointed out to me by Charles M. Hannum).
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-= Those who would give up liberty for a little temporary safety deserve =-
-= neither liberty nor safety, and will lose both. -- Benjamin Franklin =-