From owner-cvs-all Mon Dec 18 13:16:32 2000 From owner-cvs-all@FreeBSD.ORG Mon Dec 18 13:16:27 2000 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 9F60B37B402; Mon, 18 Dec 2000 13:16:25 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_18979)/8.9.3) with ESMTP id IAA21355; Tue, 19 Dec 2000 08:16:20 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37641) with ESMTP id <01JXVR2V5ECGE7YU7K@cim.alcatel.com.au>; Tue, 19 Dec 2000 08:15:57 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.0/8.11.0) id eBILGGF58627; Tue, 19 Dec 2000 08:16:16 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Tue, 19 Dec 2000 08:16:16 +1100 From: Peter Jeremy Subject: Re: cvs commit: src/sys/libkern strlcat.c strlcpy.c src/sys/sys libkern.h src/sys/conf files In-reply-to: <200012181724.KAA91757@harmony.village.org>; from imp@village.org on Mon, Dec 18, 2000 at 10:24:28AM -0700 To: Warner Losh Cc: Assar Westerlund , Dag-Erling Smorgrav , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Mail-followup-to: Warner Losh , Assar Westerlund , Dag-Erling Smorgrav , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Message-id: <20001219081616.D54775@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <5l4s01ka92.fsf@assaris.sics.se> <200012180408.eBI48wg99879@freefall.freebsd.org> <5l66khluty.fsf@assaris.sics.se> <5lsnnlkcf7.fsf@assaris.sics.se> <5l4s01ka92.fsf@assaris.sics.se> <200012181724.KAA91757@harmony.village.org> Sender: jeremyp@gsmx07.alcatel.com.au Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2000-Dec-18 10:24:28 -0700, Warner Losh wrote: > The one in libc is known to >be good and not have any bugs, so why reinvent it for the kernel? I'd go further and say that unless there is a compelling reason otherwise, libkern should always use the code in libc (or vice versa). It's a pity that our source structure doesn't allow us to use the same file (you can checkout and build the kernel without installing the userland sources). >The paper that was presented at Usenix shows that these routines were >nearly as fast as the hand tweaked assembler that they replaced on >intel. Not sure about other architectures. The Alpha (particularly older implementations) are very poor at byte-handling. I'm not sure about the IA64, but I suspect it's the same. Keep in mind that gcc doesn't generate brilliant code on the Alpha (and probably the IA64) - which won't help. My experience is that unrolling the loop to the point where you are copying long's is a win on all architectures. Have a look at /sys/libkern/bcmp.c for sample code. Adapting it for bcopy/memcpy is trivial. Adapting it for str[ln]{cpy,cmp,cat} is non-trivial on the i386 but not too difficult on the Alpha (using CMPBGE). I'm not sure about the IA64. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message