CFR: unifing sha256 userland/kernel implementation...

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Feb 14 14:25:25 UTC 2014


On Tue, Feb 11, 2014 at 04:39:07PM -0800, John-Mark Gurney wrote:
> John-Mark Gurney wrote this message on Tue, Feb 11, 2014 at 10:56 -0800:
> > I did some performance testing on sha256, and found that the libmd
> > version is significantly faster, ~20%, than the kernel version.  Even
> > if you enable SHA2_UNROLL_TRANSFORM (which isn't the default), the
> > version in libmd is still faster.
> > 
> > So, this patch moves libmd's sha256c.c and sha256.h into the kernel,
> > and adapts the userland to pull the version from the kernel.  This
> > change removes sha256 from the existing sha2.c file, and does some
> > minor cleanup of types in sha2.
> > 
> > I have tested this w/ ZFS using sha256 checksums, and a ZFS made
> > pre-patch is read fine by a kernel post patch.  I have also run
> > the tests in lib/libmd and they all pass fine.  Passes
> > buildworld/buildkernel/installkernel/reboot/installworld/reboot/test.
> > 
> > Patch:
> > https://www.funkthat.com/~jmg/sha256.kern.patch
> > 
> > Following stats are in seconds to digest 100000 10000-byte blocks,
> > calculated using sha256 -t:
> > $ ministat soft.times kernsoft.times 
> > x soft.times
> > + kernsoft.times
> > +------------------------------------------------------------------------------+
> > |x                   xx      xx             +++  +                            +|
> > |        |___________AM_________|     |_______M_____A______________|           |
> > +------------------------------------------------------------------------------+
> >     N           Min           Max        Median           Avg        Stddev
> > x   5      6.775387      8.279581      7.848128      7.792094    0.60912664
> > +   5      8.997429     10.768921      9.090787     9.4359144    0.75040822
> > Difference at 95.0% confidence
> >         1.64382 +/- 0.99674
> >         21.096% +/- 12.7917%
> >         (Student's t, pooled s = 0.683428)
> > 
> > This is in preperation of bringing in an SSE4 accelerated version of
> > sha256 (for both userland and kernel) that sees a 2x performance
> > increase.

I can't wait:)

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://mobter.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140214/92d8d9da/attachment.sig>


More information about the freebsd-arch mailing list