From patchwork Wed Feb 2 00:33:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12732468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B7B8C4332F for ; Wed, 2 Feb 2022 00:33:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05BA18D0099; Tue, 1 Feb 2022 19:33:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 00A478D0094; Tue, 1 Feb 2022 19:33:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E13AC8D0099; Tue, 1 Feb 2022 19:33:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id D1F528D0094 for ; Tue, 1 Feb 2022 19:33:46 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9885D987B3 for ; Wed, 2 Feb 2022 00:33:46 +0000 (UTC) X-FDA: 79095966852.04.75E95AA Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf10.hostedemail.com (Postfix) with ESMTP id 4495EC0006 for ; Wed, 2 Feb 2022 00:33:45 +0000 (UTC) Received: by mail-io1-f46.google.com with SMTP id e79so23385983iof.13 for ; Tue, 01 Feb 2022 16:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JepB/7vXyZQxWCvygSiSQrAo+dG4wBZLbFMfRyPaAg4=; b=BYjOOb9hkhtXBfhwGlSCCO509XKcvbv2hf2hjKfopkh4jOXW8O7HhQjDtyYIJa0jl5 qTtw9X86XWTlwMVzFMnM1PJoeTfB9MsBay3aIwLob3YGE1Oy90CKWlPXcFf5aPf5E+FR QnQRAqB7avjTD9AOWkm0wdpaP7ob+3r/RNbW8= 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=JepB/7vXyZQxWCvygSiSQrAo+dG4wBZLbFMfRyPaAg4=; b=lbGy98q6Yeefl5m+CtLuOAdQbXpKT5HQd+AHeAACIJqTdQeTmfgfMPPPZnwq/MB0BO eydcNRMfVfeQNmLjpu9owX5zBne3o8L+7zWdDGdRKF7nWL5GIB7YwFoAbMRfJfB+4oCs hC8nQEj+O2iiN17ri1wxn/5mXgV2qKClKbvlqDlEO/Q9+fA6ifMZ+o3alqzycPDQwKcJ bzvdArPZ498b2cq0h6honeqpmLpRIrvBPbqty9Esk3OeDdT1vwKvHYE+HxNm++j7f+hH jSUyLaBZ0fD1wQ6krDKtzT3uZyUh7H3AdjWbWgWO9fZw4Vs2luVRtNwn+2hdDYPAsRCs z3dg== X-Gm-Message-State: AOAM530CX3xQjERU2e8xkXKg7amk3GagVw5AuL0xDR64lTgW1qMHTbKF n/MtpX+qGJMnuVPb5b5JZliARw== X-Google-Smtp-Source: ABdhPJyLnuma3ioM5xd1+ADrOhX9jvjTMjYRkEa1l7nl/NLBbTeuZXG1YAA6NxvjtObNkd79ajkSow== X-Received: by 2002:a02:6248:: with SMTP id d69mr14688442jac.133.1643762024503; Tue, 01 Feb 2022 16:33:44 -0800 (PST) Received: from shuah-tx13.internal ([71.205.29.0]) by smtp.gmail.com with ESMTPSA id l13sm5971445ilj.24.2022.02.01.16.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 16:33:44 -0800 (PST) From: Shuah Khan To: akpm@linux-foundation.org, shuah@kernel.org, chi.minghao@zte.com.cn Cc: Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kselftest/vm: Revert "tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner" Date: Tue, 1 Feb 2022 17:33:40 -0700 Message-Id: <20220202003340.87195-1-skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4495EC0006 X-Rspam-User: nil Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b=BYjOOb9h; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf10.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.166.46 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org X-Stat-Signature: fo9hpeaynr4n59qu4pbd1kar6csy1rr9 X-Rspamd-Server: rspam08 X-HE-Tag: 1643762025-515889 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With this change, userfaultfd fails to build with undefined reference swap() error: userfaultfd.c: In function ‘userfaultfd_stress’: userfaultfd.c:1530:17: warning: implicit declaration of function ‘swap’; did you mean ‘swab’? [-Wimplicit-function-declaration] 1530 | swap(area_src, area_dst); | ^~~~ | swab /usr/bin/ld: /tmp/ccDGOAdV.o: in function `userfaultfd_stress': userfaultfd.c:(.text+0x549e): undefined reference to `swap' /usr/bin/ld: userfaultfd.c:(.text+0x54bc): undefined reference to `swap' collect2: error: ld returned 1 exit status Revert the commit to fix the problem. Fixes: 2c769ed7137a ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner") Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/userfaultfd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index d3fd24f9fae8..2f49c9af1b58 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1417,6 +1417,7 @@ 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]; @@ -1527,9 +1528,13 @@ static int userfaultfd_stress(void) count_verify[nr], nr); /* prepare next bounce */ - swap(area_src, area_dst); + tmp_area = area_src; + area_src = area_dst; + area_dst = tmp_area; - swap(area_src_alias, area_dst_alias); + tmp_area = area_src_alias; + area_src_alias = area_dst_alias; + area_dst_alias = tmp_area; uffd_stats_report(uffd_stats, nr_cpus); }