From patchwork Wed Apr 12 16:45:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13209366 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 B294FC77B6E for ; Wed, 12 Apr 2023 16:45:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FD4B90000D; Wed, 12 Apr 2023 12:45:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 485F1900003; Wed, 12 Apr 2023 12:45:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34D2E90000D; Wed, 12 Apr 2023 12:45:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1EE31900003 for ; Wed, 12 Apr 2023 12:45:54 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id EFE411A01AD for ; Wed, 12 Apr 2023 16:45:53 +0000 (UTC) X-FDA: 80673315786.15.7A24372 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 8931940026 for ; Wed, 12 Apr 2023 16:45:51 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DOeG+nrn; spf=pass (imf27.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681317951; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z2yWZt1s7MuVGMeOCGLd+TTj5TTX+8gBX0BUmTSUDX0=; b=AjGrmiLYwVnJpeMSjJqPcE0Z1yxKdMbl4lvvy9DDzGDEUWE4VvEu79YZxvWDTGSuSe8HJy 469TZEqvJNkTQt5b1jmY9j/Py/4mNiOos4G/6ceQFNPQHKRcSeHAYf0hijcGgMUDa9ZAX/ ff7/deiuXzkFoE6iQmIVwresQ4dyjKM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DOeG+nrn; spf=pass (imf27.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681317951; a=rsa-sha256; cv=none; b=69x2vV6Hlk4D5a9O0PbGJkwygpK/5XjJ0uKri9AtxkH/SYEiMb2treTdjJ4bHlAHepAuae YSh3GBAvwjgqauwXwKT9UgrbJJr5UXAim3Bhucuc/721aK5+8BE5Z6UtB8FMs9kdTH2/Dc bSGVxDl2J5fdEJbPgYvKbGFZrluWth4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681317950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z2yWZt1s7MuVGMeOCGLd+TTj5TTX+8gBX0BUmTSUDX0=; b=DOeG+nrnTeXq1IzGLe165crwF322vX7D+JeiC9MHkKeIVG932ih/9fEEKHejRX8dWzyCig MGWvb813CW42zT7lppQOfu0L/lFjt+BHbo7PQtsaouKc2Jtb1G2sMz1X5tnDjQ9DxHjw+J 5NC5Q2TXBHXtIJAPWPJhLVpGyExV4Ss= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-_Fsg0xqCMm-G9CA3K9FjkA-1; Wed, 12 Apr 2023 12:45:49 -0400 X-MC-Unique: _Fsg0xqCMm-G9CA3K9FjkA-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-3e699015faeso3548741cf.0 for ; Wed, 12 Apr 2023 09:45:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681317948; x=1683909948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2yWZt1s7MuVGMeOCGLd+TTj5TTX+8gBX0BUmTSUDX0=; b=dPLzUtH8TmsrIFvpGnu6oEejQbhRfVcA32HUE0VkPCGruoNW1r2ZAlBq7OIqKREnAu sLUHv3MpYGFKToRUWfvbcn0LxNdaJ8ldpc7HmgKGuE/C4sZkU/NqvzsrivVOjwdOhevl cUDebKPPzlA+GPMCawPtEqg+p6ObUqqPz1RJybsuGtGeYES3YyaC3ZFWV37DCMux1k2A 6CW8sPllXIZNjml6xoq5IxMZLlx0B2eRAbs/BWFGnqL9lbaG5rFMfYXwSVJp+GWuCGvH U9hiyzVZa9TG7J6zOBO/0i56UFjXi5j22c5CW0VYl2T66dj0+U2Wuw/7xd47QJ7lM+Rh S//Q== X-Gm-Message-State: AAQBX9el3HEOgGflUagm9aWQR+/EUDWiS2qF2dq1YAIkMuu/GpEnQe25 cro1doxnDAAuB1uQYkR06Ag2c0NljvR0CcAxyc8itC2SMygrE+AOK7d7xSDDNjWYkuYvy7gf1/c m0MLbgGhEFKtI3zJ5bp5rh51EUwDTqAfVaxqR8MXW4tHBz7M3gTpPjt0WgshGlrFDtNla X-Received: by 2002:a05:622a:19a1:b0:3e3:98cf:68ae with SMTP id u33-20020a05622a19a100b003e398cf68aemr5389676qtc.2.1681317948392; Wed, 12 Apr 2023 09:45:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZiKY7ANBKy64ZZqrbCk8PQr9/JPPi7k1BmBEe0htozZ6mrlT6vo8j3lhtJ4S3TO2Z85boE2w== X-Received: by 2002:a05:622a:19a1:b0:3e3:98cf:68ae with SMTP id u33-20020a05622a19a100b003e398cf68aemr5389622qtc.2.1681317947950; Wed, 12 Apr 2023 09:45:47 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id d23-20020a05620a141700b00746803d7e8dsm4761888qkj.113.2023.04.12.09.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 09:45:47 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Leonardo Bras Soares Passos , peterx@redhat.com, Mike Rapoport , Nadav Amit , Andrea Arcangeli , Mike Kravetz , David Hildenbrand , Andrew Morton , Axel Rasmussen Subject: [PATCH v2 30/31] selftests/mm: Add shmem-private test to uffd-stress Date: Wed, 12 Apr 2023 12:45:46 -0400 Message-Id: <20230412164546.329355-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230412163922.327282-1-peterx@redhat.com> References: <20230412163922.327282-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: gfa5p5byepgp4gpkdybfjbhrdkzf3369 X-Rspamd-Queue-Id: 8931940026 X-HE-Tag: 1681317951-21457 X-HE-Meta: U2FsdGVkX1+EVh20VRbqKXbvqqkmQU3GE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+H25clxT/MnxyehvkwbB13QqO5yOP2boajwUvAqlpfJYBB+u3BKccaaXzkjjj/tkuKQxGUYggXnDonKomVyTUewjfT3a9wWDQUO1wT+PgdVz5PPft5gSd3KbU7FzFe134vw8QisXbJsYb0+cLOi/UZyL2HMYb7TDFxFxJVOOOvtLCKjb6R2cZ6rmIo4nv8FkgdshVKxcfGT9oMot5RyLWFEo5bFRJT5NxmbODqZlUyLNjqd7cn4CGwnb/BptJX2Hyk16HtlOISed+aOQQPLyIplfu0pfoQP8BW/aPtUzwH5zhbFlWxj/ZaCH5TVb/IAdT3krxe6kHii+Ryx3nGRlPQCOh2ly/1HYbt3uM2xPM 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: The userfaultfd stress test never tested private shmem, which I think was overlooked long due. Add it so it matches with uffd unit test and it'll cover all memory supported with the three memory types. Meanwhile, rename the memory types a bit. Considering shared mem is the major use case for both shmem / hugetlbfs, changing from: anon, hugetlb, hugetlb_shared, shmem To (with shmem-private added): anon, hugetlb, hugetlb-private, shmem, shmem-private Add the shmem-private to run_vmtests.sh too. Signed-off-by: Peter Xu --- tools/testing/selftests/mm/run_vmtests.sh | 3 ++- tools/testing/selftests/mm/uffd-stress.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index ecc16ea6fc40..438eb49567b6 100644 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -202,8 +202,9 @@ CATEGORY="userfaultfd" run_test ${uffd_stress_bin} anon 20 16 # Hugetlb tests require source and destination huge pages. Pass in half # the size ($half_ufd_size_MB), which is used for *each*. CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb "$half_ufd_size_MB" 32 -CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb_shared "$half_ufd_size_MB" 32 +CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb-private "$half_ufd_size_MB" 32 CATEGORY="userfaultfd" run_test ${uffd_stress_bin} shmem 20 16 +CATEGORY="userfaultfd" run_test ${uffd_stress_bin} shmem-private 20 16 #cleanup echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index 4e071a7d0ff5..f1ad9eef1c3a 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -59,8 +59,8 @@ const char *examples = "./userfaultfd shmem 1000 99\n\n" "# Run hugetlb memory test on 256MiB region with 50 bounces:\n" "./userfaultfd hugetlb 256 50\n\n" - "# Run the same hugetlb test but using shared file:\n" - "./userfaultfd hugetlb_shared 256 50\n\n" + "# Run the same hugetlb test but using private file:\n" + "./userfaultfd hugetlb-private 256 50\n\n" "# 10MiB-~6GiB 999 bounces anonymous test, " "continue forever unless an error triggers\n" "while ./userfaultfd anon $[RANDOM % 6000 + 10] 999; do true; done\n\n"; @@ -69,7 +69,7 @@ static void usage(void) { fprintf(stderr, "\nUsage: ./userfaultfd \n\n"); fprintf(stderr, "Supported : anon, hugetlb, " - "hugetlb_shared, shmem\n\n"); + "hugetlb-private, shmem, shmem-private\n\n"); fprintf(stderr, "Examples:\n\n"); fprintf(stderr, "%s", examples); exit(1); @@ -376,14 +376,17 @@ static void set_test_type(const char *type) } else if (!strcmp(type, "hugetlb")) { test_type = TEST_HUGETLB; uffd_test_ops = &hugetlb_uffd_test_ops; - } else if (!strcmp(type, "hugetlb_shared")) { map_shared = true; + } else if (!strcmp(type, "hugetlb-private")) { test_type = TEST_HUGETLB; uffd_test_ops = &hugetlb_uffd_test_ops; } else if (!strcmp(type, "shmem")) { map_shared = true; test_type = TEST_SHMEM; uffd_test_ops = &shmem_uffd_test_ops; + } else if (!strcmp(type, "shmem-private")) { + test_type = TEST_SHMEM; + uffd_test_ops = &shmem_uffd_test_ops; } }