From patchwork Fri Jun 23 14:29:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13290740 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 79DBEEB64D7 for ; Fri, 23 Jun 2023 14:30:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 103D18D000B; Fri, 23 Jun 2023 10:29:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 018C08D0001; Fri, 23 Jun 2023 10:29:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C771A8D000B; Fri, 23 Jun 2023 10:29:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A693F8D0001 for ; Fri, 23 Jun 2023 10:29:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 10E311A0BFF for ; Fri, 23 Jun 2023 14:29:56 +0000 (UTC) X-FDA: 80934246792.12.80B3496 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 9D8D54001B for ; Fri, 23 Jun 2023 14:29:53 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RrMul7MA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.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=1687530593; 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=lJajW3CLipjyQ640k+WW23diII/jzqCXLm/r+yoabGU=; b=wOM/Ll3wLWtWfZuX+JVQa0yPOiLGFbRjtw3MXyBsGV+k5dGKHJjOC6yEFDQSoJwBe7Sexf JeFUYJ5rKOSSVl9xGpC+O+dFwql70jp9HpKrEYWcI1IGt490yuSMm76KMJYM8elVMJI4N0 nRHEdDHYJKLc1lJWklV1CL0AWOCnllw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RrMul7MA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.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=1687530593; a=rsa-sha256; cv=none; b=NX5OS8D/ViPMIki7W3p4ZlECU1gCEMV8GnCmgX+TW1qmK9qhMJA+zhj0BXmuhI5uR95v1y tb+tAkV0RX+Ef/uZoobky10rdB+Liup4neSlxE0/i/vMNqsIwm6p2JR3hXp4tmPbM8Cg0J q12VnR5cPOnH8JRz2n3VISBx16LkWCs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687530592; 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=lJajW3CLipjyQ640k+WW23diII/jzqCXLm/r+yoabGU=; b=RrMul7MA6Rk34gsaegcXF6jSniHsHVgfn7EBSkPVgS5e6IHGH2bZYKS9UhPoe+XwB2nkAV DtfIypVKDSh++BB73QR9AVoAUfxyiXtl+wJHpPaWK1MGxUhl5i4Dp1kTW8JV+z1n6vnl9L nLezkB7b60af/YoAzXvatZWTXQaqr5Q= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-BP8-0__qNz2uDwI7Tsh2ig-1; Fri, 23 Jun 2023 10:29:51 -0400 X-MC-Unique: BP8-0__qNz2uDwI7Tsh2ig-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-62ffa1214edso1381726d6.0 for ; Fri, 23 Jun 2023 07:29:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687530591; x=1690122591; 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=lJajW3CLipjyQ640k+WW23diII/jzqCXLm/r+yoabGU=; b=h22OljXEJpf9SQRlA4t/VJ6N5HodXin8uGEULWTDceNK7ewsjZrN8KYYcgCMEYLsQb aa4KiXjnOQ6L5cs7a2eN2M32F6NFXbzV2RAUAkbAa0SR2/ncUunUKErzEn3FZy96ZTUk C7iOIZIHKubSYQl4jIwj41JAQeHcE37ynTfuX4Qx+TkWLMAaxUG2ehtaABcmFpXqKoTx n6etJ1KSp85DpSDnrztJpuS0AoQsq5lyrDHGANBaH2qJdtvofF9XrRaBMa2xBqrhUJjA R7a0cccLlbiDlkEJjNOPCcLVW1BJddv23PLmayhmooKWd1baYvyjqzjHsz7y2l4BDVlv 4n7g== X-Gm-Message-State: AC+VfDw+NA1NO60srj3oKGFYIviqJ9wjHYbIxYHuSPB3vYnIvxdegJXH fIEfCT+F3q6YE5+1LXBQ/nyAkQ45ltvCMsjg3Syx4AqC98S9AnRk041XaDa45a1Q0HVDuQNB6t+ M8H21UjGycgwfUZOr7vIqAqZcArFxClZ5GVvnKMxFe0IvEF+Z8aEmRWX+ehSLSsCFqzdf X-Received: by 2002:ad4:5b8a:0:b0:62f:e4de:5bed with SMTP id 10-20020ad45b8a000000b0062fe4de5bedmr25209299qvp.5.1687530590877; Fri, 23 Jun 2023 07:29:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LBdflQdmHl6rCFBv/aEN13DoGpkWXXDa3kzujb7sug+FgkYDvvz3ULmIE5oitFlMfpXnucg== X-Received: by 2002:ad4:5b8a:0:b0:62f:e4de:5bed with SMTP id 10-20020ad45b8a000000b0062fe4de5bedmr25209269qvp.5.1687530590562; Fri, 23 Jun 2023 07:29:50 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id b9-20020a0cc989000000b0062821057ac7sm5104827qvk.39.2023.06.23.07.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 07:29:50 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Lorenzo Stoakes , John Hubbard , Andrew Morton , Mike Rapoport , David Hildenbrand , peterx@redhat.com, Yang Shi , Andrea Arcangeli , Vlastimil Babka , "Kirill A . Shutemov" , James Houghton , Matthew Wilcox , Mike Kravetz , Hugh Dickins , Jason Gunthorpe Subject: [PATCH v3 8/8] selftests/mm: Add gup test matrix in run_vmtests.sh Date: Fri, 23 Jun 2023 10:29:36 -0400 Message-Id: <20230623142936.268456-9-peterx@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623142936.268456-1-peterx@redhat.com> References: <20230623142936.268456-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Stat-Signature: mwah5zckxorm7fbg88njbuf5jdsttife X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9D8D54001B X-HE-Tag: 1687530593-579711 X-HE-Meta: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P7PUBpKbOhlTQ3DgwK9qm84ebsxfFGf+uBehB2fktY2sr7UF+591D7V9wzdUYWq4iDyER94dyffY7rE3c74k1sKF7LTGKW8jfeoOxGnbE7WljpWzq1khV+nFjQwdBJnViz/o8uwTcWxJmXfdyWWdOzSDrQ5fljDdgUBdHaPEnhnqz4hZ5OsNxtyvbJIvV6veCJM5xbtGaAjM0/0lTe19cYGt5O1Ll1WWWKygrfg9duVBAiNuQTzCKau263Ag8Y0YBT8bQKCvXGNpfNI8tjxHX6A4H6Z1V+YlGUWJD93EgnCvgkZ7uy3Bk9vual/n2xl0HRsljlvsfshyChooErWAjfIzA== 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: Add a matrix for testing gup based on the current gup_test. Only run the matrix when -a is specified because it's a bit slow. It covers: - Different types of huge pages: thp, hugetlb, or no huge page - Permissions: Write / Read-only - Fast-gup, with/without - Types of the GUP: pin / gup / longterm pins - Shared / Private memories - GUP size: 1 / 512 / random page sizes Signed-off-by: Peter Xu Acked-by: David Hildenbrand --- tools/testing/selftests/mm/run_vmtests.sh | 37 ++++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 824e651f62f4..9666c0c171ab 100644 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -90,6 +90,30 @@ test_selected() { fi } +run_gup_matrix() { + # -t: thp=on, -T: thp=off, -H: hugetlb=on + local hugetlb_mb=$(( needmem_KB / 1024 )) + + for huge in -t -T "-H -m $hugetlb_mb"; do + # -u: gup-fast, -U: gup-basic, -a: pin-fast, -b: pin-basic, -L: pin-longterm + for test_cmd in -u -U -a -b -L; do + # -w: write=1, -W: write=0 + for write in -w -W; do + # -S: shared + for share in -S " "; do + # -n: How many pages to fetch together? 512 is special + # because it's default thp size (or 2M on x86), 123 to + # just test partial gup when hit a huge in whatever form + for num in "-n 1" "-n 512" "-n 123"; do + CATEGORY="gup_test" run_test ./gup_test \ + $huge $test_cmd $write $share $num + done + done + done + done + done +} + # get huge pagesize and freepages from /proc/meminfo while read -r name size unit; do if [ "$name" = "HugePages_Free:" ]; then @@ -194,13 +218,16 @@ fi CATEGORY="mmap" run_test ./map_fixed_noreplace -# get_user_pages_fast() benchmark -CATEGORY="gup_test" run_test ./gup_test -u -# pin_user_pages_fast() benchmark -CATEGORY="gup_test" run_test ./gup_test -a +if $RUN_ALL; then + run_gup_matrix +else + # get_user_pages_fast() benchmark + CATEGORY="gup_test" run_test ./gup_test -u + # pin_user_pages_fast() benchmark + CATEGORY="gup_test" run_test ./gup_test -a +fi # Dump pages 0, 19, and 4096, using pin_user_pages: CATEGORY="gup_test" run_test ./gup_test -ct -F 0x1 0 19 0x1000 - CATEGORY="gup_test" run_test ./gup_longterm CATEGORY="userfaultfd" run_test ./uffd-unit-tests