Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3424357pxm; Mon, 28 Feb 2022 20:16:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbnxGGNO01QJDARkilLJC5Al9rppQiPaly15fw1ZT5hKGy71o2AJUuaVPN3lx+yRGGP6DS X-Received: by 2002:a17:907:9910:b0:6d5:acd6:8d02 with SMTP id ka16-20020a170907991000b006d5acd68d02mr17348240ejc.173.1646108189792; Mon, 28 Feb 2022 20:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646108189; cv=none; d=google.com; s=arc-20160816; b=BM4tIoGu+PBD8L0bg/bUUVi+qw0B/gqPGmOu8DDV+oVEiBU5caHy8CQFln5JFYbOOe e9+afH7pKJzQYfsguAz6iAo/9zgjGocsDNsUiriyn4FtknpmRicOaDxkbkk8IYzV7xjD BmDJ6RP44OHEoowj8rbcpyAZHTzIs7W9q9Wx1mKPV5/X3NTZwXLUVB0A/c0DFIkctlpG qFVaQ6VIz+3HmNpR+Bl0BbuABppLLjn9JUWqYom8dsdnV8ErhwjZUpr4q47t+8lWLDeQ dtTNUZXnTreNzcDCYI/JEbn3GKt6J9YanjeNyiThRJIz4sZF8yYRlVQbJzmVluC5JcTp OuzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ijVtiJoCX033kgglssHFDQK/4oP5FPrgwPvKftWG7NU=; b=oNIudFecQ1sNXbjmDm42kNcKC5YNEaQ2zN3QhwiIPa6CMZODU/8Q5RkkjfQPmPRdKk uu2a/vLI/hpggaZur2evNhJGd/XCxo6HcqdM2M6DyLg5k86eswKu2effLKiD/c0mN42o 8VFpJnX9uWPoh/vUa/6U8ybDRrcVKZbt0Noj7vD6KAsvL+Ywg4ZrkTNjCOT247cOYAy4 h8OZt2hvYTTrG/YJq9MAaIl23IWtg1H6MlGUY+ttculZb4RibmoQbcu+bgoWsmyOmnlX HLWuqSKnCxWUocqDedFMfGFg526FSgEdft9qzwQE4ZeXAeZTWPrYvJ0bPXhL4PcIAG2W TJ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ol4DQL0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020aa7dc06000000b00412e98904a0si7600832edu.428.2022.02.28.20.16.06; Mon, 28 Feb 2022 20:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ol4DQL0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbiCABoz (ORCPT + 99 others); Mon, 28 Feb 2022 20:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbiCABoy (ORCPT ); Mon, 28 Feb 2022 20:44:54 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E710BE9; Mon, 28 Feb 2022 17:44:14 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id f18so8763139qtb.3; Mon, 28 Feb 2022 17:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ijVtiJoCX033kgglssHFDQK/4oP5FPrgwPvKftWG7NU=; b=ol4DQL0ca5JemLcFkQ8DxS87cD8v1ik9zyBS6qePe4NhbB1LmjzqdSFTsT5TMCtPeJ Y1363nX8zXjBQBQe6XDnw3x3+PfXuKZcGgnxG8WkPZmLftKMniKr1DpFEh3ZYH+QAiDe vTwLrG/UqXyTQWVdWqGkRGEQapO/1QmYLn0swRkhFvo0hGEVwJxo9/XX4nUP/PqE0yed ckWU3gq/c9umPznNczYWFwZdywTmLrsZ5f2McdXZMoVCCjPMO3zHNaquJt6Ey7A3RTLa j7JDCGy17bZR2YE1vQaYiDGWpoagd4qLTyTIDxKnkVfYuBboVFkPkPQYpgB4bicQJ6cU ddww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ijVtiJoCX033kgglssHFDQK/4oP5FPrgwPvKftWG7NU=; b=nU2VC7M92PEp+geuB6A1oVCj29dsBu/G9i189lPSD9b4wjTvHjakVeY0YNPe4VlkPw eZEd6RhvLwFbtV4hRacpZT14nicDDKPBntD2G/WfuokYO4ELHbQj+w1lVLSxpQiUHN2s gxYvKDZDERTk8HcOkI4N1ZOUYbfqw2m/ANIqHFNL/dK5s9qS4/2/W5Lq3nsuav+4t5dM +Avy88fpgBocYk9grqDCiRA0siRcN8Y0S2426dItsnnHGyD3PrJrp/qzPcbhz+yx7lxZ S1dRnYGjTP4fVebXLTdpeX0PhQGwgXDp+8DmNV/2TVSeCEi23igc0vpQgnOOod0okwR/ mIog== X-Gm-Message-State: AOAM5314Npqhv1b/eFPNB2Rw4zvOYdgief4WdMPfdPvcsnFzqWfT3UqI sySKU0ZFR9wZq/xjfnrvIJ6Psk999Oo= X-Received: by 2002:a05:622a:4ca:b0:2de:91c4:3d7c with SMTP id q10-20020a05622a04ca00b002de91c43d7cmr19030405qtx.618.1646099053438; Mon, 28 Feb 2022 17:44:13 -0800 (PST) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id l19-20020a05622a051300b002dff3437923sm6492305qtx.11.2022.02.28.17.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 17:44:13 -0800 (PST) From: cgel.zte@gmail.com X-Google-Original-From: lv.ruyi@zte.com.cn To: akpm@linux-foundation.org Cc: shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Lv Ruyi (CGEL ZTE)" , Zeal Robot Subject: [PATCH] selftests: vm: remove duplicated macro and use swap() to make code cleaner Date: Tue, 1 Mar 2022 01:44:04 +0000 Message-Id: <20220301014404.2052655-1-lv.ruyi@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Lv Ruyi (CGEL ZTE)" The macro is duplicated, so remove one. And use swap to make code cleaner. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi (CGEL ZTE) --- tools/testing/selftests/vm/userfaultfd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index ab394e6bff43..100f08362164 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -121,9 +121,6 @@ struct uffd_stats { #define swap(a, b) \ do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) -#define swap(a, b) \ - do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) - const char *examples = "# Run anonymous memory test on 100MiB region with 99999 bounces:\n" "./userfaultfd anon 100 99999\n\n" @@ -1424,7 +1421,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]; @@ -1535,13 +1531,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); } -- 2.25.1