diff mbox series

khugepaged: selftests: fix timeout condition in wait_for_scan()

Message ID 20200605110736.GH978434@mwanda (mailing list archive)
State Mainlined
Commit 9f267a17bfb4eb52a1705d0886a7220e6470bf52
Headers show
Series khugepaged: selftests: fix timeout condition in wait_for_scan() | expand

Commit Message

Dan Carpenter June 5, 2020, 11:07 a.m. UTC
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>
---
 tools/testing/selftests/vm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kirill A . Shutemov June 5, 2020, 1:49 p.m. UTC | #1
On Fri, Jun 05, 2020 at 02:07:36PM +0300, Dan Carpenter wrote:
> 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>
> ---
>  tools/testing/selftests/vm/khugepaged.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vm/khugepaged.c b/tools/testing/selftests/vm/khugepaged.c
> index 51b89cedd09d1..8b75821302a79 100644
> --- a/tools/testing/selftests/vm/khugepaged.c
> +++ b/tools/testing/selftests/vm/khugepaged.c
> @@ -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)

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Thanks.
diff mbox series

Patch

diff --git a/tools/testing/selftests/vm/khugepaged.c b/tools/testing/selftests/vm/khugepaged.c
index 51b89cedd09d1..8b75821302a79 100644
--- a/tools/testing/selftests/vm/khugepaged.c
+++ b/tools/testing/selftests/vm/khugepaged.c
@@ -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)