From: Shuah Khan <skhan@linuxfoundation.org>
To: cgel.zte@gmail.com, akpm@linux-foundation.org
Cc: shuah@kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Changcheng Deng <deng.changcheng@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] userfaultfd/selftests: use swap() to make code cleaner
Date: Thu, 28 Oct 2021 07:13:43 -0600 [thread overview]
Message-ID: <f60560fe-ac6b-a48b-cc79-a3a42c22cc02@linuxfoundation.org> (raw)
In-Reply-To: <20211028112331.16152-1-deng.changcheng@zte.com.cn>
On 10/28/21 5:23 AM, cgel.zte@gmail.com wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
>
> Use swap() in order to make code cleaner. Issue found by coccinelle.
Please include the coccinelle log.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.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
next prev parent reply other threads:[~2021-10-28 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 11:23 cgel.zte
2021-10-28 13:13 ` Shuah Khan [this message]
2022-01-31 23:00 ` Mike Kravetz
2022-02-01 1:06 ` Mike Kravetz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f60560fe-ac6b-a48b-cc79-a3a42c22cc02@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=cgel.zte@gmail.com \
--cc=deng.changcheng@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@kernel.org \
--cc=zealci@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox