All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 3/3] selftests: cgroup: populate the inactive file with read faults
Date: Fri, 13 Nov 2026 06:20:00 +0200	[thread overview]
Message-ID: <20261113042331.517488-4-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20261113042331.517488-1-eva.kurchatova@virtuozzo.com>

memory.numa_migrate migrates asynchronously, so it skips the folios that
are under writeback or locked for it when it gets to them. The
inactive_disk_file variant dirties 1 GiB of a disk file with write
faults, and writeback of that file is still running when the test
migrates it, so part of the file can stay on the source node.

Populate that file with read faults instead. The file is a hole, so its
page cache stays clean and nothing is written back. disk_file keeps
writing to its pages while they are migrated and is left as is.

Fixes: 3842964f4497 ("selftests: cgroup: test numa migration of lruvecs")
https://virtuozzo.atlassian.net/browse/VSTOR-154520
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/cgroup/test_numa_migrate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_numa_migrate.c b/tools/testing/selftests/cgroup/test_numa_migrate.c
index 12c9bab79d6e..5e9f594ffb9f 100644
--- a/tools/testing/selftests/cgroup/test_numa_migrate.c
+++ b/tools/testing/selftests/cgroup/test_numa_migrate.c
@@ -588,6 +588,7 @@ static int touch_pages(const char *cgroup, void *arg)
 	volatile uint8_t *ptr;
 	enum memory_type mem_type;
 	bool inactive;
+	int populate;
 	char tmp = 's';
 	struct test_context *ctx = arg;
 	int ret = EXIT_SUCCESS;
@@ -596,6 +597,9 @@ static int touch_pages(const char *cgroup, void *arg)
 	mem_type = variant->mem_type;
 	inactive = mem_type == MEMORY_TYPE_INACTIVE_FILE ||
 		   mem_type == MEMORY_TYPE_INACTIVE_ANON;
+	/* Read faults leave the file clean, so writeback cannot hold pages back */
+	populate = mem_type == MEMORY_TYPE_INACTIVE_FILE ?
+		   MADV_POPULATE_READ : MADV_POPULATE_WRITE;
 
 	numa_bind(src_mask);
 
@@ -624,7 +628,7 @@ static int touch_pages(const char *cgroup, void *arg)
 		}
 	}
 
-	if (madvise(mmap_ptr, file_size, MADV_POPULATE_WRITE) < 0) {
+	if (madvise(mmap_ptr, file_size, populate) < 0) {
 		ksft_perror("failed to populate test mapping\n");
 		ret = EXIT_FAILURE;
 		goto err_unmap;
-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-13  4:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  4:19 [Devel] [PATCH hci-8.1 0/3] selftests: cgroup: fix test_numa_migrate, inactive_disk_file Eva Kurchatova
2026-11-13  4:19 ` [Devel] [PATCH hci-8.1 1/3] selftests: harness: run the fixture teardown after a failed ASSERT Eva Kurchatova
2026-11-13  4:28   ` no-reply
2026-11-13 19:57   ` Konstantin Khorenko
2026-11-13  4:19 ` [Devel] [PATCH hci-8.1 2/3] selftests: cgroup: mark the pages cold before numa_migrate starts Eva Kurchatova
2026-11-13  4:27   ` no-reply
2026-11-13 19:57   ` Konstantin Khorenko
2026-11-13  4:20 ` Eva Kurchatova [this message]
2026-11-13  4:28   ` [Devel] [PATCH hci-8.1 3/3] selftests: cgroup: populate the inactive file with read faults no-reply
2026-11-13 19:57   ` Konstantin Khorenko
2026-11-13 19:57 ` [Devel] [PATCH hci-8.1 0/3] selftests: cgroup: fix test_numa_migrate, inactive_disk_file Konstantin Khorenko
2026-11-13 19:59 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113042331.517488-4-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.