Page MenuHomeFreeBSD

Make SET_ERRORX() an expression evaluating to the error number
ClosedPublic

Authored by kib on Fri, Jun 13, 5:36 PM.
Tags
None
Referenced Files
F122179061: D50836.id156988.diff
Thu, Jul 3, 12:41 AM
Unknown Object (File)
Tue, Jul 1, 6:03 AM
Unknown Object (File)
Tue, Jul 1, 6:02 AM
Unknown Object (File)
Tue, Jul 1, 6:02 AM
Unknown Object (File)
Tue, Jul 1, 6:02 AM
Unknown Object (File)
Sat, Jun 28, 5:48 AM
Unknown Object (File)
Thu, Jun 26, 7:46 PM
Unknown Object (File)
Wed, Jun 25, 6:29 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Fri, Jun 13, 5:36 PM

Thanks.

sys/sys/exterrvar.h
51 ↗(On Diff #156984)

Perhaps this should be a proper function which returns error? I'm not sure. I wonder if inlining will result in significant .text bloat.

sys/sys/exterrvar.h
51 ↗(On Diff #156984)

Wouldn't setting up args for the call consume approximately the same amount of code?

I also wanted to make mmsg store a dead store if the BLOAT option is not enabled.

sys/sys/exterrvar.h
51 ↗(On Diff #156984)

Maybe, but I'd expect a function call to be a bit smaller: it will usually be a tail call, and then the inline code doesn't need to fetch curthread. We would need to try it and see.

sys/sys/exterrvar.h
51 ↗(On Diff #156984)

So for existing calls of vm/vm_map.c

Macro
     text     data       bss        dec        hex   filename
5873740   599651   3595968   10069359   0x99a56f   sys/amd64/compile/X/kernel

Function
     text     data       bss        dec        hex   filename
  5872671   599651   3595968   10068290   0x99a142   sys/amd64/compile/X/kernel

% rg SET_ERROR sys/vm sys/kern | wc -l
      25

The difference is 1K for 25 places.

Thanks.

Oops, I meant to accept.

sys/sys/exterrvar.h
51 ↗(On Diff #156984)

Seems worthwhile? In either case it may be worthwhile to annotate the check with __predict_false so that the body of the macro is moved to the end of the function.

This revision is now accepted and ready to land.Fri, Jun 13, 6:32 PM
This revision now requires review to proceed.Fri, Jun 13, 6:39 PM
markj added inline comments.
sys/kern/sys_generic.c
2291 ↗(On Diff #156988)

Left over backslash here.

This revision is now accepted and ready to land.Fri, Jun 13, 6:40 PM