Suboptimal initialization of accounts-daemon with a large /var/log/wtmp
@atomsymbol
Submitted by Jan Ziak Assigned to Matthias Clasen @mclasen
Description
Initialization of accounts-daemon is too heavy on the CPU.
In the case described below, a wtmp of 87 megabytes results in:
- 2.3 million calls to the Linux kernel
- File /etc/passwd is open&closed 80000 times
ls -l /var/log/wtmp
-rw-rw-r-- 1 root utmp 87M Jan 1 19:18 /var/log/wtmp
perf stat -e raw_syscalls:sys_enter -- /usr/libexec/accounts-daemon
^C Performance counter stats for '/usr/libexec/accounts-daemon': 2,382,413 raw_syscalls:sys_enter
strace -f -e open /usr/libexec/accounts-daemon |& grep etc/passwd | wc -l
81783
Related bugs: #48177