Module Name: src
Committed By: rin
Date: Sun Mar 14 02:53:57 UTC 2021
Modified Files:
src/sys/sys: systm.h
Log Message:
Comment on CTASSERT() in COND_SET_STRUCT(); this is a sanity check to
avoid hashing/assigning large structure. Upper-bound is arbitrary, but
be carefully for performance penalty if bumping.
Thanks christos for discussion.
To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/sys/systm.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.299 src/sys/sys/systm.h:1.300
--- src/sys/sys/systm.h:1.299 Wed Mar 10 13:27:51 2021
+++ src/sys/sys/systm.h Sun Mar 14 02:53:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: systm.h,v 1.299 2021/03/10 13:27:51 simonb Exp $ */
+/* $NetBSD: systm.h,v 1.300 2021/03/14 02:53:57 rin Exp $ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
@@ -192,6 +192,11 @@ enum hashtype {
#ifdef _KERNEL
#define COND_SET_STRUCT(dst, src, allow) \
do { \
+ /* \
+ * Make sure we don't end up hashing/assigning large \
+ * structure for performance. Upper-bound is arbitrary, \
+ * but consider before bumping. \
+ */ \
CTASSERT(sizeof(src) < 32); \
if (allow) \
dst = src; \