summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_switch.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2012-12-09 04:54:22 +0000
committerattilio <attilio@FreeBSD.org>2012-12-09 04:54:22 +0000
commit230b7eda6f0ca8c9257eb05130deb2b22efcc622 (patch)
tree3cb84ac1cacb4ad4963cf0e7cdbdf19c56c486fb /sys/kern/kern_switch.c
parent2961cca7115ab05fda3222d813523d134ac42adc (diff)
downloadFreeBSD-src-230b7eda6f0ca8c9257eb05130deb2b22efcc622.zip
FreeBSD-src-230b7eda6f0ca8c9257eb05130deb2b22efcc622.tar.gz
Add a comment on why inlining critical_enter() may not be a good idea
for the general case. Reviewed by: bde MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_switch.c')
-rw-r--r--sys/kern/kern_switch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index 885dc22..d0009b1 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -176,6 +176,12 @@ retry:
/*
* Kernel thread preemption implementation. Critical sections mark
* regions of code in which preemptions are not allowed.
+ *
+ * It might seem a good idea to inline critical_enter() but, in order
+ * to prevent instructions reordering by the compiler, a __compiler_membar()
+ * would have to be used here (the same as sched_pin()). The performance
+ * penalty imposed by the membar could, then, produce slower code than
+ * the function call itself, for most cases.
*/
void
critical_enter(void)
OpenPOWER on IntegriCloud