Subject: Re: [PATCH] selfttest/powerpc: Add memory page migration tests

From: Michael Ellerman <[email-masked]>
Date: Wed, 21 Oct 2015 20:32:08 +1100

On Thu, 2015-10-15 at 21:16 +0530, Anshuman Khandual wrote:

> This adds two tests for memory page migration. One for normal page
> migration which works for both 4K or 64K base page size kernel and
> the other one is for 16MB huge page migration which will work both
> 4K or 64K base page sized 16MB huge pages as and when we support
> huge page migration.

> diff --git a/tools/testing/selftests/powerpc/mm/run_mmtests b/tools/testing/selftests/powerpc/mm/run_mmtests
> new file mode 100755
> index 0000000..c537f4e
> --- /dev/null
> +++ b/tools/testing/selftests/powerpc/mm/run_mmtests
> @@ -0,0 +1,21 @@
> +#!/bin/bash
> +mnt=./huge
> +mkdir $mnt
> +mount -t hugetlbfs none $mnt
> +
> +echo 256 > /proc/sys/vm/nr_hugepages
> +echo "HugeTLB vs THP"
> +./hugetlb_vs_thp_test
> +
> +echo "Subpage Protection"
> +./subpage_prot
> +
> +echo "Test normal page migration"
> +./page-migration
> +
> +echo "Test huge page migration"
> +./hugepage-migration
> +
> +#cleanup
> +umount $mnt
> +rm -rf $mnt

I'm not a fan of this script at all.

It looks like you borrowed the logic from selftests/vm/run_vmtests, but
stripped out all the error handling.

Please write it so that it attempts to do the hugepage setup, but if it fails,
prints a warning and then tries to run the tests anyway. That way if a regular
user runs the test, but hugepages are already setup, some of the tests can
still run.

It also needs to print if any of the tests fail, and the whole test needs to
return an error if any test fails.

cheers