diff mbox series

[v2,7/7] Add fallback for RHEL9

Message ID 20231222050006.148845-7-xuyang2018.jy@fujitsu.com
State Superseded
Headers show
Series [v2,1/7] libltpswap: Add get_maxswapfiles api | expand

Commit Message

Yang Xu Dec. 22, 2023, 5 a.m. UTC
Since device number patch and pte number patch have been backported into
RHEL9,  we should add fallback for this distro.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 libs/libltpswap/libswap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Petr Vorel Feb. 5, 2024, 6:37 p.m. UTC | #1
Hi Yang Xu, all,

> Since device number patch and pte number patch have been backported into
> RHEL9,  we should add fallback for this distro.

I guess this is for Li and Jan, thus Cc them.

BTW this is the only patch not set Superseded:
https://patchwork.ozlabs.org/project/ltp/list/?series=387814&state=*

Kind regards,
Petr
diff mbox series

Patch

diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
index e10a6f5b2..8c7729b8b 100644
--- a/libs/libltpswap/libswap.c
+++ b/libs/libltpswap/libswap.c
@@ -12,6 +12,7 @@ 
 #include "libswap.h"
 #include "lapi/syscalls.h"
 #include "tst_kconfig.h"
+#include "tst_kvercmp.h"
 #include "tst_safe_stdio.h"
 
 #define BUFSIZE 1024
@@ -81,6 +82,11 @@  unsigned int get_maxswapfiles(void)
 	struct tst_kconfig_var memory_kconfig = TST_KCONFIG_INIT("CONFIG_MEMORY_FAILURE");
 	struct tst_kconfig_var device_kconfig = TST_KCONFIG_INIT("CONFIG_DEVICE_PRIVATE");
 	struct tst_kconfig_var marker_kconfig = TST_KCONFIG_INIT("CONFIG_PTE_MARKER");
+	struct tst_kern_exv kvers[] = {
+		/* RHEL9 kernel has patch 6c287605f and 679d10331 since 5.14.0-179 */
+		{ "RHEL9", "5.14.0-179" },
+		{ NULL, NULL},
+	};
 
 	tst_kconfig_read(&migration_kconfig, 1);
 	tst_kconfig_read(&memory_kconfig, 1);
@@ -88,7 +94,7 @@  unsigned int get_maxswapfiles(void)
 	tst_kconfig_read(&marker_kconfig, 1);
 
 	if (migration_kconfig.choice == 'y') {
-		if (tst_kvercmp(5, 19, 0) < 0)
+		if (tst_kvercmp2(5, 19, 0, kvers) < 0)
 			swp_migration_num = 2;
 		else
 			swp_migration_num = 3;
@@ -105,7 +111,7 @@  unsigned int get_maxswapfiles(void)
 	}
 
 	if (marker_kconfig.choice == 'y') {
-		if (tst_kvercmp(5, 19, 0) >= 0)
+		if (tst_kvercmp2(5, 19, 0, kvers) >= 0)
 			swp_pte_marker_num = 1;
 	}