summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2008-02-01 11:01:15 +0000
committermav <mav@FreeBSD.org>2008-02-01 11:01:15 +0000
commit49092fb3fc0e8e52a381c2a4d5f8fddf6e5b1b1e (patch)
tree046b65347477fa717b0dd934ff88f5aafb0ef814 /sys/netgraph
parent7e0b4128cbb5e697e9bb8b7926e9129aeea3c4e2 (diff)
downloadFreeBSD-src-49092fb3fc0e8e52a381c2a4d5f8fddf6e5b1b1e.zip
FreeBSD-src-49092fb3fc0e8e52a381c2a4d5f8fddf6e5b1b1e.tar.gz
Add comments about stack protection mechanism.
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_base.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 2bf6508..8bb4382 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -2372,6 +2372,14 @@ ng_snd_item(item_p item, int flags)
}
#ifdef GET_STACK_USAGE
else {
+ /*
+ * Most of netgraph nodes has small stack consumption and
+ * for them it is more then enogh 20% of free stack.
+ * Nodes/hooks with higher stack usage should be marked as
+ * HI_STACK. For them 50% of stack will be guarantied.
+ * XXX: Values 50% (64/128) and 80% (100/128) are completely
+ * empirical.
+ */
size_t st, su;
GET_STACK_USAGE(st, su);
su = (su * 128) / st;
OpenPOWER on IntegriCloud