All of lore.kernel.org
 help / color / mirror / Atom feed
* [regression] 5.15 kernel triggering 100x more inode evictions
@ 2022-03-21  4:53 Bruno Damasceno Freire
  2022-03-24 12:18 ` Thorsten Leemhuis
  0 siblings, 1 reply; 17+ messages in thread
From: Bruno Damasceno Freire @ 2022-03-21  4:53 UTC (permalink / raw)
  To: linux-fsdevel

Hello everybody;

This regression was first found during rpm operations with specific packages that became A LOT slower to update ranging from 4 to 30 minutes.

The slowness results from:
a_ the kernel regression: specific system calls touching files with btrfs compression property will generate higher inode eviction on 5.15 kernels.
b_ the inode eviction generating btrfs inode logging and directory logging.
c_ the btrfs directory logging on the 5.15 kernel not being particulary efficient in the presence of high inode eviction.

There is already an ongoing work [1] to improve "c" on newer kernels but I was told they are not elegible for the 5.15 version due to backporting policy restrictions.
AFAIK there isn't any work for "a" yet.
The consequence is that btrfs users running the 5.15 LTS kernel may experience severely degraded performance for specific I/O workloads on files with the compression property enabled.

___How to reproduce:
After some research I learned how to reproduce the regression without rpm.

1st option)
I made a script specifically to research this regression [2].
It has more information, more test results and several options.
The scrip does a little too much so I'm just linking it here.
I hope it can help.

2nd option)
boot a 5.15 kernel,
setup and mount a RAM disk with btrfs,
create a folder and set its compression property,
populate the folder,
make a loop that:
-rename a file,
-unlink the renamed file,
-create a new file.

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1193549
[2] https://github.com/bdamascen0/s3e

___Test results
These tests were done on a virtual machine (kvm) with Ubuntu Jammy Jellyfish.
The kernel is 5.15.0.23 that relates to the 5.15.27 upstream kernel.

Main results (x86_64):
250 files - zstd:         17521 ms @inode_evictions: 31375
250 files - lzo:          17114 ms @inode_evictions: 31375
250 files - uncompressed:  1138 ms @inode_evictions: 499

Load test results (x86_64):
1000 files - 51.6 x more inode evictions - 18.1 x more time
250  files - 62.9 x more inode evictions - 15.2 x more time
100  files - 25.4 x more inode evictions -  3.7 x more time
50   files - 12.8 x more inode evictions -  2.0 x more time
10   files -  2.8 x more inode evictions -  1.3 x more time

CPU usage results (x86_64):
1000 files - zstd:           137841 ms
real    2m17,881s
user    0m1,704s
sys     2m11,937s
1000 files - lzo:            135456 ms
real    2m15,478s
user    0m1,805s
sys	2m9,758s
1000 files - uncompressed:     7496 ms
real    0m7,517s
user    0m1,386s
sys     0m4,899s

I'm sending this message to the linux-fsdevel mailing list first.
Please tell if you think this subject would be of interest of another kernel subsystem.
PS: I'm not subscribed to this list.

TIA, Bruno

^ permalink raw reply	[flat|nested] 17+ messages in thread
* [regression] 5.15 kernel triggering 100x more inode evictions
@ 2022-01-29  1:34 Bruno Damasceno Freire
  0 siblings, 0 replies; 17+ messages in thread
From: Bruno Damasceno Freire @ 2022-01-29  1:34 UTC (permalink / raw)
  To: linux-fsdevel

Hello everybody;

I'd like to publicize again [1] the following bug that I reported for opensuse:
https://bugzilla.opensuse.org/show_bug.cgi?id=1193549


TLDR:
comment #46
Filipe Manana 2022-01-05 10:54:16 UTC
(In reply to Bruno Damasceno Freire from comment #45)
> k5.14.14-3 : @inode_evictions: 1715
> k5.15.12-1 : @inode_evictions: 166106
> k5.16~rc8  : @inode_evictions: 1715
That confirms the hypothesis. Somehow a 5.15 is triggering ~100x inode evictions, which will result in renames doing unnecessary inode logging.
As to why that is happening, I have no idea if anything in mm or vfs changed in some 5.15 release that results in triggering a lot more evictions.


Why am I doing this?
I got support from the btrfs developer Filipe Manana.
He saw some improvements opportunities and they are on the way for future releases of this filesystem.
The problem is that the regression is outside the btrfs code and the root cause wasn't found.
Filipe was guessing that the regression could be in the MM or VFS kernel subsystems.
I'm sending this to the linux-fsdevel mailing list first.
Tumbleweed isn't using the 5.15 kernel anymore but lots of distros are [2].
Until this issue is further evaluated, anyone using the combination of a 5.15 kernel + btrfs compression property can be caught by this regression.
Please tell if you think this subject would be of interest of another kernel subsystem.


How to reproduce:
I am an opensuse user, so I'm not sure on how to reproduce the issue on other distros.
Here are some updated instructions to reproduce it on tumbleweed:

--SETUP--------------------------------------------
1 get the installation image
  wget http://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
2 create a basic VM
  11GB storage should be enought for the tumbleweed installer
3 install a server or a desktop version with btrfs
  no btrfs snapshots needed
4 downgrade the kernel (5.15.12-1.3 is the last version built for tumbleweed)
  wget http://download.opensuse.org/history/20220114/tumbleweed/repo/oss/x86_64/kernel-default-5.15.12-1.3.x86_64.rpm
  wget http://opensuse.zq1.de/history/20220107/tumbleweed/repo/oss/x86_64/kernel-default-5.15.12-1.3.x86_64.rpm
  zypper in --force ./kernel-default-5.15.12-1.3.x86_64.rpm
  boot the 5.15 kernel
5 get the affected package: libKF5Emoticons5 (4 minutes), gutenprint (32 minutes)...
  env LANGUAGE=eng zypper info libKF5Emoticons5 | grep Version
  wget http://download.opensuse.org/tumbleweed/repo/oss/x86_64/libKF5Emoticons5-(version).x86_64.rpm

--TEST---------------------------------------------
6 install the package: it should take a few seconds
  rpm --force -U -nodeps ./libKF5Emoticons5-(version).x86_64.rpm
7 enable any compression (zlib, lzo, zstd) on the package's destination folder with most files
  optional: rpm -ql libKF5Emoticons5 | less
  btrfs property set /usr/share/emoticons/EmojiOne compression zstd:1
8 retry to install: it should take much longer now !!!
  rpm --force -U -nodeps ./libKF5Emoticons5-(version).x86_64.rpm
9 disable compression
  btrfs property set /usr/share/emoticons/EmojiOne compression ""
10 retry to install: it should take a few secons again
   rpm --force -U -nodeps ./libKF5Emoticons5-(version).x86_64.rpm


TIA, Bruno


[1] https://lore.kernel.org/linux-fsdevel/MN2PR20MB251235DDB741CD46A9DD5FAAD24E9@MN2PR20MB2512.namprd20.prod.outlook.com/T/#u

[2] http://distrowatch.org/search.php?pkg=linux&relation=similar&pkgver=5.15&distrorange=InAny#pkgsearch
EndeavourOS (2), Manjaro Linux (3), Pop!_OS (5), Ubuntu (6), Debian (7), Garuda Linux (8), Slackware Linux (15), PCLinuxOS (18), ArcoLinux (21), SparkyLinux (24), Alpine Linux (30), Bluestar Linux (40), Mageia (43), Linux Kodachi (47), Gentoo Linux (48), deepin (49), Kaisen Linux (52), Mabox Linux (55), Absolute Linux (56), GeckoLinux (67), siduction (75), Snal Linux (78), SystemRescue (85), NuTyX (88), Calculate Linux (101), IPFire (110), Clonezilla Live (114), Linux From Scratch (121), Slackel (123), Regata OS (129), Parted Magic (143), paldo GNU/Linux (255), AUSTRUMI (not active).

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-04-13  0:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21  4:53 [regression] 5.15 kernel triggering 100x more inode evictions Bruno Damasceno Freire
2022-03-24 12:18 ` Thorsten Leemhuis
2022-03-28  1:29   ` Bruno Damasceno Freire
2022-03-28  3:12   ` Bruno Damasceno Freire
2022-03-28  3:12     ` Bruno Damasceno Freire
2022-03-28 11:28     ` Thorsten Leemhuis
2022-04-04  5:29       ` Bruno Damasceno Freire
2022-04-04  5:29         ` Bruno Damasceno Freire
2022-04-08 10:32         ` Thorsten Leemhuis
2022-04-08 14:52           ` David Sterba
2022-04-08 15:55             ` Filipe Manana
2022-04-08 16:50               ` Thorsten Leemhuis
2022-04-09 17:12                 ` Bruno Damasceno Freire
2022-04-10  7:27                   ` Thorsten Leemhuis
2022-04-13  0:15                     ` Nicholas D Steeves
2022-04-09 17:07               ` Bruno Damasceno Freire
  -- strict thread matches above, loose matches on Subject: below --
2022-01-29  1:34 Bruno Damasceno Freire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.