Skip to contentSkip to conversation

migrate_pages03: remove wait_ksmd_full_scan() check because it's not necessary

PATCH In review Pengfei Xu 2 participants 4 messages Jul 18, 2024 – Jul 19, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Pengfei Xu

author
#1 lore raw

PATCH 1/1 migrate_pages03: remove wait_ksmd_full_scan() check because it's not necessary

Remove wait_ksmd_full_scan() check because it's not a necessary step for migrate_pages03 syscall test:
1. KSM(kernel samepage merging) could be enabled and it is optional for migrate_pages syscall testing.
2. When server launched any qemu guest, wait_ksmd_full_scan() will in infinite loop due to /sys/kernel/mm/ksm/full_scans number would not increase anymore, and migrate_pages03 will failed with timeout reason. After removed wait_ksmd_full_scan(), migrate_pages03 could pass without issue.

---
 testcases/kernel/syscalls/migrate_pages/migrate_pages03.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/migrate_pages/migrate_pages03.c +0 -1
index 4d3299b61..f514ed10c 100644
@@ -95,7 +95,6 @@ static void setup(void)
 
 	SAFE_FILE_SCANF(PATH_KSM "run", "%d", &orig_ksm_run);
 	SAFE_FILE_PRINTF(PATH_KSM "run", "%d", 1);
-	wait_ksmd_full_scan();
 }
 
 static void cleanup(void)
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Pengfei Xu <[email protected]> wrote:

Remove wait_ksmd_full_scan() check because it's not a necessary step for

Quoted 4 lines

migrate_pages03 syscall test:
1. KSM(kernel samepage merging) could be enabled and it is optional for migrate_pages syscall testing.

The wait_ksmd_full_scan guarantees the actual merging happens then test can migrate those merged KSM pages to reproduce the regression panic in kernel commit 4b0ece6fa0167b.

So this is a necessary configuration before testing.

Quoted 5 lines

2. When server launched any qemu guest, wait_ksmd_full_scan() will in infinite loop due to /sys/kernel/mm/ksm/full_scans number would not increase anymore, and migrate_pages03 will failed with timeout reason. After removed wait_ksmd_full_scan(), migrate_pages03 could pass without issue.

Yes, this timeout problem likely exists. That is the KSM design which can't avoid "unrelated" page merging happening in the background.
But removing the wait_ksmd_full_scan might not be a good approach IMHO.

Cc @Andrea Arcangeli <[email protected]> if he has good suggestions on the test.

Quoted 26 lines
---
 testcases/kernel/syscalls/migrate_pages/migrate_pages03.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/migrate_pages/migrate_pages03.c +0 -2
index 4d3299b61..f514ed10c 100644
@@ -95,7 +95,6 @@ static void setup(void)
 
        SAFE_FILE_SCANF(PATH_KSM "run", "%d", &orig_ksm_run);
        SAFE_FILE_PRINTF(PATH_KSM "run", "%d", 1);
-       wait_ksmd_full_scan();
 }
 
 static void cleanup(void)
--

2.43.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Sorry, forgot to cc Andrea Arcangeli in the last reply.

Quoted 61 lines · Li Wang

Pengfei Xu <[email protected]> wrote:

Remove wait_ksmd_full_scan() check because it's not a necessary step for

Quoted 4 lines

migrate_pages03 syscall test:
1. KSM(kernel samepage merging) could be enabled and it is optional for migrate_pages syscall testing.

The wait_ksmd_full_scan guarantees the actual merging happens then test can migrate those merged KSM pages to reproduce the regression panic in kernel commit 4b0ece6fa0167b.

So this is a necessary configuration before testing.

Quoted 5 lines

2. When server launched any qemu guest, wait_ksmd_full_scan() will in infinite loop due to /sys/kernel/mm/ksm/full_scans number would not increase anymore, and migrate_pages03 will failed with timeout reason. After removed wait_ksmd_full_scan(), migrate_pages03 could pass without issue.

Yes, this timeout problem likely exists. That is the KSM design which can't avoid "unrelated" page merging happening in the background.
But removing the wait_ksmd_full_scan might not be a good approach IMHO.

Cc @Andrea Arcangeli <[email protected]> if he has good suggestions on the test.

Quoted 22 lines
---
 testcases/kernel/syscalls/migrate_pages/migrate_pages03.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/migrate_pages/migrate_pages03.c +0 -2
index 4d3299b61..f514ed10c 100644
@@ -95,7 +95,6 @@ static void setup(void)
 
        SAFE_FILE_SCANF(PATH_KSM "run", "%d", &orig_ksm_run);
        SAFE_FILE_PRINTF(PATH_KSM "run", "%d", 1);
-       wait_ksmd_full_scan();
 }
 
 static void cleanup(void)
--

2.43.0

Quoted 4 lines

--
Mailing list info: https://lists.linux.it/listinfo/ltp

--
Regards,
Li Wang

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

Hi Li Wang and Andrea Arcangeli,

Quoted 18 lines · Li Wang

Sorry, forgot to cc Andrea Arcangeli in the last reply.

Quoted 13 lines · Li Wang

Pengfei Xu <[email protected]> wrote:

Remove wait_ksmd_full_scan() check because it's not a necessary step for

Quoted 4 lines

migrate_pages03 syscall test:
1. KSM(kernel samepage merging) could be enabled and it is optional for migrate_pages syscall testing.

The wait_ksmd_full_scan guarantees the actual merging happens then test can migrate those merged KSM pages to reproduce the regression panic in kernel commit 4b0ece6fa0167b.

So this is a necessary configuration before testing.

I did not consider the above situation. Is it possible to improve wait_ksmd_full_scan() to handle the scenario described in point 2?

Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

2. When server launched any qemu guest, wait_ksmd_full_scan() will in infinite loop due to /sys/kernel/mm/ksm/full_scans number would not increase anymore, and migrate_pages03 will failed with timeout reason. After removed wait_ksmd_full_scan(), migrate_pages03 could pass without issue.

Quoted 3 lines
Quoted 3 lines

Yes, this timeout problem likely exists. That is the KSM design which can't avoid "unrelated" page merging happening in the background.
But removing the wait_ksmd_full_scan might not be a good approach IMHO.

Yes, thanks for above background info sharing!

Best Regards,
Thank you!

Quoted 41 lines
Quoted 36 lines

Cc @Andrea Arcangeli <[email protected]> if he has good suggestions on the test.

Quoted 22 lines
---
 testcases/kernel/syscalls/migrate_pages/migrate_pages03.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/syscalls/migrate_pages/migrate_pages03.c +0 -2
index 4d3299b61..f514ed10c 100644
@@ -95,7 +95,6 @@ static void setup(void)
 
        SAFE_FILE_SCANF(PATH_KSM "run", "%d", &orig_ksm_run);
        SAFE_FILE_PRINTF(PATH_KSM "run", "%d", 1);
-       wait_ksmd_full_scan();
 }
 
 static void cleanup(void)
--

2.43.0

Quoted 4 lines

--
Mailing list info: https://lists.linux.it/listinfo/ltp

--
Regards,
Li Wang

Signature · 2 lines
Regards,
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp