cvs commit: src/sys/sys systm.h src/sys/i386/i386 mp_machdep.c src/sys/amd64/amd64 mp_machdep.c src/sys/geom/stripe g_stripe.c g_stripe.h

Bruce Evans bde at zeta.org.au
Sat Aug 20 06:58:45 GMT 2005


On Fri, 19 Aug 2005, Pawel Jakub Dawidek wrote:

> pjd         2005-08-19 22:10:19 UTC
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/sys              systm.h
>    sys/i386/i386        mp_machdep.c
>    sys/amd64/amd64      mp_machdep.c
>    sys/geom/stripe      g_stripe.c g_stripe.h
>  Log:
>  Avoid code duplication and implement bitcount32() function in systm.h only.
>
>  Reviewed by:    cperciva
>  MFC after:      3 days
>
>  Revision  Changes    Path
>  1.262     +1 -53     src/sys/amd64/amd64/mp_machdep.c
>  1.27      +1 -1      src/sys/geom/stripe/g_stripe.c
>  1.8       +0 -6      src/sys/geom/stripe/g_stripe.h
>  1.253     +1 -53     src/sys/i386/i386/mp_machdep.c
>  1.235     +52 -0     src/sys/sys/systm.h

Kernel library inline functions go in libkern.h.  Kernel library functions
that are too large to be inline go in libkern.  The comment in this one
wonders if it should be in libkern.

I think it is too large to be inline if its efficiency is unimportant and
not as efficient as it should be if its efficiency is important.  I get
the following times for popcount() of the first 10^8 integers (everything
cached) on an AthlonXP 2600 overclocked (-O2 -march=athlon-xp):

inline popcount:          0.68 seconds
static popcount:          1.03
inline popcount1:         0.71
static popcount1:         1.08
inline table[256] lookup: 0.29              with table of u_ints
static table[256] lookup: 0.63
inline table[16] lookup:  0.63
static table[16] lookup:  1.08
inline table[256] lookup: 0.40              with table of u_chars
static table[256] lookup: 0.67

Bruce


More information about the cvs-all mailing list