There are plenty of other places where we would prefer a high-quality
random number generator (and they are all called infrequently).  You would
need to evaluate all callers of random_get_pseudo_bytes() in the ZFS
codebase.

I would suggest just changing the use cases that are in the hot code path,
like vdev_mirror_map_alloc().  You might be able to get away with an even
simpler pseudo-random number generator (for small numbers), like
gethrtime() % <prime number>.

--matt


On Tue, Jul 22, 2014 at 5:35 PM, Richard Yao via illumos-zfs <
[email protected]> wrote:

> On 07/22/2014 05:17 PM, Saso Kiselkov wrote:
> > On 7/22/14, 10:11 PM, Richard Yao via illumos-zfs wrote:
> >> Would the Illumos ZFS developers be interested in this change?
> >
> > Seems neat, I'd like to see this implemented in Illumos as well, though
> > I'd like to keep the old generator for things like vdev GUIDs.
>
> The following patch does that:
>
> https://github.com/ryao/zfs/commit/625dc22ff3d0659a2ac30c8462cc8e8dba9fb8da
>
> Unfortunately, ztest segfaults on my system when this patch is applied:
>
> Program terminated with signal 11, Segmentation fault.
> #0  0x00007fbfc3118f14 in __GI___libc_free (mem=0x23ab7c0) at malloc.c:2906
> 2906      ar_ptr = arena_for_chunk(p);
> (gdb) bt
> #0  0x00007fbfc3118f14 in __GI___libc_free (mem=0x23ab7c0) at malloc.c:2906
> #1  0x00007fbfc3bfd435 in umem_free (size=512, ptr=<optimized out>) at
> ../../lib/libspl/include/umem.h:132
> #2  spa_random_fini () at ../../module/zfs/spa_misc.c:1653
> #3  0x00007fbfc3bfd62f in spa_fini () at ../../module/zfs/spa_misc.c:1725
> #4  0x00007fbfc3b88959 in kernel_fini () at
> ../../lib/libzpool/kernel.c:1144
> #5  0x0000000000406bd4 in ztest_init (zs=zs@entry=0x7fbfc4519498) at
> ../../cmd/ztest/ztest.c:6045
> #6  0x0000000000408246 in ztest_run_init () at ../../cmd/ztest/ztest.c:6227
> #7  main (argc=1, argv=<optimized out>) at ../../cmd/ztest/ztest.c:6285
>
> Running ztest with jemalloc via LD_PRELOAD makes things work, which
> suggests that this is a bug in glibc's malloc(). I doubt other platforms
> care about that, but that will likely be enough to keep this out of ZoL
> until the flaw has been identified.
>
>
>
>
> -------------------------------------------
> illumos-zfs
> Archives: https://www.listbox.com/member/archive/182191/=now
> RSS Feed:
> https://www.listbox.com/member/archive/rss/182191/21635000-ebd1d460
> Modify Your Subscription:
> https://www.listbox.com/member/?member_id=21635000&id_secret=21635000-73dc201a
> Powered by Listbox: http://www.listbox.com
>
_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to