Re: [PATCH 5/5] KVM: selftests: access_tracking_perf_test: Use MGLRU for access tracking
From: James Houghton
Date: Thu Mar 27 2025 - 14:27:54 EST
On Wed, Mar 26, 2025 at 6:25 PM James Houghton <jthoughton@xxxxxxxxxx> wrote:
> diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tools/testing/selftests/kvm/access_tracking_perf_test.c
> index 0e594883ec13e..1c8e43e18e4c6 100644
> --- a/tools/testing/selftests/kvm/access_tracking_perf_test.c
> +++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c
> @@ -318,6 +415,15 @@ static void run_test(enum vm_guest_mode mode, void *arg)
> pr_info("\n");
> access_memory(vm, nr_vcpus, ACCESS_WRITE, "Populating memory");
>
> + if (use_lru_gen) {
> + struct memcg_stats stats;
> +
> + /* Do an initial page table scan */
This comment is wrong, sorry. I'll just drop it.
I initially had a lru_gen_do_aging() here to verify that everything
was tracked in the lru_gen debugfs, but everything is already tracked
anyway. Doing an aging pass here means that the "control" write after
this is writing to idle memory, so it ceases to be a control.
> + lru_gen_read_memcg_stats(&stats, TEST_MEMCG_NAME);
> + TEST_ASSERT(lru_gen_sum_memcg_stats(&stats) >= total_pages,
> + "Not all pages accounted for. Was the memcg set up correctly?");
> + }
> +
> /* As a control, read and write to the populated memory first. */
> access_memory(vm, nr_vcpus, ACCESS_WRITE, "Writing to populated memory");
> access_memory(vm, nr_vcpus, ACCESS_READ, "Reading from populated memory");