From patchwork Mon Jun 19 23:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13285015 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 1511FEB64DA for ; Mon, 19 Jun 2023 23:11:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B21BA8D000B; Mon, 19 Jun 2023 19:11:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD28E8D0001; Mon, 19 Jun 2023 19:11:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94BC28D000B; Mon, 19 Jun 2023 19:11:04 -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 828D98D0001 for ; Mon, 19 Jun 2023 19:11:04 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 392FF140343 for ; Mon, 19 Jun 2023 23:11:03 +0000 (UTC) X-FDA: 80921044806.18.31ACE76 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 18DFA1C0009 for ; Mon, 19 Jun 2023 23:11:00 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J7pkeBTk; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.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=1687216261; 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=Q9/12tNDzudhH2D96BB+do8pSbCXovnrQ0+foYJ/fZ2cbwLVnhTd2bSKhwxw6j3K27pj8d r6gGKKDfrT9+Wy3eQBATc8kIUkojst20/3SksyPjhX82BzKU4a0sNnKK0mo4IdI+/5xOeK teV00GRxWbUOFLsjdf0VsBaTAU12oow= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J7pkeBTk; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.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=1687216261; a=rsa-sha256; cv=none; b=WpbNjIn3vkQbJLvCrrDYWwF9osUDd9INrjHU7j9YNvj/G1smVNbd8WlTPNmjhNZxsPDwQq fSZYJjMS9kX0eRrZXTdYFB9qau/8MHMQYrTQiMk9ezl0Lk00WvhRkvgJV9iH6iETi7bClE iZuL5SdBk9jzpSbNwcyhvwz9BUtJd4k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687216260; 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=J7pkeBTklplcTv8Y+ughcu9h4NNKM/E9ufPJ7QTXVfwQpjm6C+UtnqksTZvBRuHUpAJMgh zL9OyZu+TqkPohaeNh40VIURjRbuzBZDOlrBWXzDENj5/lbMXqAw6nanA6klaj56o4rwg3 5AQ3bpD5guy4Po0pMt4gPljaaJIzaM8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-2u7MNBRJMsSWK3IzRA40Kg-1; Mon, 19 Jun 2023 19:10:58 -0400 X-MC-Unique: 2u7MNBRJMsSWK3IzRA40Kg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7625940fbf3so29809285a.0 for ; Mon, 19 Jun 2023 16:10:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687216258; x=1689808258; 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=AcvlZ3cM3RSk51XVSv5rxozi/2WGG3VN3xFEt5EHt6ejDtnWWFkQuN/B7YvzFDNC/J HwIPIUBIzOq0D6jzgJh0nfgBpKywDeuj1q5WxbHdcIj/IsRArGmTdlEQGg6e7m++UfXJ Gtt3OMIOrxpFJfNcRmKxjA3BN3s876Qvo7aJC5YVst09QCTvZFSAoLUVHvfhTLPUekAf peC2Gn44AbBPQSwrsmkhADpmlzSgniP/qAa6t43rrlFPKgtaVXe0x4AglRgqnjkms/h5 vaCwFrX2DK85Uqd0exsA8kOwGSLzbc1jca6KPNEl7Kzcxz5XJeKKMwtvQjYjfv3WlVDG KQUw== X-Gm-Message-State: AC+VfDyaBAgVwCm/GwN2A/FPA8abq4+zeb5ZRzU+wsK6Uw/MSRJmwsdx nyuh4eEHagbRYXTVz1W47ZnPOXmTmbLddnTXjKHcF/r7oqk+Ic1Mk9+IVQUrHZAMY4Cmk8l0Kb4 VAeUbesCb7Eg3BewsIpMRzv7UNbrcI855Xnf+BDuov7zX9iiY6XEZ2RwyW3kNvfgqjVNW X-Received: by 2002:a05:620a:4104:b0:762:63b:e10b with SMTP id j4-20020a05620a410400b00762063be10bmr14345389qko.1.1687216258336; Mon, 19 Jun 2023 16:10:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WYX27wSLfWLAP6ptDSxeQjeiOuxTJdqk6j7utUmQ2LCWuj5byVhLohQPj0ZsEQC2nxlnrpw== X-Received: by 2002:a05:620a:4104:b0:762:63b:e10b with SMTP id j4-20020a05620a410400b00762063be10bmr14345358qko.1.1687216257943; Mon, 19 Jun 2023 16:10:57 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id t15-20020a05620a034f00b007592f2016f4sm405864qkm.110.2023.06.19.16.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 16:10:57 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrea Arcangeli , Mike Rapoport , David Hildenbrand , Matthew Wilcox , Vlastimil Babka , John Hubbard , "Kirill A . Shutemov" , James Houghton , Andrew Morton , Lorenzo Stoakes , Hugh Dickins , Mike Kravetz , peterx@redhat.com, Jason Gunthorpe Subject: [PATCH v2 8/8] selftests/mm: Add gup test matrix in run_vmtests.sh Date: Mon, 19 Jun 2023 19:10:44 -0400 Message-Id: <20230619231044.112894-9-peterx@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619231044.112894-1-peterx@redhat.com> References: <20230619231044.112894-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 18DFA1C0009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5i4rw3hnri6fmq83a1fxuryrs3ga7eid X-HE-Tag: 1687216260-827878 X-HE-Meta: U2FsdG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BjP2y6gkW7yqeAghGGoswHI4Cir1z9g1tB4GtLzhtxmfASR09PUJuMdJ0+f7HEgDu3i4jF/rby6L8PW0hEcy0pF4eVc3aWpUIDoUJ0S6IyUw5bRXSR48fyGR2G4WJMmuWp6MHQpz5VJzs9uHxe7slSMaRtEnwa5q/PB52h4tsrOZOgclW2QyavoHvbQqNSaOgxXIsckE//SXOfPbSGtT4cEbjHbxkpxsmCce9DZU82iDp4glryPHPSXZj3fQzQ+9WUfV9rwZtjEXgGlzkASCpEAMFU+CPgCgYbi/wD4TBXgBpKx9cWy7e5MZpmpIhOXt58DbPxhoqwbm1jWraRazycjGWdo3+wLKZgg== 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 --- 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