From patchwork Wed Jun 28 21:53:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13296396 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 C7FFFEB64DC for ; Wed, 28 Jun 2023 21:53:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 675128D0009; Wed, 28 Jun 2023 17:53:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FE038E0001; Wed, 28 Jun 2023 17:53:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 477B78D000B; Wed, 28 Jun 2023 17:53:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 37D708D0009 for ; Wed, 28 Jun 2023 17:53:29 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A3313120325 for ; Wed, 28 Jun 2023 21:53:28 +0000 (UTC) X-FDA: 80953508496.20.930E575 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 8F3132001C for ; Wed, 28 Jun 2023 21:53:26 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WOJXluuh; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.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=1687989206; 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=8+0w023mz5OfdmLI6Zdp3hWUHid6rdaL/9V50JZhDTo=; b=wXYmEXhOgM49zxeWFbeUrCYH5ZbnU52orSUVQVM9Zui5ikFEahOsPFLqhYEQ9fm0YvY1Ng 82IFFOu3hY3KVqBHR46VWsXPHtY7/paqXuSUit2Hnbt3Znoi6Kb7uZK6X+2TvbfxNtbm4A W7VkKkSdfuA27tkd6bVXGx0bZLvUGAM= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WOJXluuh; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687989206; a=rsa-sha256; cv=none; b=OcNz0R20XBD0i3eAxWz5frXcCeTv8OOV/BMjexH0b0nWGz9TpuzBBqafmTlj2nkxNuOxBm +9xyXsRcbGZ83GtxAPR6X7MsQErgzdzzBCCjn8hFbNp6DLV5uXvXvvsusI5lW4JDXrmoRD WibOQwwiyrWoA/voHuMS9fXA+S6+zck= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687989205; 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=8+0w023mz5OfdmLI6Zdp3hWUHid6rdaL/9V50JZhDTo=; b=WOJXluuhvY5SE7U2TL8m+i9Q5kZWASrn3LgUVtKG8hWGL+ZzWPDayJacpXIVqiEAs5jZ5s 1RF62Iu4nY7Ozf4oKspsXLpkpn9StThKt4Pu+UCAP9WoG7Y7DVgTreMojJzHJQjRf4fDcz 2/vGMHG3owV6KMySk85dfCG+IHJRKjQ= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-geVrfBogN2i-8Qyt65LTIg-1; Wed, 28 Jun 2023 17:53:24 -0400 X-MC-Unique: geVrfBogN2i-8Qyt65LTIg-1 Received: by mail-vs1-f70.google.com with SMTP id ada2fe7eead31-440bb217ba2so3078137.0 for ; Wed, 28 Jun 2023 14:53:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687989204; x=1690581204; 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=8+0w023mz5OfdmLI6Zdp3hWUHid6rdaL/9V50JZhDTo=; b=X0U9Y7IaetB1IjlxUl45A9okA7XN8AmsMXYD0vYiAC49Fh5j5Pi3T1Ma7lzl1rAPe7 ZLB90dEc3XlwFX3yI3oxfGlmzqotTW8B87e63bcSAy40nuxhc4hVVsBuuTkFH11CVs51 JO86+JuRCsza04uN5/x+iW44ztEDqiO5HeNS87MRenR5ZE4dZoWIsE8KVBJ+aO7hNCr5 rWjk+wp+WZsQLtfin8gj9AiBaGbiqgMpYWVZrgzFsnE9J3fwgdE1DZkEU1Ac5x+cSHXB 8TqMjTU1pUcyYaW/nbp3QQ4D5bGxqxbVyK6R8IRa6hrN6qCWxYgO9rgk/w7/PiUbPVTl 0zGQ== X-Gm-Message-State: AC+VfDymF9Rbjw8weeNnpkgc4998F6B5WKcA7v0xeqOM54hbVzZEfJoF p+Wu8Di0bjSdzp+6kesDulD8UhCO0nTBtIrcl5PQjXhxJsjCpJe/4YTqa6Hn9YoQ2E9E2RCb/kG ItrDG355tDjbZ2RfAiLpmR28chpXQFBIaU9SKhFvjmruOLEq/ZuDIUjP8D1dn2X6zZYyB X-Received: by 2002:a05:6102:3e16:b0:440:9794:fefa with SMTP id j22-20020a0561023e1600b004409794fefamr960345vsv.0.1687989203721; Wed, 28 Jun 2023 14:53:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ593pf/LYdqYwensAF9OSWrZV3jL3XksL0J6jNBIon+rk3QrdtClhhmqvv34L8EI9C3xofIng== X-Received: by 2002:a05:6102:3e16:b0:440:9794:fefa with SMTP id j22-20020a0561023e1600b004409794fefamr960312vsv.0.1687989203304; Wed, 28 Jun 2023 14:53:23 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id p3-20020a0cfac3000000b00631fea4d5bcsm6277797qvo.95.2023.06.28.14.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 14:53:23 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , "Kirill A . Shutemov" , Andrew Morton , Andrea Arcangeli , Mike Rapoport , John Hubbard , Matthew Wilcox , Mike Kravetz , Vlastimil Babka , Yang Shi , James Houghton , Jason Gunthorpe , Lorenzo Stoakes , Hugh Dickins , peterx@redhat.com Subject: [PATCH v4 8/8] selftests/mm: Add gup test matrix in run_vmtests.sh Date: Wed, 28 Jun 2023 17:53:10 -0400 Message-ID: <20230628215310.73782-9-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628215310.73782-1-peterx@redhat.com> References: <20230628215310.73782-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 8F3132001C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 9kyp7fcipoi9a8qw699usb453amnrkqs X-HE-Tag: 1687989206-630673 X-HE-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PJ6XyWkFtIZxiYVUrzAS60xokv9yv96gP88staAx7C0z7q2v5pqF9Ko056bkuDBliQptFOpvttCpmeWQX00XSsFzth8HuUZrZiCEJ9POQ+2auHNyucagq60INXeZpVTzv6K/RPX6XeZK3WO4aB9fesk8U6XR33ufhLMqxPu1KXE0DXFXxWBV/eNLAalRMHWND8fWi5Em1U+H+UAF1F33KB6Zup7KJfX5uHxTYe/H1H+wXT7UBRFAw2fL+/PABY6T6HBpZrgwtEmi+TQs2itI+02h/cbaXI2J+pCnea7FZ0EZ05S9bVkjmNwWtqvOJVdad87oZ555EISbsoCIx55wWaJNPmIoERQFQuBIfA== 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 Acked-by: David Hildenbrand Signed-off-by: Peter Xu --- 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