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; }