5 ms·
Why not sort this in a precompile step and not sort the static list every boot?
by upon_drumhead 3y ago
Why not sort this in a precompile step and not sort the static list every boot?
- loeg 3y agoNo good reason. It would just require something fiddly with the linker / build process. This is good enough.
- cperciva 3y agoTwo reasons: First, it's not worth screwing with the linker to save 20 microseconds. Second, you need to merge lists anyway because kernel modules.
- JoshTriplett 3y ago> First, it's not worth screwing with the linker to save 20 microseconds. ...yet. Certainly not when boot is 28ms; might be worth it when boot is 1ms. > Second, you need to merge lists anyway because kernel modules. Does FreeBSD have the equivalent of a non-modular kernel build, for kernels where you know every piece of hardware it'll ever talk to?
- cperciva 3y agoIf I get the entire kernel boot down to 1 ms I might take another look at this. ;-) You absolutely can compile everything you need into the kernel -- in fact for Firecracker you have to since you don't have a boot loader handing you multiple kernel modules. But I needed to write the code to support more than just Firecracker.
- JoshTriplett 3y ago> If I get the entire kernel boot down to 1 ms I might take another look at this. ;-) I look forward to the upcoming boot-time competitions between FreeBSD and Linux. :) > You absolutely can compile everything you need into the kernel -- in fact for Firecracker you have to since you don't have a boot loader handing you multiple kernel modules. But I needed to write the code to support more than just Firecracker. Absolutely. But it seems reasonable to have, for instance, link-time sorting support that only works when building a kernel that doesn't support kernel modules.
- cperciva 3y agoMaybe. The tradeoff is that having two different ways of doing something makes it more likely that one will break without anyone noticing.
- JoshTriplett 3y agoValid. Especially in early boot. Another possibility: always use link-time sorting for the kernel, and for individual modules, and then do runtime merging if and only if you have kernel modules. That way, the link-time sorting path is always tested, and the runtime merging is tested anytime you have kernel modules (which sounds like the more common case). (All of this, though, is gated under "is it worth saving the microseconds yet".)
- gizmo686 3y agoWhy not boot as a compilation step, and save a memory instance to be loaded on actual boots.
- midoridensha 3y agoProbably because that would assume far too much about the state of the hardware.