Skip to content

Wakes up every 60 seconds and cause load #73

@baryluk

Description

@baryluk

I do not even use mate-hud, but on my Debian testing, it is started when I start MATE, so it runs.

I noticed that it wakes up every 60 seconds, and one of its threads reads stat and status file of each process running in a system, i.e. /proc/123/stat. (as investigated by strace -f)

user@debian:~$ strace -f -p 7185
strace: Process 7185 attached with 8 threads
[pid  7228] restart_syscall(<... resuming interrupted read ...> <unfinished ...>
[pid  7220] clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, {tv_sec=2438693, tv_nsec=425320322},  <unfinished ...>
[pid  7210] pselect6(13, [12], NULL, NULL, NULL, NULL <unfinished ...>
[pid  7200] ppoll([{fd=8, events=POLLIN}], 1, NULL, NULL, 8 <unfinished ...>
[pid  7199] ppoll([{fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=10, events=POLLIN}], 3, NULL, NULL, 8 <unfinished ...>
[pid  7198] ppoll([{fd=5, events=POLLIN}], 1, NULL, NULL, 8 <unfinished ...>
[pid  7197] futex(0x17c9dce0, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid  7185] ppoll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=9, events=POLLIN}, {fd=13, events=POLLIN}, {fd=17, events=POLLIN}], 5, NULL, NULL, 8 <unfinished ...>
[pid  7220] <... clock_nanosleep resumed>NULL) = 0
[pid  7220] getuid()                    = 1000
[pid  7220] openat(AT_FDCWD, "/proc", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 21
[pid  7220] fstat(21, {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
[pid  7220] getdents64(21, 0x7feae406ebe0 /* 684 entries */, 32768) = 18592
[pid  7220] getdents64(21, 0x7feae406ebe0 /* 0 entries */, 32768) = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/1/stat", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "1 (systemd) D 0 1 1 0 -1 4194560"..., 8192) = 216
[pid  7220] read(21, "", 7976)          = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/1/stat", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "1 (systemd) R 0 1 1 0 -1 4194560"..., 8192) = 215
[pid  7220] read(21, "", 7977)          = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/1/status", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "Name:\tsystemd\nUmask:\t0000\nState:"..., 8192) = 1128
[pid  7220] read(21, "", 7064)          = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/2/stat", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "2 (kthreadd) S 0 0 0 0 -1 212998"..., 8192) = 152
[pid  7220] read(21, "", 8040)          = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/2/stat", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "2 (kthreadd) S 0 0 0 0 -1 212998"..., 8192) = 152
[pid  7220] read(21, "", 8040)          = 0
[pid  7220] close(21)                   = 0
[pid  7220] openat(AT_FDCWD, "/proc/2/status", O_RDONLY|O_CLOEXEC) = 21
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] lseek(21, 0, SEEK_CUR)      = 0
[pid  7220] fstat(21, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid  7220] read(21, "Name:\tkthreadd\nUmask:\t0000\nState"..., 8192) = 738
[pid  7220] read(21, "", 7454)          = 0
[pid  7220] close(21)                   = 0
....

(also unclear why each of the file is read multiple times, or why lseek is used to seek, where file is already at offset 0 after it is open. Or why it does a second read (on proc file system, if read does read less than buffer size, that is for sure a fact that there is no more data).

This causes my CPU to boost, and jump the core frequency and core temperature almost immediately by over 10 deg C, and takes many seconds to go back.

This feels inefficient to me.

cpu_temperature

mate-hud 22.10.3-2
Debian testing, amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions