Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1573388pxb; Thu, 28 Oct 2021 06:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaY7ymuBgsxqr7KFbsfIoj4dKRshzVGLeYgXZrBysMybgF5kiNCLxKOcXGrwb/qhxk1zP/ X-Received: by 2002:a17:907:72cc:: with SMTP id du12mr5567869ejc.421.1635427092292; Thu, 28 Oct 2021 06:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635427092; cv=none; d=google.com; s=arc-20160816; b=ICkRXhTAuBlOeObU61hlaHLV5Bl/dNOjBWvTn4UzQ9U5sHOwW6DdBsP/WYLLAy9Zl2 /IaPWpC/9dwndsNTrkYzhoen1+IN/3NSsY/xi/VXsC9bMaksVHBzACtJ5on7onYUJWlR lvojQdErDkPgiNTQgfystMzCXRc6uniLeKBnvHyucNEEoTi0h/ksFujZfAWhuxOiEZ/5 dlsj7GEpFMOhlUf8AqL7rGKqCp8v0vOOzL1j5ORQ/PG28pDUxZKnVqFRXgvT66JDEsJE fxjV6mvCw4LBdirr8Mq+/E3CO1OLXua2bIIoeai5eTwkgQldv+1+B018+dfPwVFBd8dt +XTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=iOMRY+5EQlt3AMhlWcF2Jku3DStXtwx/KpJdGp0gI2c=; b=F1ymOAlzFM0ft8q9oerpO7kb5JqLnMCXv6+pL0HwJOFLLH4z7qRkYPXJyBo0inds30 lYjd0R/sR0bjAv4xk7Zx90wixd01SpFwNFXWV33CjohPe264VnXC9nbyTRdvuggqijHq 2Lmo+PFlULwHkslYr4obMucSa5f6WV8ut1Df2Svac9yiBS6MOmtLM0+mx+B+tcTqZ5a6 cj8u8VN+VwfthPQpQP+1RdaOYKliZz2t+e7E8rQFfVDJ1if0jIFrXhVHGQ7Jj0aHLb3t zXCXrFKRVz7a2pZ9VmW9yWrt1cFkJC/fQop6KCp3rYaG+e0JAIcBnrbu7akMGwb7C1uQ YyKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Fs6zHdSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa4si2975046ejc.498.2021.10.28.06.17.48; Thu, 28 Oct 2021 06:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Fs6zHdSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbhJ1NQN (ORCPT + 99 others); Thu, 28 Oct 2021 09:16:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbhJ1NQM (ORCPT ); Thu, 28 Oct 2021 09:16:12 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A64DC061745 for ; Thu, 28 Oct 2021 06:13:46 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id m11so3409768oif.13 for ; Thu, 28 Oct 2021 06:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=iOMRY+5EQlt3AMhlWcF2Jku3DStXtwx/KpJdGp0gI2c=; b=Fs6zHdSI2uUASs/WQXD/oHus8l8cuQQ/q/FtJVBv4wUOpQD3iqU2AJP1/usYPkdkQm reXDFApWQCOoSBOz6QNEWmoAwSUTRLtzLKbj/IroQlrViHO6w6uWRpgfIIce2/jLRwJr 6U6YczGQEuHf5UA2+jUTKbxhE/mPgG+s18xpw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iOMRY+5EQlt3AMhlWcF2Jku3DStXtwx/KpJdGp0gI2c=; b=rNa9dwRvDHwK+IrWfn+SSu8Ho5C3neHWIL1vkejXtqbaaVZK1QDzAh/vNmOJt/9bPU Dgs3ClQjW4IIE/1lBPOMr3OFCZVA6/jWXNOudqjZjfkV0oMXDqNcIWhCE1m95l76scmD dm9sAam/fzlnD8HtUBu5Vq4mtForFRbxoQf1barZgIZxg0QHI2Xd0gIq9ScOhgjK0GRV J2zW+7uVVLszpxoSTUXVp2za8xpjyc1AKHPdhf/iLvefP24iXkSd6veN9TnKBchJqRvS VivdVYjI6MN8hiNqu3NMR6RXwBLws5CtmNZszlNgq5O77blZ9TEGrVG1EcR+BQg6NdQd VHsg== X-Gm-Message-State: AOAM531O5avx5HQxsu4A5Yi0/fjx0eRvggtFjJsKWfMJv0ckGuizu26c v9eEUAcj4OKiXJmRUo0wCfvdSg== X-Received: by 2002:a05:6808:1791:: with SMTP id bg17mr8378167oib.94.1635426825463; Thu, 28 Oct 2021 06:13:45 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id s5sm1111548ois.55.2021.10.28.06.13.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Oct 2021 06:13:44 -0700 (PDT) Subject: Re: [PATCH] userfaultfd/selftests: use swap() to make code cleaner 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 , Zeal Robot , Shuah Khan References: <20211028112331.16152-1-deng.changcheng@zte.com.cn> From: Shuah Khan Message-ID: Date: Thu, 28 Oct 2021 07:13:43 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20211028112331.16152-1-deng.changcheng@zte.com.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/21 5:23 AM, cgel.zte@gmail.com wrote: > From: Changcheng Deng > > Use swap() in order to make code cleaner. Issue found by coccinelle. Please include the coccinelle log. > > Reported-by: Zeal Robot > Signed-off-by: Changcheng Deng > --- > 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