Page MenuHomeFreeBSD

1/2 vfs: inline VOP calls if possible
AbandonedPublic

Authored by mjg on Feb 14 2020, 11:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 12:36 PM
Unknown Object (File)
Nov 27 2023, 7:39 AM
Unknown Object (File)
Nov 22 2023, 8:16 PM
Unknown Object (File)
Nov 22 2023, 11:00 AM
Unknown Object (File)
Nov 22 2023, 10:35 AM
Unknown Object (File)
Nov 21 2023, 7:49 PM
Unknown Object (File)
Nov 13 2023, 7:12 AM
Unknown Object (File)
Nov 11 2023, 2:22 PM

Details

Reviewers
kib
jeff
Summary

Most ops have nothing to do but to check for sdt probes and call the target routine. vop_*_pre/post processing is only present for few of them and even then it tends to be for debug purposes only.

Add debugpre/debugpost keywords which can be used for that purpose.

Then routines which end up with a SDT check + vop call get it added to the inline function is already there. This avoids a level of indirection most notably for lock1 and unlock.

Note the interface is pretty heavy as it is and it does not add much burden to callers.

This combined with other changes gives me a 10% speed up in fstat rate and a 4% speed up when running vfsmix [ https://lkml.org/lkml/2015/5/19/1009 ]

There is no change in generated code for debug kernels.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

It seems non-debug has only post handlers for knote etc.

Is it really so expensive to emit two function calls? Why not just always inline?

Note the actual routine still have to be generated for filesystems like nullfs (and in fact is generated twice -- once _AP and second time _APV, where the latter is inlined by the compiler into the former).

Inlining everything into top level callers in the current form does not really win much. What can and should be done in next step is to inline the pre/post stuff into _APV functions. Note they all start with checking for error == 0, but this condition is almost always true and is up for further rearrangement.

Perhaps most importantly this still pushes an argument struct on the stack which prevents tail-calling.

In other words there is plenty of work to do in the area and the above provides one logical step. Any further changes should be made separately and I may end up doing some of it later.

  • add 'debug' keyword to debug routines for consistency

something to this extent went in with r363708