Page MenuHomeFreeBSD

Add descriptions for sysctls in kern_mib.c which lack them.
ClosedPublic

Authored by rpokala on Jan 28 2019, 9:51 PM.

Details

Summary

r343532 noted the difference between "hw.realmem" and "hw.physmem", which I
was previously unaware of. I discovered that neither sysctl had a description
visible via sysctl -d, so I found where they were defined and added
suitable descriptions. While in the file, I went ahead and added descriptions
for all the others which lacked them.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rpokala created this revision.Jan 28 2019, 9:51 PM

This is a step in the right direction. I appreciate the units are mentioned explicitly.

kib added a subscriber: kib.Jan 31 2019, 12:08 AM
kib added inline comments.
sys/kern/kern_mib.c
192 ↗(On Diff #53346)

modules, not drivers.

That said, also the dcons buffer, if any, is not accounted for, on x86.

206 ↗(On Diff #53346)

Realmem is in fact silly and often not reliable.

It is the amount of memory reported by bios. which is often does not have any resemblance to the reality. If system somehow detects this, it reports the max memory address as the hw.realmem.

222 ↗(On Diff #53346)

Again, this is not true. It is the difference between physmem (see above) and the size of wired memory. Many of kernel allocations do not wire underlying pages. Some user allocations are wired.

rpokala updated this revision to Diff 53455.Jan 31 2019, 3:09 AM

Update descriptions based on Kostik's feedback.

rpokala marked 3 inline comments as done.Jan 31 2019, 3:10 AM

Thanks for the feedback, @kib; take another look?

kib added a comment.Jan 31 2019, 6:07 PM

I do not like it. The sysctl descriptions are supposed to be single-line and perhaps even shorter, now it looks like the paragraph from a man page.

So I propose to move the new text to the sysctl(3) manpage where it belongs. Instead, single-liners from sysctl(3) might be used for the sysctl description lines.

sys/kern/kern_mib.c
192 ↗(On Diff #53455)

dcons buffer is accounted on x86.

rpokala updated this revision to Diff 55375.Mar 23 2019, 3:03 AM

As suggested, simplified the descriptions and added a pointer to the manpage.

rpokala marked an inline comment as done.Mar 23 2019, 3:03 AM
bcr added a subscriber: bcr.Mar 23 2019, 3:46 AM

OK from manpages. Thanks for doing the work.

bcr accepted this revision.Mar 23 2019, 3:46 AM
This revision is now accepted and ready to land.Mar 23 2019, 3:46 AM
kib added inline comments.Mar 23 2019, 9:54 AM
sys/kern/kern_mib.c
191 ↗(On Diff #55375)

'; see sysctl(3)' is redundand, why kernel should lecture users how to use man(1) ? We do not do things like 'No such file or directory, see open(2)'.

rpokala updated this revision to Diff 55391.Mar 23 2019, 6:36 PM

Remove the reference to sysctl(3) from the individual descriptions.

This revision now requires review to proceed.Mar 23 2019, 6:36 PM
rpokala marked an inline comment as done.Mar 23 2019, 6:36 PM
kib accepted this revision.Mar 23 2019, 6:44 PM
This revision is now accepted and ready to land.Mar 23 2019, 6:44 PM
This revision was automatically updated to reflect the committed changes.