svn commit: r355791 - head/sys/tools
Mateusz Guzik
mjg at FreeBSD.org
Mon Dec 16 00:07:52 UTC 2019
Author: mjg
Date: Mon Dec 16 00:07:51 2019
New Revision: 355791
URL: https://svnweb.freebsd.org/changeset/base/355791
Log:
vfs: allow tail call optimisation in vops in the common case
Most frequently used vops boil down to checking SDT probes, doing the call and
checking again. There is no vop_post/pre in their case but the check after the
call prevents tail call optimisation from taking place. Instead, check once
upfront. Kernels with debug or vops with non-empty vop_post still don't short
circuit.
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22739
Modified:
head/sys/tools/vnode_if.awk
Modified: head/sys/tools/vnode_if.awk
==============================================================================
--- head/sys/tools/vnode_if.awk Mon Dec 16 00:06:22 2019 (r355790)
+++ head/sys/tools/vnode_if.awk Mon Dec 16 00:07:51 2019 (r355791)
@@ -363,16 +363,20 @@ while ((getline < srcfile) > 0) {
printc("\tVNASSERT(a->a_gen.a_desc == &" name "_desc, a->a_" args[0]",");
printc("\t (\"Wrong a_desc in " name "(%p, %p)\", a->a_" args[0]", a));");
printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));")
- printc("\tSDT_PROBE2(vfs, vop, " name ", entry, a->a_" args[0] ", a);\n");
- for (i = 0; i < numargs; ++i)
- add_debug_code(name, args[i], "Entry", "\t");
printc("\tKTR_START" ctrstr);
add_pre(name);
- printc("\tif (vop->"name" != NULL)")
+ for (i = 0; i < numargs; ++i)
+ add_debug_code(name, args[i], "Entry", "\t");
+ printc("\tif (__predict_true(!SDT_PROBES_ENABLED() && vop->"name" != NULL)) {");
printc("\t\trc = vop->"name"(a);")
- printc("\telse")
- printc("\t\trc = vop->vop_bypass(&a->a_gen);")
- printc("\tSDT_PROBE3(vfs, vop, " name ", return, a->a_" args[0] ", a, rc);\n");
+ printc("\t} else {")
+ printc("\t\tSDT_PROBE2(vfs, vop, " name ", entry, a->a_" args[0] ", a);");
+ printc("\t\tif (vop->"name" != NULL)")
+ printc("\t\t\trc = vop->"name"(a);")
+ printc("\t\telse")
+ printc("\t\t\trc = vop->vop_bypass(&a->a_gen);")
+ printc("\t\tSDT_PROBE3(vfs, vop, " name ", return, a->a_" args[0] ", a, rc);");
+ printc("\t}")
printc("\tif (rc == 0) {");
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "OK", "\t\t");
More information about the svn-src-all
mailing list