From patchwork Thu Mar 30 16:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13194511 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 2C2D1C761A6 for ; Thu, 30 Mar 2023 16:08:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B379590000A; Thu, 30 Mar 2023 12:08:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE6876B009F; Thu, 30 Mar 2023 12:08:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 986FF90000A; Thu, 30 Mar 2023 12:08:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7FFA26B009E for ; Thu, 30 Mar 2023 12:08:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 408D4140340 for ; Thu, 30 Mar 2023 16:08:49 +0000 (UTC) X-FDA: 80626047978.22.3AE90FE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 0E1B920019 for ; Thu, 30 Mar 2023 16:08:45 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="J1vMA/q4"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680192527; 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=QgmTtu8OFjFdW8yq7WIzzTW/am1uahC9wawM1FIOBXg=; b=4yBYGA9j2euq8ZuJ1oSzMQoM6bsk0wAvJBxvHfWYjxQ6tErbWWAHzFICqc42psrmz/JFKu 7WAt7AFhB3RSCK/p65cxWI2TRQBqXmXPh2bkS/ltiJKtVA3k/p4vb1sgoQxOxk4r803G/W gChaXBq1A8WWWkyd95A17lFHbB9sXGM= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="J1vMA/q4"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680192527; a=rsa-sha256; cv=none; b=pg8lRpKk11bFrQSrksjgb7dsfHnifQnf9IiH72vkj0UReRigbmzS7ZP7Ym2UrYBifTo/7Q /OGuk1c/xF/A1M+0QpGxVFmUdESTR7dacUpYfN7vT1egMgttc/cB2dUqvdRelK9CL7EkPl Akc/7dELMcPYkuY7TM8iWDBFw83Y3pw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680192525; 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=QgmTtu8OFjFdW8yq7WIzzTW/am1uahC9wawM1FIOBXg=; b=J1vMA/q4zDrPX3sUb4S8XvXbtYwpnOHWGtjN6hhYDmSZth0VUSduiNZmzruQVuLBQgqHDU WYZIerWvQW+k8/JoJJWjj+4wGttGNOVGx9f/W0qhd3oFiUsD2h4JlIsjCSsMaix3rEqZhA 5bYRyQGtTwq3SxQzQpxlYbFkpwoVclA= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-4URUY3gWMMmJSzQwAZk1yw-1; Thu, 30 Mar 2023 12:08:44 -0400 X-MC-Unique: 4URUY3gWMMmJSzQwAZk1yw-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-5aae34d87f7so13017726d6.0 for ; Thu, 30 Mar 2023 09:08:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680192522; 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=QgmTtu8OFjFdW8yq7WIzzTW/am1uahC9wawM1FIOBXg=; b=xwFQ81dgUeX1Fk8jJQ0j1kz9JRMO8PCpeTNfryQBytBKw4nz7O7ri4CZjkLEf5wzmT /3SZ4uvWTknl05DCAudU46W9Zf2mzJXslklSHd6ZxGWt2J7W7ODzkZ72TYe2WLwJNH3p 07rfVa6Mkhj9qyrrNcK3W2zzYto/c4VtuahA/DjpcsTWVIsHx2CB0jH/qhpqDh3PlImo niUWNpjTgSODZgyuKPO/bjUxJYS9KY3BmA7YPYWKSVJw6q8Fz9pmAL2VCuGhEOyrd4Rc i6ybnK73KV5BwDseK0aNSwU6i04ZF7XmcEAZrWdDCWoiWFjZ1UXP+NUkfbKvojykhsHk rzpg== X-Gm-Message-State: AAQBX9d8bTl18KaU7OkbgFxbRmv1mvNZQ0u4djMRqW1FKzektX9R8DbB 0hgAj4Hr+v3WlrYMXiaRvTEOlVL0y3PR39E4u+7/fxJLq+lCWi4/ha4unGpeiVQ20OLkX05UN8D NE1ZC+EYoN+4= X-Received: by 2002:a05:6214:3014:b0:5aa:14b8:e935 with SMTP id ke20-20020a056214301400b005aa14b8e935mr3723997qvb.2.1680192522426; Thu, 30 Mar 2023 09:08:42 -0700 (PDT) X-Google-Smtp-Source: AKy350YMKgyQGsiWXfxMgANl5DSoc8CnFLkGelQ0rF4PH3xD4dOO2E/F49CFek+tRBt85PQwpxWhkw== X-Received: by 2002:a05:6214:3014:b0:5aa:14b8:e935 with SMTP id ke20-20020a056214301400b005aa14b8e935mr3723957qvb.2.1680192522120; Thu, 30 Mar 2023 09:08:42 -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 k2-20020a0cc782000000b005e1235e6f2esm227430qvj.12.2023.03.30.09.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 09:08:41 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Mike Kravetz , Mike Rapoport , Andrea Arcangeli , peterx@redhat.com, Leonardo Bras Soares Passos , Andrew Morton , David Hildenbrand , Axel Rasmussen , Nadav Amit Subject: [PATCH 29/29] selftests/mm: Add shmem-private test to uffd-stress Date: Thu, 30 Mar 2023 12:08:40 -0400 Message-Id: <20230330160840.3107635-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230330155707.3106228-1-peterx@redhat.com> References: <20230330155707.3106228-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 0E1B920019 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: uyt768e6dxx6ih4didn7hx5ox1xbsugq X-HE-Tag: 1680192525-998838 X-HE-Meta: U2FsdGVkX18m9RJ/WBGRIDK0NE/G4xLOOQc7h0F8jVDCBgnuznw3ejjPxan40WcwcPpafa9N3DIYVX2NeYLb1/lNoHqaZ6wlgSBxN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CnRRFByx409olHbHI2Mw91DYvXT+laLt1GTJe/UBNZ6PfFITQXn763u44yqlHgCB1j9inOKbmJL2I03ZGdxUydOrnivfp5wxFbnXfKDV8MYNSnIn8/clKmGRg9ZhfI5NiGgOhH+MQg1fVPH7kp64nNAYYSkOBHWRWPf2GevpoxnS69Glk80JbZvQ+k+oRR5YBDghdm87h2iyolLeMp1sjX19d8zQZriMTJfep68GA8nw3PsvOkTUr6IB9GSvcchclGzIs9YdLtnuvbuMoW1ofUwhMtWiF4/c2CXPAKlu 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 845ce8a48204..b8ab75bc731c 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 7461021dd4af..6172ebfe732e 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); @@ -377,14 +377,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; } }