From patchwork Fri Feb 4 17:57:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12735416 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 BECA8C433F5 for ; Fri, 4 Feb 2022 17:57:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 540B16B0081; Fri, 4 Feb 2022 12:57:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EFA56B0082; Fri, 4 Feb 2022 12:57:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 391106B0083; Fri, 4 Feb 2022 12:57:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 2AB806B0081 for ; Fri, 4 Feb 2022 12:57:23 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EA047951B2 for ; Fri, 4 Feb 2022 17:57:22 +0000 (UTC) X-FDA: 79105854324.21.E9B2910 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf12.hostedemail.com (Postfix) with ESMTP id 9B78440007 for ; Fri, 4 Feb 2022 17:57:22 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A08A3B83876; Fri, 4 Feb 2022 17:57:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B558C340EB; Fri, 4 Feb 2022 17:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643997440; bh=lF8DoC9XFDibW5PMa0160z5XrJHiPaP5hlSQbu4HXcI=; h=Date:To:From:In-Reply-To:Subject:From; b=BC3uSmvydvpx8NQ6d+eV3R992Z20h6kmFzTglrB72B0gT1eRLEp09RR31/p4DqE1h meuZo2Ts8Wm2UfQEhcgGOTZSVvcrbQOi3GTbwTT8w+iJgzoMDy+SNAnqFKZoadFWbN Vr2QV+eZP6fjNrD1RBPKI8CAZo6d1TffReDakRBY= Received: by hp1 (sSMTP sendmail emulation); Fri, 04 Feb 2022 09:57:18 -0800 Date: Fri, 04 Feb 2022 09:57:18 -0800 To: shuah@kernel.org,chi.minghao@zte.com.cn,skhan@linuxfoundation.org,akpm@linux-foundation.org,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220203204836.88dcebe504f440686cc63a60@linux-foundation.org> Subject: [patch 10/10] kselftest/vm: revert "tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner" Message-Id: <20220204175719.1B558C340EB@smtp.kernel.org> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 9B78440007 X-Stat-Signature: ih38gqowrqqzt6qzix6p1xfa7nagaaqx X-Rspam-User: nil Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=BC3uSmvy; spf=pass (imf12.hostedemail.com: domain of akpm@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@kernel.org; dmarc=none X-HE-Tag: 1643997442-479394 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Shuah Khan Subject: kselftest/vm: revert "tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner" 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. Link: https://lkml.kernel.org/r/20220202003340.87195-1-skhan@linuxfoundation.org Fixes: 2c769ed7137a ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner") Signed-off-by: Shuah Khan Cc: Shuah Khan Cc: Minghao Chi Signed-off-by: Andrew Morton --- tools/testing/selftests/vm/userfaultfd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/tools/testing/selftests/vm/userfaultfd.c~kselftest-vm-revert-tools-testing-selftests-vm-userfaultfdc-use-swap-to-make-code-cleaner +++ a/tools/testing/selftests/vm/userfaultfd.c @@ -1417,6 +1417,7 @@ static void userfaultfd_pagemap_test(uns 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); - - swap(area_src_alias, area_dst_alias); + 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; uffd_stats_report(uffd_stats, nr_cpus); }