Bug 248454 - Two sysctls in /sys/kern/subr_smp.c with identical description - suggestion enclosed
Summary: Two sysctls in /sys/kern/subr_smp.c with identical description - suggestion e...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-03 13:14 UTC by dewayne
Modified: 2020-08-06 10:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dewayne 2020-08-03 13:14:48 UTC
Would it be possible to modify the descriptions of /usr/src/sys/kern/subr_smp.c to more accurately reflect the meaning of the sysctls.  As a suggestion on line 99 to read
"Number of logical CPUs online"
and line 107 to read
"Number of physical CPUs online"

per:

Line 99
int smp_cpus = 1;       /* how many cpu's running */
SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD|CTLFLAG_CAPRD, &smp_cpus, 0,
    "Number of CPUs online");

Line 107
int mp_ncores = -1;     /* how many physical cores running */
SYSCTL_INT(_kern_smp, OID_AUTO, cores, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_ncores, 0,
    "Number of CPUs online");

:)  I'll leave hw.ncpu for another day ;)
Comment 1 Konstantin Belousov freebsd_committer 2020-08-03 13:46:23 UTC
Would you be fine with "Number of physical cores online" ?
Comment 2 dewayne 2020-08-03 14:00:03 UTC
(In reply to Konstantin Belousov from comment #1)
Thanks for taking a look, and I'd be happy with any improvement.  Though...
for folks that have been around awhile, core used to be those little magnetic loops around a couple of wires ;)

Happy with 
Number of physical cores online
for line 107, as it makes the distinction.

Though I wonder if the younger contributors would appreciate the subtle distinction between core and cpu.  As I reflect upon the interpretations of others, perhaps for line 99 
Number of hyperthreaded CPUs online 
would provide greater clarity?

Kind regards, Dewayne.
Comment 3 Konstantin Belousov freebsd_committer 2020-08-03 16:43:12 UTC
(In reply to dewayne from comment #2)
Term hyperthreading has very narrow meaning, it is only applicable to Intel' CPUs.

FreeBSD systematically uses term CPU as an execution agent that has independent ISA state.  RISC-V calls them harts.

Core is the single execution engine that can provide several OS-visible CPUs, where CPUs share some execution resources, and which cannot be 'split' into smaller chips.  At least this is the terminology of CPU vendors.

Sysctls descriptions should not be an educational resource.
Comment 4 commit-hook freebsd_committer 2020-08-03 17:17:40 UTC
A commit references this bug:

Author: kib
Date: Mon Aug  3 17:17:17 UTC 2020
New revision: 363801
URL: https://svnweb.freebsd.org/changeset/base/363801

Log:
  Provide more correct description for sysctl kern.smp.cores.

  Reported by:	dewayne@heuristicsystems.com.au
  PR:	248454
  Sponsored by:	The FreeBSD Foundation
  MFC after:	3 days

Changes:
  head/sys/kern/subr_smp.c
Comment 5 commit-hook freebsd_committer 2020-08-06 10:13:36 UTC
A commit references this bug:

Author: kib
Date: Thu Aug  6 10:12:39 UTC 2020
New revision: 363947
URL: https://svnweb.freebsd.org/changeset/base/363947

Log:
  MFC r248454:
  Provide more correct description for sysctl kern.smp.cores.

  PR:	248454

Changes:
_U  stable/12/
  stable/12/sys/kern/subr_smp.c