linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.3k stars 1.01k forks source link

zram-generator package will cause ltp zram related cases fail #888

Closed xuyang0410 closed 2 years ago

xuyang0410 commented 2 years ago

Zram-generator package will use 1/2 memory for swap. So swapping01 will fail. Also zram01,02,03 also fails. So it seems we should think about how to handle when system installed zram-generator package. See zram-generator

metan-ucw commented 2 years ago

For the swapping test we attempt to allocate 130% of the available RAM and we make sure that the overflow would fit the swap, but as long as swap is backed by RAM this obviously false. I guess that for the swapping test it would be most reasonable just to exit with TCONF as log as zswap is in use. The point of the test is to trigger heavy swapping and it would be impossible to find the right amount of stress when swap is backend by compressed RAM as the actual amount of used zswap space is unpredictable at best.

Looking at the zram tests it would be impossible to run them when zram is already in use, as some of the parameters (number of devices) are passed to the zram device driver when it's loaded, so as long as something else loads zram module before the tests starts we are out of options and the test cannot run at all.

All in all it looks like the only option we have is to attempt to detect this situation and exit these tests with TCONF.

xuyang0410 commented 2 years ago

@metan-ucw Agree. I will try to find a suitable way to do this.

xuyang0410 commented 2 years ago

I have sent a patchset to fix this problem. But, I also find this zram-swap also affect msgstress03 case on small memory system. For 4G memory but use 1.5G for zram-swap, then msgstress03 fail dmesg as below:

[ 7903.290823] Adding 1539060k swap on /dev/zram0. Priority:1000 extents:1 across:1539060k SSFS [ 7985.855035] cgroup: fork rejected by pids controller in /user.slice/user-0.slice/session-2.scope

It needs to look into systemd pids controller. Any idea? 1)skip case 2)low the threshold by experience

metan-ucw commented 2 years ago

We already have everything in the test library, the function tst_get_free_pids() will return how many processes can be forked and it takes the pids systemd setup into an account as well.

Strangely enough the msgstress03 already uses tst_get_free_pids() so this should work.