[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f60560fe-ac6b-a48b-cc79-a3a42c22cc02@linuxfoundation.org>
Date: Thu, 28 Oct 2021 07:13:43 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: cgel.zte@...il.com, akpm@...ux-foundation.org
Cc: shuah@...nel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
Changcheng Deng <deng.changcheng@....com.cn>,
Zeal Robot <zealci@....com.cn>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] userfaultfd/selftests: use swap() to make code cleaner
On 10/28/21 5:23 AM, cgel.zte@...il.com wrote:
> From: Changcheng Deng <deng.changcheng@....com.cn>
>
> Use swap() in order to make code cleaner. Issue found by coccinelle.
Please include the coccinelle log.
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@....com.cn>
> ---
> tools/testing/selftests/vm/userfaultfd.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
> index 8a09057d2f22..41dfe6f4ebfb 100644
> --- a/tools/testing/selftests/vm/userfaultfd.c
> +++ b/tools/testing/selftests/vm/userfaultfd.c
> @@ -1413,7 +1413,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
> static int userfaultfd_stress(void)
> {
> void *area;
> - char *tmp_area;
> unsigned long nr;
> struct uffdio_register uffdio_register;
> struct uffd_stats uffd_stats[nr_cpus];
> @@ -1524,13 +1523,8 @@ static int userfaultfd_stress(void)
> count_verify[nr], nr);
>
> /* prepare next bounce */
> - tmp_area = area_src;
> - area_src = area_dst;
> - area_dst = tmp_area;
> -
> - tmp_area = area_src_alias;
> - area_src_alias = area_dst_alias;
> - area_dst_alias = tmp_area;
> + swap(area_src, area_dst);
> + swap(area_src_alias, area_dst_alias);
>
> uffd_stats_report(uffd_stats, nr_cpus);
> }
>
thanks,
-- Shuah
Powered by blists - more mailing lists