From patchwork Thu Mar 30 15:56:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13194482 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 22E9CC761A6 for ; Thu, 30 Mar 2023 15:57:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7B9D6B0071; Thu, 30 Mar 2023 11:57:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A04C76B0072; Thu, 30 Mar 2023 11:57:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 857A56B0074; Thu, 30 Mar 2023 11:57:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6C06E6B0071 for ; Thu, 30 Mar 2023 11:57:16 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DF29740F5E for ; Thu, 30 Mar 2023 15:57:15 +0000 (UTC) X-FDA: 80626018830.08.A68287E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id C2C651C0021 for ; Thu, 30 Mar 2023 15:57:13 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WXZXpFut; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.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=1680191833; 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: references:dkim-signature; bh=FzU8AXRTXgJivs+tA11Cp/oPoX+kOjKqZrLE55Kt59I=; b=xjT0/izlfq9XWhT+Dco590LqgIpGV3GDwCpmiKpD6OutNAWhD9JS+nbh/ho+a05BQgrABM +J8F9N99de9eKsUqGtBpX/ZKDXzHRri3lqgygbXse0BIVlp3Vo0ldeAPAtv8yf8M/9dnqr QZ4EFl/YbvCcQFenJnR+84sPELU1WYc= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WXZXpFut; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.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=1680191833; a=rsa-sha256; cv=none; b=lyLnmH/0IDso5eIqxC7TCJws7KQSD/yuoK1I1jhj8F2feFiku9eWMAv4RWs77nBAWeMhYb 8iBW0QTHeQsKjA5ftVT+vh8yDiFrzCdHOoLQtQyXAA20OgJ/lfmVdXsjjC4ZL6oOD4zPEu 98AKsYtV9qIEvl2ZBpS6vDoM9BpVoxA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680191833; 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; bh=FzU8AXRTXgJivs+tA11Cp/oPoX+kOjKqZrLE55Kt59I=; b=WXZXpFutv9dneryIcSscgB4BDA2rWchMedigbeRZxMSj2mNk8ni8K5c/SfZyNOUoa5mM3I rrKUPzf5qLwh0z1E1NjvBGo3oog+Dd6GXlxWxYk5iSTttA23xinr7clui4qm4hbYSb1swK T8N/KIEK9wIaQLvRygFfh86zCPSpNAk= 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-152-NR0l6SqiNimyEV8vksK-NQ-1; Thu, 30 Mar 2023 11:57:12 -0400 X-MC-Unique: NR0l6SqiNimyEV8vksK-NQ-1 Received: by mail-qt1-f199.google.com with SMTP id v7-20020a05622a188700b003e0e27bbc2eso12691845qtc.8 for ; Thu, 30 Mar 2023 08:57:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680191830; x=1682783830; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FzU8AXRTXgJivs+tA11Cp/oPoX+kOjKqZrLE55Kt59I=; b=ugA3TVeKQ6BAalihnEb9a3ZWuBmlQ8WEIDblLzwhr7Vr+ha82BLXb5JGLoVXpmPbvG rEOx4WBRMARmrGAXNbA36ps+MGAcAQma2TzAWta8ePlg4JJ4O2b1BZZ7u1KggOH3P4lu OltFMufRm8b5ObJaSdWxPhuqTMgvcJYP8xVFPcMtKHfhL7UXfqT9mkentOGIV0GWB917 jsr88oYu3uDBTQUaXq16SOl+cOB4epN1yVw4PS+QpiXkhYSYM9TYDgtGmBl3yKeWoBtq RCcliOm5crXAIzkdp1ns0kNwZZA2slfT4eqOHz85bFq+YPsfMsx/CPSh/m2ZAqcEhDGU UnNg== X-Gm-Message-State: AAQBX9di6tQ4J+DQHeEPIKaOBo7T/C2Nbds5CHzLbECZgfsLEla0OPv9 Vs/H3AxMUxwxdQ5Ypkxb+XwkIZP+jNWxtoq/DEJ8ofNR3nonzCB7/oUlsMu72558OgspNRX9GDp LT7a23qltHmwSitxj6tprYVY+Vf+Cd2MJ1BD6N8DRjBZ3IQ13Zqb3tZXBemkKU87DZOG2 X-Received: by 2002:a05:6214:4005:b0:5ab:af50:eb45 with SMTP id kd5-20020a056214400500b005abaf50eb45mr36584870qvb.3.1680191829951; Thu, 30 Mar 2023 08:57:09 -0700 (PDT) X-Google-Smtp-Source: AKy350bUHv/u4cEzkhenXL/fVSbaDcDmAAen9r5AqRFCkY9s/kGOc+erAurPYz3AFWxQ2vyHx22eMg== X-Received: by 2002:a05:6214:4005:b0:5ab:af50:eb45 with SMTP id kd5-20020a056214400500b005abaf50eb45mr36584805qvb.3.1680191829398; Thu, 30 Mar 2023 08:57:09 -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 o10-20020a05620a0d4a00b0074281812276sm13059380qkl.97.2023.03.30.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 08:57:08 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Mike Kravetz , Andrew Morton , Andrea Arcangeli , Mike Rapoport , Axel Rasmussen , Nadav Amit , Leonardo Bras Soares Passos , David Hildenbrand Subject: [PATCH 00/29] selftests/mm: Split / Refactor userfault test Date: Thu, 30 Mar 2023 11:56:38 -0400 Message-Id: <20230330155707.3106228-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: C2C651C0021 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: dukzmnuuk4mr1tquraz95omswxx34jz5 X-HE-Tag: 1680191833-106088 X-HE-Meta: U2FsdGVkX1/O2/tVHlrp5ELWIPabD+5zoktVj20zgxnmDdYg/N9FnJdSqYUIMHRlRfqWhPFhAkHxL+g+CoDu+3jNOwWz/JyfV1PUdDT6T9JxMECk9CT3XgjGlKKTJnV+AZ1S/aB2aInB50Jw893+Jae8Edcq8ZfrwLS3aWCJQ02d0eCjaL4L/zJNt6hS77v74/Y+/My5AOc7JcigamlOWQcfn8Q+P2b2WV3yJ57ZZ34wbcyZwhJWlQ1xRUse7YhTd4qHGEMBJYW0EmuFGhuLwXCplVPRqTwlPmSN6OfwFNZoZmzWv6yezfpKxHjy+146u49QuHG00rIgIvU8+ic2bEFUxYt9cCDeKDH9Ezkh2T1NOsYB7dkGsZZ3EwOzM2Ai7+zBZdY71b2+4eXQAYMhWlaFrPpPM1eY2CIfx0XhgNoGXQHLh6nB6a4B0S9yfqJfN51kZWi5xgDS6EJDQXT4SqMuHUAF0KrUxPsFD96XF0t5QydKghMzzozlDcwRsyqL4DSRcWT99mf9697oe6KbetYmoqVQIcwr2MArP7H6tO9PEG1IQ0fGKcckGHDQcquZKu/O+g3B2JPqsJA5/4UEv5TTluSQ+Zyznsii4SWI12VIfblkwGkTFpAF5SgpwxtHqnitywsEEOnUQv1xd6Pso4Mz27TitTDZcbKpXiKbKSF+RBkbJKKoMOGSgEp7wsbHdek74RgbZ0MPgxqFqNFvev7ABHLEos9Y/2ljPwLCa+nIkO3U2T1UBRo6dhAr3ssuSUwPuQdS5kvpxTmEwOBreo2voPNhWIYHPjXcKYDvnYsE2U0S8wDLC6EH0cBLOraEC8cjh1BBSX6sNLa2yd9rLOshFqYEb8Fm1SjOqvRRPsQhBz7b1oRN9U1CX0dn2kbL0vXwaaycMnP52mfI1rzjXG2J7zmClKIJD7BFqcvS9qqbrxWfldRkJac2pp5LL0HRgHIv7Tn4xtjqGCMX2MD jj1+XYFC xLCRrH1x2yTf2ESkaDUOkX/jjvyaTpNXKQBlJpS2Yl1YUlSXA/eWSN3T/MPOjY79aTRjjD4NMAuqPY49sC0GP//Psvpt3IcKEhraa8EHwU0/8q1g+xHEJ1KRZJkE3Wa/a+wdUHuwIkNdUx/bK+omMD73QXwhYq3r0zDPWAmNyc0mt2JFB9/1f//FnauKFMgHe2rwc7dFy6mgvpjX2Lr1AYy5hzNvb/isXQNzDwGqjK0N58JH5ix8eGYxRLE9645lncSIU4OGzFgG8atM//ZVS9dRomVxvbbT6EVJinfMxGgeH6tMkwkPODMLBs7XDHDkGjGjIdm7MFkZtjnvXeqyOtyVLf2wRbphUzf9zNADOhLOlGxT2vfhGTdkCdUFYsHADssc3MYwzNFNS9nOu03I06oVDmPStNqq3RrjjPnE7cMAzbx83l2a1by3NVN4BWaCk+bcrWmreOvu5AUU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: [Sorry for the test case bomb] This patchset splits userfaultfd.c into two tests: - uffd-stress: the "vanilla", old and powerful stress test - uffd-unit-tests: all the unit tests will be moved here This is on my todo list for a long time but I never did it for real. The uffd test is growing into a small and cute monster. I start to notice it's going harder to maintain such a test and make it useful. A few issues I found when looking at userfaultfd test: - We have a bunch of unit tests in userfaultfd.c, but they always need to be run only after a stress type. No way to not do it. - We can only run an unit test for one memory type only, if we want to do a quick smoke test to check regressions, there's no good way. The best to come currently is "bash ./run_vmtests.sh -t userfaultfd" thanks to the most recent changes to run_vmtests.sh on tagging. Still, that needs to run the stress tests always and hard to see what's wrong. - It's hard to add a new unit test to userfaultfd.c, we don't really know what's happening, not until we mostly read the whole file. - We did a bunch of useless tests, e.g. we run twice the whole suite of stress test just to verify both syscall and /dev/userfaultfd. They're all using userfaultfd_new() to create the handle, everything should really be the same underneath. One simple unit test should cover that! - We have tens of global variables in one file but shared with all the tests. Some of them are not suitable to be a global var from maintainance pov. It enforces every unit test to consider how these vars affects the stress test and vice versa, but that's logically not necessary. - Userfaultfd test is not friendly to old kernels. Mostly it only works on the latest kernel tree. It's preferrable to be run on all kernels and properly report what's missing. I'll stop here, I feel like I can still list some.. This patchset should resolve all issues above, and actually we can do even more on top. I stopped doing that until I found I already got 29 patches and 2000+ LOC changes. That's already a patchset terrible enough so we should move in small steps. After the whole set applied, "./run_vmtests.sh -t userfaultfd" looks like this: ===8<=== vm.nr_hugepages = 1024 ------------------------- running ./uffd-unit-tests ------------------------- UFFDIO_API (with syscall)... done UFFDIO_API (with /dev/userfaultfd)... done zeropage on anon... done zeropage on shmem... done zeropage on shmem-private... done zeropage-hugetlb on hugetlb... done zeropage-hugetlb on hugetlb-private... done pagemap on anon... pagemap on anon... pagemap on anon... done wp-unpopulated on anon... done minor on shmem... done minor on hugetlb... done minor-wp on shmem... done minor-wp on hugetlb... done minor-collapse on shmem... done sigbus on anon... sigbus on anon... done sigbus on shmem... sigbus on shmem... done sigbus on shmem-private... sigbus on shmem-private... done sigbus on hugetlb... sigbus on hugetlb... done sigbus on hugetlb-private... sigbus on hugetlb-private... done sigbus-wp on anon... sigbus-wp on anon... done sigbus-wp on shmem... sigbus-wp on shmem... done sigbus-wp on shmem-private... sigbus-wp on shmem-private... done sigbus-wp on hugetlb... sigbus-wp on hugetlb... done sigbus-wp on hugetlb-private... sigbus-wp on hugetlb-private... done events on anon... events on anon... done events on shmem... events on shmem... done events on shmem-private... events on shmem-private... done events on hugetlb... events on hugetlb... done events on hugetlb-private... events on hugetlb-private... done events-wp on anon... events-wp on anon... done events-wp on shmem... events-wp on shmem... done events-wp on shmem-private... events-wp on shmem-private... done events-wp on hugetlb... events-wp on hugetlb... done events-wp on hugetlb-private... events-wp on hugetlb-private... done Userfaults unit tests: pass=34, skip=0, fail=0 (total=34) [PASS] -------------------------------- running ./uffd-stress anon 20 16 -------------------------------- nr_pages: 5120, nr_pages_per_cpu: 640 bounces: 15, mode: rnd racing ver poll, userfaults: 345 missing (26+48+61+102+30+12+59+7) 1596 wp (120+139+317+346+215+67+306+86) [...] [PASS] ------------------------------------ running ./uffd-stress hugetlb 128 32 ------------------------------------ nr_pages: 64, nr_pages_per_cpu: 8 bounces: 31, mode: rnd racing ver poll, userfaults: 29 missing (6+6+6+5+4+2+0+0) 104 wp (20+19+22+18+7+12+5+1) [...] [PASS] -------------------------------------------- running ./uffd-stress hugetlb-private 128 32 -------------------------------------------- nr_pages: 64, nr_pages_per_cpu: 8 bounces: 31, mode: rnd racing ver poll, userfaults: 33 missing (12+9+7+0+5+0+0+0) 111 wp (24+25+14+14+11+17+5+1) [...] [PASS] --------------------------------- running ./uffd-stress shmem 20 16 --------------------------------- nr_pages: 5120, nr_pages_per_cpu: 640 bounces: 15, mode: rnd racing ver poll, userfaults: 247 missing (15+17+34+60+81+37+3+0) 2038 wp (180+114+276+400+381+318+165+204) [...] [PASS] ----------------------------------------- running ./uffd-stress shmem-private 20 16 ----------------------------------------- nr_pages: 5120, nr_pages_per_cpu: 640 bounces: 15, mode: rnd racing ver poll, userfaults: 235 missing (52+29+55+56+13+9+16+5) 2849 wp (218+406+461+531+328+284+430+191) [...] [PASS] SUMMARY: PASS=6 SKIP=0 FAIL=0 ===8<=== The output may be different if we miss some features (e.g., hugetlb not allocated, old kernel, less privilege of uffd handle), but they should show up with good reasons. E.g., I tried to run the unit test on my Fedora kernel and it gives me: ===8<=== UFFDIO_API (with syscall)... failed [reason: UFFDIO_API should fail with wrong api but didn't] UFFDIO_API (with /dev/userfaultfd)... skipped [reason: cannot open userfaultfd handle] zeropage on anon... done zeropage on shmem... done zeropage on shmem-private... done zeropage-hugetlb on hugetlb... done zeropage-hugetlb on hugetlb-private... done pagemap on anon... pagemap on anon... pagemap on anon... done wp-unpopulated on anon... skipped [reason: feature missing] minor on shmem... done minor on hugetlb... done minor-wp on shmem... skipped [reason: feature missing] minor-wp on hugetlb... skipped [reason: feature missing] minor-collapse on shmem... done sigbus on anon... skipped [reason: possible lack of priviledge] sigbus on shmem... skipped [reason: possible lack of priviledge] sigbus on shmem-private... skipped [reason: possible lack of priviledge] sigbus on hugetlb... skipped [reason: possible lack of priviledge] sigbus on hugetlb-private... skipped [reason: possible lack of priviledge] sigbus-wp on anon... skipped [reason: possible lack of priviledge] sigbus-wp on shmem... skipped [reason: possible lack of priviledge] sigbus-wp on shmem-private... skipped [reason: possible lack of priviledge] sigbus-wp on hugetlb... skipped [reason: possible lack of priviledge] sigbus-wp on hugetlb-private... skipped [reason: possible lack of priviledge] events on anon... skipped [reason: possible lack of priviledge] events on shmem... skipped [reason: possible lack of priviledge] events on shmem-private... skipped [reason: possible lack of priviledge] events on hugetlb... skipped [reason: possible lack of priviledge] events on hugetlb-private... skipped [reason: possible lack of priviledge] events-wp on anon... skipped [reason: possible lack of priviledge] events-wp on shmem... skipped [reason: possible lack of priviledge] events-wp on shmem-private... skipped [reason: possible lack of priviledge] events-wp on hugetlb... skipped [reason: possible lack of priviledge] events-wp on hugetlb-private... skipped [reason: possible lack of priviledge] Userfaults unit tests: pass=9, skip=24, fail=1 (total=34) ===8<=== Patch layout: - Revert "userfaultfd: don't fail on unrecognized features" Something I found when I got the UFFDIO_API test below. Axel, I still propose to revert it as a whole, but feel free to continue the discussion from the original patch thread. - selftests/mm: Update .gitignore with two missing tests - selftests/mm: Dump a summary in run_vmtests.sh - selftests/mm: Merge util.h into vm_util.h - selftests/mm: Use TEST_GEN_PROGS where proper - selftests/mm: Link vm_util.c always - selftests/mm: Merge default_huge_page_size() into one - selftests/mm: Use PM_* macros in vm_utils.h - selftests/mm: Reuse pagemap_get_entry() in vm_util.h - selftests/mm: Test UFFDIO_ZEROPAGE only when !hugetlb - selftests/mm: Drop test_uffdio_zeropage_eexist Until here, all cleanups here and there. I wanted to keep going, but I found that maybe it'll take a few more days to split the test. Hence I did a split starting from the next one, so we have a working thing first. - selftests/mm: Create uffd-common.[ch] - selftests/mm: Split uffd tests into uffd-stress and uffd-unit-tests This did the major brute force split of common codes into uffd-common.[ch]. That'll be the so far common base for stress and unit tests. Then a new unit test is created. - selftests/mm: uffd_[un]register() - selftests/mm: uffd_open_{dev|sys}() - selftests/mm: UFFDIO_API test This patch hides here to start writting the 1st unit test with UFFDIO_API, also detection of userfaultfd privileges. - selftests/mm: Drop global mem_fd in uffd tests - selftests/mm: Drop global hpage_size in uffd tests - selftests/mm: Let uffd_handle_page_fault() takes wp parameter - selftests/mm: Allow allocate_area() to fail properly Some further cleanup that I noticed otherwise hard to move the tests. - selftests/mm: Add framework for uffd-unit-test The major patch provides the framework for most of the rest unit tests. - selftests/mm: Move uffd pagemap test to unit test - selftests/mm: Move uffd minor test to unit test - selftests/mm: Move uffd sig/events tests into uffd unit tests - selftests/mm: Move zeropage test into uffd unit tests Move unit tests and suite them into the new file. - selftests/mm: Workaround no way to detect uffd-minor + wp - selftests/mm: Allow uffd test to skip properly with no privilege - selftests/mm: Drop sys/dev test in uffd-stress test - selftests/mm: Add shmem-private test to uffd-stress A bunch of changes to do better on error reportings, and add shmem-private to the stress test which was long missing. Please have a look, any comment welcomed. Thanks, Peter Xu (29): Revert "userfaultfd: don't fail on unrecognized features" selftests/mm: Update .gitignore with two missing tests selftests/mm: Dump a summary in run_vmtests.sh selftests/mm: Merge util.h into vm_util.h selftests/mm: Use TEST_GEN_PROGS where proper selftests/mm: Link vm_util.c always selftests/mm: Merge default_huge_page_size() into one selftests/mm: Use PM_* macros in vm_utils.h selftests/mm: Reuse pagemap_get_entry() in vm_util.h selftests/mm: Test UFFDIO_ZEROPAGE only when !hugetlb selftests/mm: Drop test_uffdio_zeropage_eexist selftests/mm: Create uffd-common.[ch] selftests/mm: Split uffd tests into uffd-stress and uffd-unit-tests selftests/mm: uffd_[un]register() selftests/mm: uffd_open_{dev|sys}() selftests/mm: UFFDIO_API test selftests/mm: Drop global mem_fd in uffd tests selftests/mm: Drop global hpage_size in uffd tests selftests/mm: Let uffd_handle_page_fault() takes wp parameter selftests/mm: Allow allocate_area() to fail properly selftests/mm: Add framework for uffd-unit-test selftests/mm: Move uffd pagemap test to unit test selftests/mm: Move uffd minor test to unit test selftests/mm: Move uffd sig/events tests into uffd unit tests selftests/mm: Move zeropage test into uffd unit tests selftests/mm: Workaround no way to detect uffd-minor + wp selftests/mm: Allow uffd test to skip properly with no privilege selftests/mm: Drop sys/dev test in uffd-stress test selftests/mm: Add shmem-private test to uffd-stress fs/userfaultfd.c | 6 +- tools/testing/selftests/mm/.gitignore | 5 +- tools/testing/selftests/mm/Makefile | 77 +- tools/testing/selftests/mm/gup_test.c | 5 +- tools/testing/selftests/mm/hugepage-mremap.c | 7 +- tools/testing/selftests/mm/hugetlb-madvise.c | 25 +- .../selftests/mm/ksm_functional_tests.c | 6 +- tools/testing/selftests/mm/ksm_tests.c | 2 +- tools/testing/selftests/mm/mrelease_test.c | 11 +- tools/testing/selftests/mm/run_vmtests.sh | 26 +- tools/testing/selftests/mm/thuge-gen.c | 19 +- tools/testing/selftests/mm/transhuge-stress.c | 12 +- tools/testing/selftests/mm/uffd-common.c | 612 ++++++ tools/testing/selftests/mm/uffd-common.h | 117 + tools/testing/selftests/mm/uffd-stress.c | 482 +++++ tools/testing/selftests/mm/uffd-unit-tests.c | 891 ++++++++ tools/testing/selftests/mm/userfaultfd.c | 1903 ----------------- tools/testing/selftests/mm/util.h | 69 - tools/testing/selftests/mm/vm_util.c | 166 +- tools/testing/selftests/mm/vm_util.h | 48 + 20 files changed, 2385 insertions(+), 2104 deletions(-) create mode 100644 tools/testing/selftests/mm/uffd-common.c create mode 100644 tools/testing/selftests/mm/uffd-common.h create mode 100644 tools/testing/selftests/mm/uffd-stress.c create mode 100644 tools/testing/selftests/mm/uffd-unit-tests.c delete mode 100644 tools/testing/selftests/mm/userfaultfd.c delete mode 100644 tools/testing/selftests/mm/util.h