Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Sep 2000 07:48:17 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Justin T. Gibbs" <gibbs@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys libkern.h
Message-ID:  <Pine.BSF.4.21.0009260714300.12605-100000@besplex.bde.org>
In-Reply-To: <200009250629.XAA65780@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 24 Sep 2000, Justin T. Gibbs wrote:

> gibbs       2000/09/24 23:29:16 PDT
> 
>   Modified files:        (Branch: RELENG_4)
>     sys/sys              libkern.h 
>   Log:
>   MFC: Rev 1.23 - Add memset and memcpy as inline functions to bzero/bcopy.

You mean memcmp and memset (memcpy was already a (non-inline) function).
This mistake in -current shouldn't have been propagated.

1. The memcmp implementation is plain broken (memcmp can't be implemented
   using bcmp, since bcmp returns a boolean and memcmp returns a 3-way value).
   Only bcmp seems to be needed.
2. There was no need for memset to a nonzero value.  Now, some functions in
   dev/randomdev may benefit from an optimized memset.  The pessimized memset
   in libkern is no substitute.
3. Implementing memcpy is a an older mistake.  It was supposed to be used
   if and only if the count is small and constant and their is no overlap
   (then the compiler builtin memcpy is better than the kernel bcopy).
   This should have been implemented by making bcopy inline (small constant
   counts can be detected at compile time, as in Linux's memcpy).  It
   doesn't matter if the function is called bcopy or memcpy, but there
   should be only one version of it so that optimizations aren't wasted.
   (Actually, it does matter.  bcopy is required to handle overlapping
   copies, so many of the optimizations for memcpy aren't valid for bcopy.)

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009260714300.12605-100000>