openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.4k stars 1.72k forks source link

Linux, thread priority potentially not applied to zfs threads (other users also affected ?) #12513

Open kernelOfTruth opened 3 years ago

kernelOfTruth commented 3 years ago

System information

Distribution Name | Gentoo Linux Distribution Version | Rolling Release, Portage 3.0.20 (python 3.8.11-final-0, default/linux/amd64/17.1/desktop/gnome/systemd, gcc-11.2.0, glibc-2.33-r1 Kernel Version | 5.13.12-based Architecture | x86_64 OpenZFS Version | 2e9e2c8ff519916e57dd36b3855dfec059bbf611 (master)

Installation method is via Gentoo's package manager, portage, 9999 ebuild (git upstream/master)

zfs version zfs-2.1.99-422_gb0f3f393d zfs-kmod-2.1.99-422_gb0f3f393d

Describe the problem you're observing

in alignment with commit https://github.com/openzfs/zfs/commit/1229323d5f82bcb0525b312c80330968cd41466e "Align thread priority with Linux defaults"

Some zfs threads are expected to have negative niceness, but they don't (at least on my system)

Thus posting here RFC to see if it's my system only, or if something meanwhile has changed since 2015 (Jul 28, 2015 is the commit date)

ProjectC PDS scheduler zfs thread priorities, 5.13.12, static taskq

(ProjectC seems to take care of priorities differently, it appears, but the issue is concerning niceness)

https://pastebin.com/sjjWhLxb

CacULE (CFS related) scheduler zfs thread priorities, 5.13.13, dynamic taskq

https://pastebin.com/zzMVyjbv

Where the commit change shows:

ps -eLo rtprio,cls,pid,pri,nice,cmd | egrep 'z_|spl_|zvol|arc|dbu|meta'
     -  TS 10743  19 -20 [spl_kmem_cache]
     -  TS 10744  19 -20 [spl_system_task]
     -  TS 10745  19 -20 [spl_dynamic_tas]

output for my system e.g. is

ps -eLo rtprio,cls,pid,pri,nice,cmd | egrep 'z_|spl_|zvol|arc|dbu|meta'
     -  TS    9188  19   0 [spl_system_task]
     -  TS    9189  19   0 [spl_delay_taskq]
     -  TS    9192  19   0 [spl_dynamic_tas]
     -  TS    9193  19   0 [spl_kmem_cache]

Describe how to reproduce the problem

Install openZFS

then run

ps -eLo rtprio,cls,pid,pri,nice,cmd | egrep 'z_|spl_|zvol|arc|dbu|meta'

there are expected to be negatively reniced threads/processes displayed affecting ZFS

I have the following changes in /etc/security/limits.conf - but don't expect them to influence anything w.r.t. zfs threads

@root soft priority 5
@messagebus soft priority -10
@users soft priority -2
*               hard    nice        -19
root            hard    nice        -20

mentioning it for completion' sake nonetheless

rincebrain commented 3 years ago

For me over in 2.0.3-8~bpo10+1 on Debian land:

$ ps -eLo rtprio,cls,pid,pri,nice,cmd | egrep 'z_|spl_|zvol|arc|dbu|meta'
     -  TS   1078  39 -20 [metaslab_group_]
     -  TS   1166  39 -20 [spl_system_task]
     -  TS   1168  39 -20 [spl_delay_taskq]
     -  TS   1175  39 -20 [spl_dynamic_tas]
     -  TS   1183  39 -20 [spl_kmem_cache]
     -  TS   1628  39 -20 [zvol]
     -  TS   1629  19   0 [arc_prune]
     -  TS   1630   0  19 [arc_evict]
     -  TS   1631   0  19 [arc_reap]
     -  TS   1632  19   0 [dbu_evict]
     -  TS   1633   0  19 [dbuf_evict]
     -  TS   1634   0  19 [z_vdev_file]
     -  TS   1635  19   0 [l2arc_feed]
     -  TS   2088  39 -20 [z_null_iss]
     -  TS   2089  39 -20 [z_null_int]
     -  TS   2090  39 -20 [z_rd_iss]
     -  TS   2091  39 -20 [z_rd_int]
     -  TS   2092  39 -20 [z_rd_int]
     -  TS   2093  39 -20 [z_rd_int]
     -  TS   2094  39 -20 [z_rd_int]
     -  TS   2095  39 -20 [z_rd_int]
     -  TS   2096  39 -20 [z_rd_int]

[etc]

and I'm not twiddling any module parameters related to priority or threading.

stale[bot] commented 1 year ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.