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: 2720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp218368wrs; Fri, 14 Oct 2022 07:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TlxsHwLdxyz+TKel7e1rNzHcQyYw5yFU6T1f7yDB82lLGc2O2dwT4/Zeuy1np1Ao2u88j X-Received: by 2002:a05:6402:d0b:b0:458:a244:4e99 with SMTP id eb11-20020a0564020d0b00b00458a2444e99mr4569968edb.46.1665758475108; Fri, 14 Oct 2022 07:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665758475; cv=none; d=google.com; s=arc-20160816; b=b6ecyaqlHfh56qpg+taiSFc9DHxtLiOF4cOkfpcIIAilcSQKMNiCAnKGLEhsAq/1L+ D7I/lGb/CBbbq0HyAdTsSrdOiRoKrTOskwvHgDm+rzH3JNlhUFEr6EoSH2OtBMSCSYqb GlqMP/ytust14FWqpkMjMIMxIjL4vWuSNGk0o9xePGc3c1atxUcmKUdiO5NmjGWhqU04 Z6/kT8l+G/Ex3yOs5ZZ/1A3wMkPmY0ikqPjx1/e/DPyp2/BlwVrH2ZfkXZ8rG0uTtCqp fam6zBo3IZipfWVZVt/nbin5odltRzMH1VkzxRg2buKUMNoLVTp0lU/LPGl4uB+LndTS RG8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zhrtCe5O8iJscoLdf85Accar6WxcllS+eYr7bBy1HkM=; b=v0C+jveQqppMpLOenob80hmKS2xpz7lQ9WIZDWXHYVRxMRDTDOIXlhl8D3vOl0YXem yxQ1p7ekzXMlfHDPS6TGjQG8U6PWb/KMexshFm4R/cB9SfZ4BtFJLeXrcq4NDgw8ZEdP SQl9o6ak8+JXDlWupQ52a5n2tG9B+dvGvwMvU2iOit0obdEopNCtT0oWY4ksEIhcjPL4 BmBE8FLUwbyY8KLIKsYj1klDzEpC3VJcCcR4b226Aex1/YDFGEk2gcweNtQEQ4F9g1AZ JoQwttoZvTgkLQBQhNd+KUFee6EyHrzXordRRt1aUb7faPlksVfS67Ui1Heso/cuDNf/ h1dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gtdPCQso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc1-20020a1709071c0100b007820f6b65c6si2774431ejc.469.2022.10.14.07.40.49; Fri, 14 Oct 2022 07:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gtdPCQso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbiJNOjh (ORCPT + 99 others); Fri, 14 Oct 2022 10:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiJNOj3 (ORCPT ); Fri, 14 Oct 2022 10:39:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A61B1D4DE7 for ; Fri, 14 Oct 2022 07:39:28 -0700 (PDT) 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-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-339-p1WeIEz_M_CFSrXw6Tm80g-1; Fri, 14 Oct 2022 10:39:26 -0400 X-MC-Unique: p1WeIEz_M_CFSrXw6Tm80g-1 Received: by mail-qk1-f197.google.com with SMTP id az32-20020a05620a172000b006ee8ae138a7so3594407qkb.4 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=g4VKWBHrZvqNyr2VGAzGCLM7kL+U6/eLN8CQ9BXeT67l2RRgg1SUE+HY9GffFf8Iue DHwowud44HkwRdlsBbtQsw0SE7HBYUMObE+uTA1sKMTp4jDlclYNplZqWDpoZ4IrO2kB H0VmPOltvQJp2AntD9mFzG5+EgFwgJ7GZOudhCh4V9C1/KrKxDB5lHZcuTu80JEeXPIg M5Xs8TQVzl2hrFpDgSDwx+hHwKAguHnwIHkOLlye8qt0HkeJlVxD4uOo6m44Xb4g993n 295+kUeDBgDj5h0Q+kvMcgrBsjZQlaI6S8CfzVuaoAqYDDTGN2E2a8+DZH7/rA2KuCGB mD1g== X-Gm-Message-State: ACrzQf1zz+88uePPogAIUi7yBcAl98fyRRrgGM/hLsFSMvJ5yP7CqHoS SetPN0lATx49BRB9NIIKJoUkelC0iJ9XdDngouXyxKL2xOMCcpskEJitaoL7v/7MMMgXZ8xIX+J w6z/1dfS2OwLKkiD41cxrXVMbQ/wDeqTf54+WjN3PhqY/wgIfs/XvdLHKgEUAEL5Q3k+IuxgZiQ == X-Received: by 2002:a05:620a:4487:b0:6ee:bcfd:bd38 with SMTP id x7-20020a05620a448700b006eebcfdbd38mr3958894qkp.468.1665758365599; Fri, 14 Oct 2022 07:39:25 -0700 (PDT) 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 Content-type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746674358661099034?= X-GMAIL-MSGID: =?utf-8?q?1746674358661099034?= 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; }