Page MenuHomeFreeBSD

D34452.id103551.diff
No OneTemporary

D34452.id103551.diff

Index: sys/vm/uma_core.c
===================================================================
--- sys/vm/uma_core.c
+++ sys/vm/uma_core.c
@@ -3632,6 +3632,10 @@
return (cache_alloc_item(zone, cache, bucket, NULL, flags));
}
+#if defined(INVARIANTS) && (defined(DDB) || defined(STACK))
+#include <sys/stack.h>
+#endif
+
/* See uma.h */
void *
uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
@@ -3639,6 +3643,31 @@
uma_cache_bucket_t bucket;
uma_cache_t cache;
+ _Static_assert(M_NOWAIT != 0 && M_WAITOK != 0,
+ "M_NOWAIT and M_WAITOK must be non-zero for this assertion:");
+#if 0
+ /*
+ * Give people time to find problems with the #else option below,
+ * then enable this instead. (Remove <sys/stack.h> above, too.)
+ */
+ KASSERT((flags & (M_NOWAIT|M_WAITOK)) == M_NOWAIT ||
+ (flags & (M_NOWAIT|M_WAITOK)) == M_WAITOK,
+ ("uma_zalloc_arg: must pass exactly one of M_NOWAIT or M_WAITOK"));
+#elif defined(INVARIANTS) && (defined(DDB) || defined(STACK))
+ if (__predict_false((flags & (M_NOWAIT|M_WAITOK)) != M_NOWAIT &&
+ (flags & (M_NOWAIT|M_WAITOK)) != M_WAITOK)) {
+ static int stack_count;
+ struct stack st;
+
+ if (stack_count < 10) {
+ ++stack_count;
+ printf("uma_zalloc_arg called with bad WAIT flags:\n");
+ stack_save(&st);
+ stack_print(&st);
+ }
+ }
+#endif
+
/* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */
random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 11:37 AM (10 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15613935
Default Alt Text
D34452.id103551.diff (1 KB)

Event Timeline