Bug 1473207

Summary: sysctl does not display vm.stat_refresh parameter even if the /proc/sys/vm/stat_refresh file exists
Product: [Fedora] Fedora Reporter: Matus Marhefka <mmarhefk>
Component: procps-ngAssignee: Jaromír Cápík <jaromir.capik>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 26CC: jaromir.capik, jcerny, jrybar, rzilka
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-14 15:22:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matus Marhefka 2017-07-20 08:38:51 UTC
Description of problem:
When listing all kernel parameters using sysctl, the vm.stat_refresh parameter is not displayed. This is a bug as the /proc/sys/vm/stat_refresh file exists on the filesystem.


Version-Release number of selected component (if applicable):
procps-ng-3.3.10-11.fc24.x86_64
procps-ng-3.3.10-13.fc26.x86_64


How reproducible:
always

Steps to Reproduce:
$ ls -l /proc/sys/vm/stat_refresh
-rw-------. 1 root root 0 Jul 19 15:54 /proc/sys/vm/stat_refresh
$ sysctl -aN 2>/dev/null | grep stat_refresh


Actual results:
`sysctl -aN` output does not list vm.stat_refresh parameter when the /proc/sys/vm/stat_refresh file exists.


Expected results:
`sysctl -aN` output lists vm.stat_refresh parameter when the /proc/sys/vm/stat_refresh file exists.

Comment 1 Roman Žilka 2017-07-20 16:35:37 UTC
Same behavior here. The omission of this particular parameter in the output of sysctl seems to be happening at sysctl.c:282 (ReadSetting(), vanilla procps-ng-3.3.12). Each parameter whose /proc file is empty doesn't get its name printed. And the said file (/proc/sys/vm/stat_refresh) is indeed empty on my system. It is actually the only empty (readable) file under /proc/sys.

I don't know if this is a bug or a feature in sysctl, but from the looks of the code it could be intentional behavior.

Comment 2 Jan Rybar 2017-08-14 15:22:27 UTC
From the documentation in kernel source:
"
stat_refresh

Any read or write (by root only) flushes all the per-cpu vm statistics
into their global totals, for more accurate reports when testing
e.g. cat /proc/sys/vm/stat_refresh /proc/meminfo
"

It seems that this parameter is intentionally blank and for very special purposes we do not want sysctl to trigger. Hence I find it correct not to list this parameter since it is not directly tunable.