Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Comment on CTASSERT() in COND_SET_STRUCT(); this is ...
details: https://anonhg.NetBSD.org/src/rev/f062fc1b2170
branches: trunk
changeset: 960287:f062fc1b2170
user: rin <rin%NetBSD.org@localhost>
date: Sun Mar 14 02:53:57 2021 +0000
description:
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.
diffstat:
sys/sys/systm.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (21 lines):
diff -r 68e8fc4006b5 -r f062fc1b2170 sys/sys/systm.h
--- a/sys/sys/systm.h Sun Mar 14 01:44:37 2021 +0000
+++ b/sys/sys/systm.h Sun Mar 14 02:53:57 2021 +0000
@@ -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 @@
#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; \
Home |
Main Index |
Thread Index |
Old Index