From patchwork Tue Oct 4 21:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12998716 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 5FAFEC4332F for ; Tue, 4 Oct 2022 21:41:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D62696B0074; Tue, 4 Oct 2022 17:41:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C72E76B0075; Tue, 4 Oct 2022 17:41:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC3CC6B0078; Tue, 4 Oct 2022 17:41:33 -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 9CA306B0074 for ; Tue, 4 Oct 2022 17:41:33 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 71A571607A5 for ; Tue, 4 Oct 2022 21:41:33 +0000 (UTC) X-FDA: 79984588866.21.D49960A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 1BD934000E for ; Tue, 4 Oct 2022 21:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664919691; 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=dJaHvDIYcugfcbZXI9MGjISejh5vRgBChdcjH0EX9gK2PQj+b+fXG3t17UHlBLb8jdj1yK 2Z55fE+yYvcGEOf2L1Jboc4PS7FvGShcZezLeSolAJm6G/f9lXfiss1mCN+VM5I9NkbKjE t8XW6WBULBEp0OipNqWRSkD5ufkSG/w= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-121-it2t_aZqP3yT7XvSsSOnUQ-1; Tue, 04 Oct 2022 17:41:30 -0400 X-MC-Unique: it2t_aZqP3yT7XvSsSOnUQ-1 Received: by mail-qt1-f200.google.com with SMTP id g6-20020ac84b66000000b0035cf832dec9so10100430qts.6 for ; Tue, 04 Oct 2022 14:41:30 -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; bh=zhrtCe5O8iJscoLdf85Accar6WxcllS+eYr7bBy1HkM=; b=JLuZDlEUS1i+o9lCHRkNBVRoWYcmqnUwwNK63MbSpns5Xk2GR063NaPUBU3gPV0XLL 4HjUe5cbYlIXWoI1yPxFX+D5xIkjCxtYc4WZ2OMMSz8SAiTFqnWRU8rXHCjOqK7Bu82z 27s76RXWkCm44GiNDxCIT/9dGq/JktbnczJu3hHv+KMHuancGr2F30g69UGeXTtfyT8f H6X6Srhs/Ttsz+khKRM+rpr12l3zbXQqgTVAt0ClbnaaMuqWVN+JlS4lqIeEcATAKciJ Z+zHMoHPaCfVa0HztLrO2QUyCsUi8QDGHMt9gcphv+yS3eW+JssVS34aGb554DGcP0OT dCDw== X-Gm-Message-State: ACrzQf0c0T+0TlU9+oI7L4TUvN0fRvQN4LSvELAmCrMOFmv2WDYKd2zO e37bQamoB/VtlyChmvS6i5I5JJGOmdPfCmqe1VnrtL5OgkvuNdkb3LFF5j+9s0og+8Dy1AjlyS0 otZtJRIwhpYY= X-Received: by 2002:a05:6214:c6d:b0:4b1:c751:ac7 with SMTP id t13-20020a0562140c6d00b004b1c7510ac7mr400606qvj.96.1664919689911; Tue, 04 Oct 2022 14:41:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5na/pwjmQhLcKutEJzsIkykeE5fgN/HwlF3WpQM1DgGubYNqpa+trsw7pJkJNONLm/cQp/ew== X-Received: by 2002:a05:6214:c6d:b0:4b1:c751:ac7 with SMTP id t13-20020a0562140c6d00b004b1c7510ac7mr400597qvj.96.1664919689696; Tue, 04 Oct 2022 14:41:29 -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 y15-20020a05620a25cf00b006bbf85cad0fsm15519956qko.20.2022.10.04.14.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 14:41:29 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , peterx@redhat.com, Axel Rasmussen , Mike Kravetz Subject: [PATCH 2/4] selftests/vm: Use memfd for hugetlb-madvise test Date: Tue, 4 Oct 2022 17:41:23 -0400 Message-Id: <20221004214125.120993-3-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221004214125.120993-1-peterx@redhat.com> References: <20221004214125.120993-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=1664919692; 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=n72IiMCsxGQ5/nOd9ccEXVgXSzONBkf9x65ALIIjebBD0SoGlqrRfQRkUX/NpknXBOVvnu m3BBUc9S5d8QMg4EjhVI1DP8/YE33+6XmcKvQF5OcfKB4ZPOHT6QbnzIEGe5f4d9xtHknz 4zIXz/0f8/vDUS2V/4IIpAIn8IeBsQ8= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dJaHvDIY; spf=pass (imf17.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=1664919692; a=rsa-sha256; cv=none; b=8cpKCrP047z6XMuADWXBWJ8VAzVhJdEng1jHGTB2iuV13hiyk6hV8J85xM2SWog3GKXoXU Rfb+ken/hMA1KrjDBZSrCWAmxRMBVI94S8HMMDznv1YdnhmO/iaYeEh/v2JDMTb8jLMjFq lzrJuiKZ9iYbV7uUJEx7XKUMimDmp/s= X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dJaHvDIY; spf=pass (imf17.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: rspam12 X-Rspamd-Queue-Id: 1BD934000E X-Stat-Signature: d83eiu8m1tos4xwyh1n9hm3786wb46t5 X-HE-Tag: 1664919691-12300 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; }