Page MenuHomeFreeBSD

1/2 vfs: inline VOP calls if possible
Needs ReviewPublic

Authored by mjg on Fri, Feb 14, 11:28 AM.

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
Unit Tests Skipped

Event Timeline

mjg created this revision.Fri, Feb 14, 11:28 AM
jeff added a comment.Sun, Feb 16, 9:45 AM

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?

mjg added a comment.EditedSun, Feb 16, 12:09 PM

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.

mjg updated this revision to Diff 68416.Sun, Feb 16, 4:07 PM
  • add 'debug' keyword to debug routines for consistency