Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152763054
D3197.id7292.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D3197.id7292.diff
View Options
Index: sys/conf/NOTES
===================================================================
--- sys/conf/NOTES
+++ sys/conf/NOTES
@@ -2984,6 +2984,7 @@
# If neither is present, then the Fortuna algorithm is used.
options RANDOM_YARROW # Yarrow CSPRNG (old default)
#options RANDOM_DUMMY # Dummy CSPRNG that always blocks
+options RANDOM_ENABLE_UMA # slab allocator
# For developers.
options RANDOM_DEBUG # Extra debugging messages
Index: sys/conf/options
===================================================================
--- sys/conf/options
+++ sys/conf/options
@@ -950,6 +950,9 @@
# These are mutually exclusive. With neither, Fortuna is selected.
RANDOM_DUMMY opt_global.h
RANDOM_YARROW opt_random.h
+# This turns on high-rate and potentially expensive harvesting in
+# the uma slab allocator.
+RANDOM_ENABLE_UMA opt_global.h
# Intel em(4) driver
EM_MULTIQUEUE opt_em.h
Index: sys/sys/random.h
===================================================================
--- sys/sys/random.h
+++ sys/sys/random.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000-2013 Mark R. V. Murray
+ * Copyright (c) 2000-2015 Mark R. V. Murray
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -86,6 +86,12 @@
void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source);
#endif /* defined(RANDOM_DUMMY) */
+#if defined(RANDOM_ENABLE_UMA)
+#define random_harvest_fast_uma(a, b, c, d) random_harvest_fast(a, b, c, d)
+#else /* !defined(RANDOM_ENABLE_UMA) */
+#define random_harvest_fast_uma(a, b, c, d) do {} while (0)
+#endif /* defined(RANDOM_ENABLE_UMA) */
+
#endif /* _KERNEL */
#endif /* _SYS_RANDOM_H_ */
Index: sys/vm/uma_core.c
===================================================================
--- sys/vm/uma_core.c
+++ sys/vm/uma_core.c
@@ -2135,8 +2135,11 @@
int lockfail;
int cpu;
- /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */
- random_harvest_fast(&zone, sizeof(zone), 1, RANDOM_FAST);
+ /*
+ * This is only enabled by kernel option.
+ * If not enabled, it is a null macro.
+ */
+ random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_FAST);
/* This is the fast path allocation */
#ifdef UMA_DEBUG_ALLOC_1
@@ -2677,8 +2680,11 @@
int lockfail;
int cpu;
- /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */
- random_harvest_fast(&zone, sizeof(zone), 1, RANDOM_FAST);
+ /*
+ * This is only enabled by kernel option.
+ * If not enabled, it is a null macro.
+ */
+ random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_FAST);
#ifdef UMA_DEBUG_ALLOC_1
printf("Freeing item %p to %s(%p)\n", item, zone->uz_name, zone);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 17, 11:27 PM (13 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31685798
Default Alt Text
D3197.id7292.diff (2 KB)
Attached To
Mode
D3197: Do not compile in the really expensive entropy harvesting unless it is requested.
Attached
Detach File
Event Timeline
Log In to Comment