From owner-freebsd-arch Sun Feb 17 16:52: 4 2002 Delivered-To: freebsd-arch@freebsd.org Received: from falcon.prod.itd.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by hub.freebsd.org (Postfix) with ESMTP id 2C93537B428; Sun, 17 Feb 2002 16:51:56 -0800 (PST) Received: from pool0152.cvx21-bradley.dialup.earthlink.net ([209.179.192.152] helo=mindspring.com) by falcon.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16cc1n-0004xN-00; Sun, 17 Feb 2002 16:51:35 -0800 Message-ID: <3C70500B.31282873@mindspring.com> Date: Sun, 17 Feb 2002 16:51:23 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans Cc: Poul-Henning Kamp , Matthew Dillon , Julian Elischer , Alfred Perlstein , arch@FreeBSD.ORG, jhb@FreeBSD.ORG, peter@wemm.org, jake@locore.ca Subject: Re: gettimeofday() and crhold()/crfree() (was Re: gettimeofday()andcopyout(). Is copyout() MPSAFE on non-i386 archs? ) References: <20020218112751.T3970-100000@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans wrote: > > If we want to do fancy timekeeping, I have/had a patch which put > > the timecounters on a single page which a process could map (hacked > > with a special device driver). Provided that the process has acccess > > to reading the timecounter (== not i8254) all the time-calculations > > can be done in userland without any calls into the kernel. > > I know the synchronization costs for this would be high. They are too > high even in the kernel, so we skip them for the get*time() family, > at the cost of getting unsynchronised times. This may be acceptable > in some applications. The read-only variable in kernel memory has > similar synchronisation problems. It corresponds fairly directly > with the variable read by the get*time() family. I *know* that it is a significant win to flip-flop the timecounter context into a reflected user space page on each and every clock interrupt. The benefits to doing this for squid alone, which must make about 5 gettimeofday() calls per transaction in order to do "correct" logging (IMO, logging is eye candy, though some idiots insist on billing based on post processing log files), are more than significant, they are a doubling of the transaction rate. Crossing protection domains for read-only data which is frequently accessed is a really, really bad idea. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message