From patchwork Fri Oct 14 14:39:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13007064 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 C080EC4332F for ; Fri, 14 Oct 2022 14:39:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20A3F6B0075; Fri, 14 Oct 2022 10:39:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 145CB8E0001; Fri, 14 Oct 2022 10:39:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3C776B007B; Fri, 14 Oct 2022 10:39:27 -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 CE3086B0075 for ; Fri, 14 Oct 2022 10:39:27 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F0D87C0B5A for ; Fri, 14 Oct 2022 14:39:26 +0000 (UTC) X-FDA: 80019813132.25.F9A5ABA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 9B05B18001E for ; Fri, 14 Oct 2022 14:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665758366; 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=CEy7pKIEsfMMFzj4vyOzQVpkWI0TxrmvN3NLo9J44z8=; b=iepYJhttJwhqIGc6BDa2CKrYQKQSHTWGZcrN9v8IMO6Ngab5cIWXky27aNI4NmuNNYOSci bSf0nvG2q5zt0ych081OKFa68KQDieNsDiLXthPTHCB/NucxMfOIHcV3Sl6Zq5Ytq5HSPf 9cUoITp/c97tRaOiwJktQ35/6tRlOYs= 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_128_GCM_SHA256) id us-mta-101-VTRN07k4NZ2WbSvESY5wqA-1; Fri, 14 Oct 2022 10:39:24 -0400 X-MC-Unique: VTRN07k4NZ2WbSvESY5wqA-1 Received: by mail-qk1-f200.google.com with SMTP id t1-20020a05620a450100b006ee79ceeb6fso3572861qkp.11 for ; Fri, 14 Oct 2022 07:39:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=CEy7pKIEsfMMFzj4vyOzQVpkWI0TxrmvN3NLo9J44z8=; b=swxFV9kxbY5opSz0H4XYD4NEtgk/ZiBowlxC69Mj/djU75cqXuLXuU38xFniDGhg3Y 7mTq5p94UYf2cYqiZecrnrysb74U4hQV/npvmL1+XQIJnOXMKo1j4er54YZCIV+kr8os 1K23GIzyvtXyUOzk5EWm4RsfoyPjKnkLY+sMOZJ7LrlVi6K8Qp2eWoWHXTmEAdSF0qun KV+zZTHNe7b5iJyFyDby31OnoqCO1tPxxKmAdr/wUNwaCLBTBe8krhXFLp8wl+vddnFf 2kBdzF/Y9ksN6HhRoywbSvS0SFBOKHK+eWyV2QOUb3l7x0ciLTP+jeXKj3gtx3PnTS8Q S1gw== X-Gm-Message-State: ACrzQf0o+J0Bs/786HPBpqId8gTv1cb3GhizdgqPcEb12q6pq6rfRbIr Qy5kZYVxrd3eKvI/ySPaowokPyjd8fNDv5/FR4evjYGFZD8p3eykgOV6LbvCo1IKCv4amKGBDnn eSJeSYZuyOe0= X-Received: by 2002:a05:6214:500f:b0:4b1:d2b1:54c with SMTP id jo15-20020a056214500f00b004b1d2b1054cmr4236930qvb.54.1665758364325; Fri, 14 Oct 2022 07:39:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hcHtcB11MKZ36Ka9jJq2b9wUzusa/zVJ0ne6bkmpItRnjhCW0Ngl0EeWdKQA1NKrIZ/bLuw== X-Received: by 2002:a05:6214:500f:b0:4b1:d2b1:54c with SMTP id jo15-20020a056214500f00b004b1d2b1054cmr4236905qvb.54.1665758364028; Fri, 14 Oct 2022 07:39:24 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id q4-20020a05620a2a4400b006ec09d7d357sm2675541qkp.47.2022.10.14.07.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 07:39:23 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Axel Rasmussen , Andrew Morton , peterx@redhat.com, Mike Kravetz Subject: [PATCH v2 1/4] selftests/vm: Use memfd for uffd hugetlb tests Date: Fri, 14 Oct 2022 10:39:18 -0400 Message-Id: <20221014143921.93887-2-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014143921.93887-1-peterx@redhat.com> References: <20221014143921.93887-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665758366; a=rsa-sha256; cv=none; b=xFHo+GWMXMrRcQ0cOM9jS2Wsuoh1JJH8BFDPcqvEizeCoPcuMbUNx+jXt72AzUulLWCu2x ThogLVOg00wL2gQD9NMQZ6HWpzQ3Ej+W8HLKMH11xL6HQtkZHTYCpMquX+vhwuqmf/znvj 2P0kqRpHldkIgGWE3Qpjw+cHuSw6ukY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iepYJhtt; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665758366; 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=CEy7pKIEsfMMFzj4vyOzQVpkWI0TxrmvN3NLo9J44z8=; b=FIJOAuOO9UoYEIyKndBDeF1ORrODDGEyemojDyMD0GN0j/ly1GfxnyJpKoF8XFNNfZcYZx Cl+m0W025gHjy5JS88nKhZSYO9sBV+aZ37YL8mM0DBPOu4ndQBf3GNBjSgV+FaFNucTOAe ZB7jiYjAtdoOgTBpDjtIlw6/NozI6nM= X-Rspam-User: X-Stat-Signature: dx7hru7baunaipnwc5s6hg1zbkqxfkyn X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9B05B18001E Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iepYJhtt; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1665758366-435164 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: We already used memfd for shmem test, move it forward with hugetlb too so that we don't need user to specify the hugetlb file path explicitly when running hugetlb shared tests. Reviewed-by: Axel Rasmussen Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 62 ++++++++---------------- 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 74babdbc02e5..58f70d81e630 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -93,10 +93,8 @@ static volatile bool test_uffdio_zeropage_eexist = true; static bool test_uffdio_wp = true; /* Whether to test uffd minor faults */ static bool test_uffdio_minor = false; - static bool map_shared; -static int shm_fd; -static int huge_fd; +static int mem_fd; static unsigned long long *count_verify; static int uffd = -1; static int uffd_flags, finished, *pipefd; @@ -143,7 +141,7 @@ const char *examples = "# 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 /dev/hugepages/hugefile\n\n" + "./userfaultfd hugetlb_shared 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"; @@ -260,35 +258,21 @@ static void hugetlb_release_pages(char *rel_area) static void hugetlb_allocate_area(void **alloc_area, bool is_src) { + off_t size = nr_pages * page_size; + off_t offset = is_src ? 0 : size; void *area_alias = NULL; char **alloc_area_alias; - if (!map_shared) - *alloc_area = mmap(NULL, - nr_pages * page_size, - PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | - (is_src ? 0 : MAP_NORESERVE), - -1, - 0); - else - *alloc_area = mmap(NULL, - nr_pages * page_size, - PROT_READ | PROT_WRITE, - MAP_SHARED | - (is_src ? 0 : MAP_NORESERVE), - huge_fd, - is_src ? 0 : nr_pages * page_size); + *alloc_area = mmap(NULL, size, PROT_READ | PROT_WRITE, + (map_shared ? MAP_SHARED : MAP_PRIVATE) | + (is_src ? 0 : MAP_NORESERVE), + mem_fd, offset); if (*alloc_area == MAP_FAILED) err("mmap of hugetlbfs file failed"); if (map_shared) { - area_alias = mmap(NULL, - nr_pages * page_size, - PROT_READ | PROT_WRITE, - MAP_SHARED, - huge_fd, - is_src ? 0 : nr_pages * page_size); + area_alias = mmap(NULL, size, PROT_READ | PROT_WRITE, + MAP_SHARED, mem_fd, offset); if (area_alias == MAP_FAILED) err("mmap of hugetlb file alias failed"); } @@ -334,14 +318,14 @@ static void shmem_allocate_area(void **alloc_area, bool is_src) } *alloc_area = mmap(p, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, - shm_fd, offset); + mem_fd, offset); if (*alloc_area == MAP_FAILED) err("mmap of memfd failed"); if (test_collapse && *alloc_area != p) err("mmap of memfd failed at %p", p); area_alias = mmap(p_alias, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, - shm_fd, offset); + mem_fd, offset); if (area_alias == MAP_FAILED) err("mmap of memfd alias failed"); if (test_collapse && area_alias != p_alias) @@ -1821,21 +1805,17 @@ int main(int argc, char **argv) } nr_pages = nr_pages_per_cpu * nr_cpus; - if (test_type == TEST_HUGETLB && map_shared) { - if (argc < 5) - usage(); - huge_fd = open(argv[4], O_CREAT | O_RDWR, 0755); - if (huge_fd < 0) - err("Open of %s failed", argv[4]); - if (ftruncate(huge_fd, 0)) - err("ftruncate %s to size 0 failed", argv[4]); - } else if (test_type == TEST_SHMEM) { - shm_fd = memfd_create(argv[0], 0); - if (shm_fd < 0) + if (test_type == TEST_SHMEM || test_type == TEST_HUGETLB) { + unsigned int memfd_flags = 0; + + if (test_type == TEST_HUGETLB) + memfd_flags = MFD_HUGETLB; + mem_fd = memfd_create(argv[0], memfd_flags); + if (mem_fd < 0) err("memfd_create"); - if (ftruncate(shm_fd, nr_pages * page_size * 2)) + if (ftruncate(mem_fd, nr_pages * page_size * 2)) err("ftruncate"); - if (fallocate(shm_fd, + if (fallocate(mem_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, nr_pages * page_size * 2)) err("fallocate"); From patchwork Fri Oct 14 14:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13007065 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 43B64C43217 for ; Fri, 14 Oct 2022 14:39:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6B928E0002; Fri, 14 Oct 2022 10:39:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCC708E0001; Fri, 14 Oct 2022 10:39:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A95D8E0002; Fri, 14 Oct 2022 10:39:28 -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 89E2F8E0001 for ; Fri, 14 Oct 2022 10:39:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5B3B1A0B5E for ; Fri, 14 Oct 2022 14:39:28 +0000 (UTC) X-FDA: 80019813216.06.CBA91D2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id EA39840028 for ; Fri, 14 Oct 2022 14:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665758367; 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=zhrtCe5O8iJscoLdf85Accar6WxcllS+eYr7bBy1HkM=; b=gtdPCQsofa7kHijNmmurBxhr/APJhIXVcNkZGAICAgJzsqN8S/KYZw8zO/ZVAZh19ZVc0H NeMb4fZxaw3zIiKsAZkrtL62b+FEnrh+/YSzx77cKfwLqSZoywohaqXv6peouxWspVaxEs qJ6aF9gJul5lj9NBGKPAXkANnUTjDNE= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-411-t2qPwqbGOMic5mvCokc9bA-1; Fri, 14 Oct 2022 10:39:26 -0400 X-MC-Unique: t2qPwqbGOMic5mvCokc9bA-1 Received: by mail-qk1-f199.google.com with SMTP id x16-20020a05620a449000b006eecf2d621eso1305976qkp.16 for ; Fri, 14 Oct 2022 07:39:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=zhrtCe5O8iJscoLdf85Accar6WxcllS+eYr7bBy1HkM=; b=YoRdVl/CwH+KaJ6ckDtFtV7NgJkeG92wUZFx2EXuHCMo7sCS3w1/lcoKfRbOZ2C1nC 7qZ8Kb4RpA5px5LX2aTF+o6rczuS8BSWf6PfJ1MUCJyCqRIGMoGOEra/FrpelO1vhPLI pTyaUJHrNQxRoMhki/CHjGVic2xHZS1KLHxTlWIauQ5Xctybx7wA0cDJIg4PPN7z5hSR j0WmkALRVpjF/GEo3zMEOFVvIIgo6DpwAa8FKs+tm+/EOX62er7iUvO1YQN9/CztEmtm Ht9wcCQmL1nmhQw29hn6TcXaDPWxnu/ja5f2xQF/7IKu/fimR64B/oDrk5OQGAjKE0IO D4jA== X-Gm-Message-State: ACrzQf0QHz+wGuU62KKGGnq1E1v6BNOOL74uibpAMybZHLzR00B6k+Lb 5V8oouk5uW7vrUxr5isQjgGSFoEfkMFhkCtjqUI9GThJm1Y4Sku5dqvPffcIqABgQnKsWpxttFA hn2Un+8j76xw= X-Received: by 2002:a05:620a:4487:b0:6ee:bcfd:bd38 with SMTP id x7-20020a05620a448700b006eebcfdbd38mr3958882qkp.468.1665758365540; Fri, 14 Oct 2022 07:39:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Sm2N0MTTyvS+djMYYsPheIDh6qYStLP75xZfMOIeKo1yJ56X446Gqke44gOKPwhPm9ANfZA== X-Received: by 2002:a05:620a:4487:b0:6ee:bcfd:bd38 with SMTP id x7-20020a05620a448700b006eebcfdbd38mr3958866qkp.468.1665758365343; Fri, 14 Oct 2022 07:39:25 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id q4-20020a05620a2a4400b006ec09d7d357sm2675541qkp.47.2022.10.14.07.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 07:39:24 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Axel Rasmussen , Andrew Morton , peterx@redhat.com, Mike Kravetz Subject: [PATCH v2 2/4] selftests/vm: Use memfd for hugetlb-madvise test Date: Fri, 14 Oct 2022 10:39:19 -0400 Message-Id: <20221014143921.93887-3-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014143921.93887-1-peterx@redhat.com> References: <20221014143921.93887-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665758368; a=rsa-sha256; cv=none; b=vVxShUNGhN+zWfznIL6XfRTsthYikCb0NjJwY/AmQOU71vX0QHvmFeJb1MRbCzszhEPiOo a5jTZXgGDg+soPCQBFThXc9Ezt//9nv36Y3AJCQit0hFpvfGBpzhr0tXKufyMQ2ls8gyJ9 C9fWMm36qw0gsakACp1JsVMY44w4DcM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gtdPCQso; spf=pass (imf12.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665758368; 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=zhrtCe5O8iJscoLdf85Accar6WxcllS+eYr7bBy1HkM=; b=gM1VD7BKZVBonjHEApcHVC08iQFK2L9PUXvkDXVnx5ECoRuyYyr2NKd//HCXQW7wZEsaVX RyxyP7Q8otSOPb/JkkLFHSaxZKkxjGqEFqla586rPaEZrNZ21X16h8Zos25Vn3pK1AMfQa ulaN1XpywdlLhxl57hUQDn/Pz9IA4Pc= X-Stat-Signature: gr8qn3bxpzzsrbw7ypa9czof84zsxugr X-Rspamd-Queue-Id: EA39840028 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gtdPCQso; spf=pass (imf12.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-HE-Tag: 1665758367-835539 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: For dropping the hugetlb mountpoint in run_vmtests.sh. Since no parameter is needed, drop USAGE too. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/hugetlb-madvise.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/vm/hugetlb-madvise.c b/tools/testing/selftests/vm/hugetlb-madvise.c index 3c9943131881..f96435b70986 100644 --- a/tools/testing/selftests/vm/hugetlb-madvise.c +++ b/tools/testing/selftests/vm/hugetlb-madvise.c @@ -12,6 +12,7 @@ * directory. */ +#define _GNU_SOURCE #include #include #include @@ -19,7 +20,6 @@ #define __USE_GNU #include -#define USAGE "USAGE: %s \n" #define MIN_FREE_PAGES 20 #define NR_HUGE_PAGES 10 /* common number of pages to map/allocate */ @@ -103,11 +103,6 @@ int main(int argc, char **argv) int fd; int ret; - if (argc != 2) { - printf(USAGE, argv[0]); - exit(1); - } - huge_page_size = default_huge_page_size(); if (!huge_page_size) { printf("Unable to determine huge page size, exiting!\n"); @@ -125,9 +120,9 @@ int main(int argc, char **argv) exit(1); } - fd = open(argv[1], O_CREAT | O_RDWR, 0755); + fd = memfd_create(argv[0], MFD_HUGETLB); if (fd < 0) { - perror("Open failed"); + perror("memfd_create() failed"); exit(1); } @@ -406,6 +401,5 @@ int main(int argc, char **argv) (void)munmap(addr2, NR_HUGE_PAGES * huge_page_size); close(fd); - unlink(argv[1]); return 0; } From patchwork Fri Oct 14 14:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13007066 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 BB991C43217 for ; Fri, 14 Oct 2022 14:40:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58B6B6B0072; Fri, 14 Oct 2022 10:40:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53BD26B0075; Fri, 14 Oct 2022 10:40:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DC646B0078; Fri, 14 Oct 2022 10:40:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2A78C6B0072 for ; Fri, 14 Oct 2022 10:40:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B7971140C70 for ; Fri, 14 Oct 2022 14:40:17 +0000 (UTC) X-FDA: 80019815274.29.3DE3AC7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 4DE03A002F for ; Fri, 14 Oct 2022 14:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665758416; 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=iDP4uYCeHzqEOaCGXbcAwOcK1rZC2BBuQ6aTX5fgU3w=; b=IB6nXiuXAT3Z9Mxin+vwGF9H4f+uvf+W2OfmkPheVPfK9Ql3Ef1xFfSb4BFA7geg1Fhnzx aT1VmJwMBRzFUvIRmyt3FLncWNHNrFwxFgsco4ihoZ6cYbZju5SH8MhEknd0yDnbH1pPlE FEXFYUM10B/9JFnILmI1Hdsr1cY0cEQ= 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_128_GCM_SHA256) id us-mta-335-kEQ3flHuP0KxxABW8ACwzQ-1; Fri, 14 Oct 2022 10:40:15 -0400 X-MC-Unique: kEQ3flHuP0KxxABW8ACwzQ-1 Received: by mail-qv1-f72.google.com with SMTP id g12-20020a0cfdcc000000b004ad431ceee0so3560662qvs.7 for ; Fri, 14 Oct 2022 07:40:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=iDP4uYCeHzqEOaCGXbcAwOcK1rZC2BBuQ6aTX5fgU3w=; b=bR6yknAB1SV6qgV2txwe1O4ycPoxeEVJfTPewHfi5zzzIsd5v3pH+1cxvSAjvSAzss KG4t7hXO3MQktB1T6Yz1Ed+SMlVGywH573lQoCEsrVVmfuRlfNXlTee8jc/srvaodKSu xG3Il5vGbmlteFR4EyLz0rdBGdzNvLq6cEIv+3yvj42XF1t5+Un2XwkJOa1Ha7M1tiB4 XiwLG0HFhFYuckTce45inkIIdZJHBTfxVIYhqHcxXRqLePFrfj14SnkeGQgW8WSrvMp4 xAqIPiSD9mx7R26xgHIpcs/iXafSN/e4rMb5ZW/zsiY4cNJoRi5av9KZjtKCMg5SA1g/ gn3Q== X-Gm-Message-State: ACrzQf2QA/mmc0eRAhZGc3q5V+B6Ye6LXwv9gv7/1+4Z8bzV4Qkq6S5Z 9iRw3JynHNFSrZIrh1hb2s9EOVQ8HEw8VGIIsDe37hcgJOcihbMBHvW1Cv1K7U/0lIIgRcQwfOt 4qANJv8o90uE= X-Received: by 2002:a37:c85:0:b0:6ed:4a79:fc66 with SMTP id 127-20020a370c85000000b006ed4a79fc66mr4006748qkm.433.1665758415334; Fri, 14 Oct 2022 07:40:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IfO7EVM9SoCYkoTimioBOx4Rp2krEuu3nGfkA84AP3QQ2Bab1uDw6m7lhGlL2PHeYZ7hQHQ== X-Received: by 2002:a37:c85:0:b0:6ed:4a79:fc66 with SMTP id 127-20020a370c85000000b006ed4a79fc66mr4006731qkm.433.1665758415046; Fri, 14 Oct 2022 07:40:15 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id d75-20020ae9ef4e000000b006ed61f18651sm2503120qkg.16.2022.10.14.07.40.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 07:40:14 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Axel Rasmussen , Andrew Morton , Mike Kravetz Subject: [PATCH v2 3/4] selftests/vm: Use memfd for hugepage-mremap test Date: Fri, 14 Oct 2022 10:40:13 -0400 Message-Id: <20221014144013.94027-1-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014143921.93887-1-peterx@redhat.com> References: <20221014143921.93887-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665758417; 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=iDP4uYCeHzqEOaCGXbcAwOcK1rZC2BBuQ6aTX5fgU3w=; b=QfilxfVK2YHPWaa0KOU5gINv7VnZqws5WfLOapUqmaEo8Hgpaj8Xgv6Nnf4TOLrYAHDg/4 bvW5h8gNB8LSd+XQSQ2/RPYLC/roH/lE31Fxd2mO5Zc18Aa2fErIoSl7Ujfi1sO04o4L1Z sPae+xEsF4kBgF9sWkgd3UniBv8UB78= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IB6nXiuX; spf=pass (imf15.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665758417; a=rsa-sha256; cv=none; b=PLeiY8c85/YDoUqN+c/Qj5eIojm2dJZCYs5USFOjy5maM4GY0tMmiQk1bT9KoxeEI/YFYK TGrC0/xN3y3MxV1a2s2zQT9LauZhCSHKYsQLKSxNtG3drb/Hpx5PWzqUWszET9Dn6VjEtj /0Bo+u614z8QxlDngk/3gI5/UK3rCoI= X-Stat-Signature: byy9mqnm1oyxmrj4pod88qdp988i59t6 X-Rspamd-Queue-Id: 4DE03A002F Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IB6nXiuX; spf=pass (imf15.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1665758417-433268 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: For dropping the hugetlb mountpoint in run_vmtests.sh. Cleaned it up a little bit around the changed codes. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/hugepage-mremap.c | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/vm/hugepage-mremap.c b/tools/testing/selftests/vm/hugepage-mremap.c index e63a0214f639..e53b5eaa8fce 100644 --- a/tools/testing/selftests/vm/hugepage-mremap.c +++ b/tools/testing/selftests/vm/hugepage-mremap.c @@ -22,6 +22,7 @@ #include /* Definition of SYS_* constants */ #include #include +#include #define DEFAULT_LENGTH_MB 10UL #define MB_TO_BYTES(x) (x * 1024 * 1024) @@ -108,26 +109,23 @@ static void register_region_with_uffd(char *addr, size_t len) int main(int argc, char *argv[]) { size_t length = 0; + int ret = 0, fd; - if (argc != 2 && argc != 3) { - printf("Usage: %s [length_in_MB] \n", argv[0]); + if (argc >= 2 && !strcmp(argv[1], "-h")) { + printf("Usage: %s [length_in_MB]\n", argv[0]); exit(1); } /* Read memory length as the first arg if valid, otherwise fallback to * the default length. */ - if (argc == 3) - length = argc > 2 ? (size_t)atoi(argv[1]) : 0UL; + if (argc >= 2) + length = (size_t)atoi(argv[1]); + else + length = DEFAULT_LENGTH_MB; - length = length > 0 ? length : DEFAULT_LENGTH_MB; length = MB_TO_BYTES(length); - - int ret = 0; - - /* last arg is the hugetlb file name */ - int fd = open(argv[argc-1], O_CREAT | O_RDWR, 0755); - + fd = memfd_create(argv[0], MFD_HUGETLB); if (fd < 0) { perror("Open failed"); exit(1); @@ -185,7 +183,6 @@ int main(int argc, char *argv[]) } close(fd); - unlink(argv[argc-1]); return ret; } From patchwork Fri Oct 14 14:40:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13007067 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 378E5C43219 for ; Fri, 14 Oct 2022 14:40:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB80E6B0075; Fri, 14 Oct 2022 10:40:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C41CD8E0001; Fri, 14 Oct 2022 10:40:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B07EC6B007B; Fri, 14 Oct 2022 10:40:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A003C6B0075 for ; Fri, 14 Oct 2022 10:40:19 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7F778C0B5A for ; Fri, 14 Oct 2022 14:40:19 +0000 (UTC) X-FDA: 80019815358.11.638DC46 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 2AE7FC001F for ; Fri, 14 Oct 2022 14:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665758418; 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=SLJyHDSa1XQjsFtgHwRksRspzx5xxcL5BS8fvTY+AU0=; b=UsT97ZClr4/SeZvJKlLKREonCleLLyQP4u9p5A5jYtk6zBDjoEbdfyTUmun2c2+3snCZ30 XttAhYrPfjo6VbJvXJFilPWTiLK31cqD0hRWucFRyXXpI0Sljq5mbJ0QcHtRPu9cUjU4H5 cPnoxBadxv7g9P1RV4Ixiyz98R6JUEo= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-518-1QeAd8oONq6XYQv7ZJPTjg-1; Fri, 14 Oct 2022 10:40:17 -0400 X-MC-Unique: 1QeAd8oONq6XYQv7ZJPTjg-1 Received: by mail-qt1-f198.google.com with SMTP id bq21-20020a05622a1c1500b0039cdae506e6so872721qtb.10 for ; Fri, 14 Oct 2022 07:40:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=SLJyHDSa1XQjsFtgHwRksRspzx5xxcL5BS8fvTY+AU0=; b=qzJATVneMiEcMnsfzKNj4J911ZfifMWv8skfmgtp81HhK4f12RY9js/I6Ap7TWPxwz jiCxoFGcr81B7XYKc1q2D9WjXfIK8nc6I1KJux0MIcpESNnXsefNI7GbTZ7go5e4xtyA KWzxUKTSAdvLanhU/6APkmKUXuCdPnW6Mkdvp/k1o+rMc1BqXzsZBKTyf+eQJlK+ShKs 4fuiMF+aHDWRLnFwl0gUa9wpwuTv0Gq0UlbF7/Otc2zykW4gw3ai6+Oohn9zVKct4fxZ 90TIddqz0gZiTsHegkCCMFnr7ZbvLsDiSwe9xd5XwFNJq9Hbf1+q5shWJBnSaK1TAWn2 CpNw== X-Gm-Message-State: ACrzQf32MP4zcmTERgwEJHiAzrYCcZfbFJnZ2n0T4wEozS6LfDVkwgbZ 1IHV8W5KUDBC2MNIBgIRGd4usuVlJyg5o9Swn5ClkXJHBu/jDUXM7URG8hOo3+aim46wgZmLYMB BjL2onkYOFTo= X-Received: by 2002:a0c:a98e:0:b0:4ac:929d:216f with SMTP id a14-20020a0ca98e000000b004ac929d216fmr4569044qvb.16.1665758417111; Fri, 14 Oct 2022 07:40:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4t7KsjP3Hg9ck1XOwaKdT6cqdt/Zic+OGydxXGKoiUwwJ5ZsQBmo1MvrILCejlsR+qV7KlAg== X-Received: by 2002:a0c:a98e:0:b0:4ac:929d:216f with SMTP id a14-20020a0ca98e000000b004ac929d216fmr4569025qvb.16.1665758416855; Fri, 14 Oct 2022 07:40:16 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id u6-20020a05620a0c4600b006cec8001bf4sm2414202qki.26.2022.10.14.07.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 07:40:16 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Axel Rasmussen , Andrew Morton , Mike Kravetz Subject: [PATCH v2 4/4] selftests/vm: Drop mnt point for hugetlb in run_vmtests.sh Date: Fri, 14 Oct 2022 10:40:15 -0400 Message-Id: <20221014144015.94039-1-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014143921.93887-1-peterx@redhat.com> References: <20221014143921.93887-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665758419; a=rsa-sha256; cv=none; b=lxRUXiI0PZZuSK1AqpPu2CCZmhnM09Qu4HAKroq07kwrOJaLF9EgFhk72sjyRiRNx493Qf 9u9CVTdU5KM2D759j1cZMukXPsOJAaWk9gHwRTAZ+I5ImbddsNjNr/QxEVByse70gOt6XN 5WSjdhetOyfK4ErYz9sbsQiEv4/kNTA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UsT97ZCl; spf=pass (imf10.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665758419; 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=SLJyHDSa1XQjsFtgHwRksRspzx5xxcL5BS8fvTY+AU0=; b=rO+0Gw6kb0L/LkX/KXftgfFFQTY7mktqmtkibmVClSdfn9nOQ2uQGqwAaycA0D+xPObVn4 Q/eh3S+/vmuoUg9Xcb478cxFclqFMcspfeLtdghGbgu7rF4J2evKiA7a93wlwfprreqDg/ FWQ6XQdLOhESCFt/LUu86rr5S/w4kUU= X-Stat-Signature: yrna949bk1gwyqde5kptuj5ykfnpaaua X-Rspamd-Queue-Id: 2AE7FC001F X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UsT97ZCl; spf=pass (imf10.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-HE-Tag: 1665758418-691221 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: After converting all the three relevant testcases (uffd, madvise, mremap) to use memfd, no test will need the hugetlb mount point anymore. Drop the code. Reviewed-by: Axel Rasmussen Signed-off-by: Peter Xu --- tools/testing/selftests/vm/run_vmtests.sh | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh index e780e76c26b8..0dc9f545a32d 100755 --- a/tools/testing/selftests/vm/run_vmtests.sh +++ b/tools/testing/selftests/vm/run_vmtests.sh @@ -5,7 +5,6 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 -mnt=./huge exitcode=0 #get huge pagesize and freepages from /proc/meminfo @@ -84,9 +83,6 @@ run_test() { fi } -mkdir "$mnt" -mount -t hugetlbfs none "$mnt" - run_test ./hugepage-mmap shmmax=$(cat /proc/sys/kernel/shmmax) @@ -98,14 +94,9 @@ echo "$shmmax" > /proc/sys/kernel/shmmax echo "$shmall" > /proc/sys/kernel/shmall run_test ./map_hugetlb - -run_test ./hugepage-mremap "$mnt"/huge_mremap -rm -f "$mnt"/huge_mremap - +run_test ./hugepage-mremap run_test ./hugepage-vmemmap - -run_test ./hugetlb-madvise "$mnt"/madvise-test -rm -f "$mnt"/madvise-test +run_test ./hugetlb-madvise echo "NOTE: The above hugetlb tests provide minimal coverage. Use" echo " https://github.com/libhugetlbfs/libhugetlbfs.git for" @@ -126,14 +117,11 @@ for mod in "${uffd_mods[@]}"; do # Hugetlb tests require source and destination huge pages. Pass in half # the size ($half_ufd_size_MB), which is used for *each*. run_test ./userfaultfd hugetlb${mod} "$half_ufd_size_MB" 32 - run_test ./userfaultfd hugetlb_shared${mod} "$half_ufd_size_MB" 32 "$mnt"/uffd-test - rm -f "$mnt"/uffd-test + run_test ./userfaultfd hugetlb_shared${mod} "$half_ufd_size_MB" 32 run_test ./userfaultfd shmem${mod} 20 16 done #cleanup -umount "$mnt" -rm -rf "$mnt" echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages run_test ./compaction_test