khugepaged: selftests: fix timeout condition in wait_for_scan()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 11 Jun 2020 01:41:22 +0000 (18:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jun 2020 02:14:17 +0000 (19:14 -0700)
The loop exits with "timeout" set to -1 and not to 0 so the test needs to
be fixed.

Fixes: e7b592f6caca ("khugepaged: add self test")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Zi Yan <ziy@nvidia.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: Yang Shi <yang.shi@linux.alibaba.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Link: http://lkml.kernel.org/r/20200605110736.GH978434@mwanda
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tools/testing/selftests/vm/khugepaged.c

index 51b89cedd09d1e858f90e00aafc67cce703a74e2..8b75821302a79dcb0ea04c564d6d7f6428791f9c 100644 (file)
@@ -502,7 +502,7 @@ static bool wait_for_scan(const char *msg, char *p)
 
        madvise(p, hpage_pmd_size, MADV_NOHUGEPAGE);
 
-       return !timeout;
+       return timeout == -1;
 }
 
 static void alloc_at_fault(void)