Page MenuHomeFreeBSD

Add options COMPACT to produce smaller kernel
Needs ReviewPublic

Authored by mjg on Nov 14 2020, 6:51 PM.
Referenced Files
Unknown Object (File)
Jan 11 2023, 9:22 PM
Unknown Object (File)
Jan 8 2023, 3:30 AM
Unknown Object (File)
Nov 27 2022, 3:54 PM



This adds __aligned_if_not_compact and converts __exclusive_cache_line to use it. It retains the section annotation, I may whack it.

I'm not interested in arguing about the name, propose something else and I'll rename. Alternatively, write your own patch and I'll use it in D27185

Diff Detail

Lint Skipped
Tests Skipped

Event Timeline

mjg requested review of this revision.Nov 14 2020, 6:51 PM

Not specifying file name means that option is stored in opt_compact.h, but you never include it.

I strongly suggest putting it in opt_global.h.

244 ↗(On Diff #79552)

This header is also used for userspace, and COMPACT is clearly is in user namespace.
Perhaps we need to use protected name for the option, like __COMPACT.

244 ↗(On Diff #79552)

so that would be __COMPACT put in the config? Looks like some form of prefixing would be warranted for cases like this.

I don't think the COMPACT option (with whatever name) is worth introducing at this time if it goes beyond the few lines (+ fixups) I posted here.

244 ↗(On Diff #79552)

I think it should go somewhere in systm.h or similar. Then it could be COMPACT without prefix.

I do think that COMPAT is worth it, even if such small for now. It is first step, and I expect that it will be taken from this quite fast. It is long overdue.

So put together the following. This runs into further issues as users have to explicitly include opt_global to get the macro, so I think this is just too error prone in this form.

That said, I don't intend to work on this any further. If you want to see this option in you will have to take over or get someone else to do it.

This looks fine to me as the first step.

There is no need to manually include opt_global.h, it is automatically pre-included by the build infrastructure: -include /usr/home/kostik/work/DEV/src/sys/amd64/compile/GENERIC/opt_global.h.

I wonder how much more can we pack in the first commit, e.g. mtx_padalign can be converted to __aligned_if_not_compact.


Are there uses for 'x' or is x always CACHE_LINE_SIZE, for practical purposes ?