From c75c017e4c22bf8e5082a0cec1d8e9df76bac9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Fri, 2 Jun 2023 19:01:29 +0200 Subject: [PATCH] zdtm: thp_disable: Verify MADV_NOHUGEPAGE before migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a sanity check for THP_DISABLE. This discovered a broken commit in Google's kernel tree. Signed-off-by: Michał Mirosław --- test/zdtm/static/thp_disable.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/zdtm/static/thp_disable.c b/test/zdtm/static/thp_disable.c index e38508778..eabb45650 100644 --- a/test/zdtm/static/thp_disable.c +++ b/test/zdtm/static/thp_disable.c @@ -47,6 +47,21 @@ int main(int argc, char **argv) return -1; } + test_msg("Fetch pre-migration flags/adv\n"); + if (get_smaps_bits((unsigned long)area, &new_flags, &new_madv)) + return -1; + + errno = 0; + if (orig_flags != new_flags) { + fail("Flags changed %lx -> %lx\n", orig_flags, new_flags); + return -1; + } + + if (orig_madv != new_madv) { + fail("Madvs changed %lx -> %lx\n", orig_madv, new_madv); + return -1; + } + test_daemon(); test_waitsig();