Package: procps
Version: 2:3.3.16-5
Severity: normal
File: /sbin/sysctl
X-Debbugs-Cc: [email protected]

/proc/sys/vm/stat_refresh is a special file that if read or written (by
root), triggers synchronization of all VM data from all CPUs, so other
files (i.e. /proc/meminfo in particular) show up to date values.

https://www.kernel.org/doc/Documentation/sysctl/vm.txt for more details.

sysctl -a does read this file.

strace:

strace sysctl -a 2>&1 | grep 'refresh'
stat("/proc/sys/vm/stat_refresh", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
stat("/proc/sys/vm/stat_refresh", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
openat(AT_FDCWD, "/proc/sys/vm/stat_refresh", O_RDONLY) = 5



However, in the presence of real time tasks, reading might block 
indefinitively, i.e.:

sudo schedtool -R -p 98 -a 7 -e stress-ng -c 1

time cat /proc/sys/vm/stat_refresh

This will never finish (I waited dozens of minutes).

I would suggest adding a special case to sysctl to not read
vm.stat_refresh. It produces no usable output, and reading it has side
effects, thus should be avoided.

Tested on Debian kernel Linux 5.9.11 with standard settings.


Also it does feel like a regression, because I do found reports from the
past that sysctl did not read vm.stat_refresh in the past, and done so on
purpose: https://bugzilla.redhat.com/show_bug.cgi?id=1473207

As of the blocking indefinitively, I will look into contacting kernel
devs about this issue, but even if this is fixed in the kernel, the
sysctl should still not touch the /proc/sys/vm/stat_refresh file.

Regards,
Witold


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.9.0-4-amd64 (SMP w/32 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages procps depends on:
ii  init-system-helpers  1.60
ii  libc6                2.31-6
ii  libncurses6          6.2+20201114-1
ii  libncursesw6         6.2+20201114-1
ii  libprocps8           2:3.3.16-5
ii  libtinfo6            6.2+20201114-1
ii  lsb-base             11.1.0

Versions of packages procps recommends:
ii  psmisc  23.3-1

procps suggests no packages.

-- no debconf information

Reply via email to