Received: by 10.223.164.202 with SMTP id h10csp290130wrb; Mon, 6 Nov 2017 06:42:59 -0800 (PST) X-Google-Smtp-Source: ABhQp+R4j5rsj/CvtO3RKADiM597xoMwuMTUYN+u7yJJNF/5FWeiH5n6990zNXyQ5FIRzml8lG4U X-Received: by 10.99.6.75 with SMTP id 72mr15426959pgg.350.1509979379416; Mon, 06 Nov 2017 06:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509979379; cv=none; d=google.com; s=arc-20160816; b=zG0Yj55U40+ABONHLdardnBBJO6eXZHJYoyQAByw20PeG7kgOev17iZuDcww/xfMQ8 I8gpCo2FrxoTVRQfgocDx49hDPnUQ/BNISKTxD5FOCxwPp4DMJvUGKLZ9NdyX97Cc3mG Z+GLbtHGwkFK+J1FzhKBtRWv/EeRRb7JHTU2gU3bMeGOBx3QVkrkpOAcYijc98UXYwPO Ara6zQg5H6heQ9VHCIYqiE3x5WJm6/LIUS6es+pDH8RX9i/qbdI/r0Zt3JBm/UKRiv7y HZP65LaEs91Yhasqa0dizO8JYfm1FhkMt7ecgFYAFr2Tcqv3utFi+Ja8hUwcBo4YscB5 mhLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:arc-authentication-results; bh=BYzNYpbutot88fhBm0y98X2Xdn9lDEoOUDm7nAK4igM=; b=TSPBytO6I9lwKTrPdES5XD1wJ2kkDNr+6YFvJ3iluGlp39zSIh1xY3abAfJjnwa8ct V0t4Y7Hp6c7/JBeT1GhVR1OuN2jqnYUNV/Oon/obRsU/aSDAj58N01N/FosxOO0eiw2P tumD8bicktG0e8R6hMWjFVnc+JYYXRmCnL+Sd1CNqjC5UZsKkjIGeIH/kQHbpO5BPhwV PuHJpcSrqc+5/wjXggzcqckhKSEclDjReDC3vkI2B1UtN258rZfDBnKisesySUuR6L0b 0COS/x9n1yqxLORYIFQ2DtwqG9EMfHwd2tUZFzazNlBs988W6ZWhulalKeDu0BtmvWa/ n+Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b123si11213804pgc.302.2017.11.06.06.42.46; Mon, 06 Nov 2017 06:42:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932548AbdKFOlh (ORCPT + 97 others); Mon, 6 Nov 2017 09:41:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932490AbdKFOkc (ORCPT ); Mon, 6 Nov 2017 09:40:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC61CC047B86; Mon, 6 Nov 2017 14:40:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC61CC047B86 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=marcandre.lureau@redhat.com Received: from localhost (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 732175EDED; Mon, 6 Nov 2017 14:40:31 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: aarcange@redhat.com, hughd@google.com, nyc@holomorphy.com, mike.kravetz@oracle.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v2 9/9] memfd-test: run fuse test on hugetlb backend memory Date: Mon, 6 Nov 2017 15:39:44 +0100 Message-Id: <20171106143944.13821-10-marcandre.lureau@redhat.com> In-Reply-To: <20171106143944.13821-1-marcandre.lureau@redhat.com> References: <20171106143944.13821-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 06 Nov 2017 14:40:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Suggested-by: Mike Kravetz Signed-off-by: Marc-André Lureau --- tools/testing/selftests/memfd/fuse_test.c | 30 ++++++++++++++++++++++---- tools/testing/selftests/memfd/run_fuse_test.sh | 2 +- tools/testing/selftests/memfd/run_tests.sh | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/memfd/fuse_test.c b/tools/testing/selftests/memfd/fuse_test.c index 795a25ba8521..0a85b34929e1 100644 --- a/tools/testing/selftests/memfd/fuse_test.c +++ b/tools/testing/selftests/memfd/fuse_test.c @@ -38,6 +38,8 @@ #define MFD_DEF_SIZE 8192 #define STACK_SIZE 65536 +static size_t mfd_def_size = MFD_DEF_SIZE; + static int mfd_assert_new(const char *name, loff_t sz, unsigned int flags) { int r, fd; @@ -123,7 +125,7 @@ static void *mfd_assert_mmap_shared(int fd) void *p; p = mmap(NULL, - MFD_DEF_SIZE, + mfd_def_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, @@ -141,7 +143,7 @@ static void *mfd_assert_mmap_private(int fd) void *p; p = mmap(NULL, - MFD_DEF_SIZE, + mfd_def_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, @@ -174,7 +176,7 @@ static int sealing_thread_fn(void *arg) usleep(200000); /* unmount mapping before sealing to avoid i_mmap_writable failures */ - munmap(global_p, MFD_DEF_SIZE); + munmap(global_p, mfd_def_size); /* Try sealing the global file; expect EBUSY or success. Current * kernels will never succeed, but in the future, kernels might @@ -224,7 +226,7 @@ static void join_sealing_thread(pid_t pid) int main(int argc, char **argv) { - static const char zero[MFD_DEF_SIZE]; + char *zero; int fd, mfd, r; void *p; int was_sealed; @@ -235,6 +237,25 @@ int main(int argc, char **argv) abort(); } + if (argc >= 3) { + if (!strcmp(argv[2], "hugetlbfs")) { + unsigned long hpage_size = default_huge_page_size(); + + if (!hpage_size) { + printf("Unable to determine huge page size\n"); + abort(); + } + + hugetlbfs_test = 1; + mfd_def_size = hpage_size * 2; + } else { + printf("Unknown option: %s\n", argv[2]); + abort(); + } + } + + zero = calloc(sizeof(*zero), mfd_def_size); + /* open FUSE memfd file for GUP testing */ printf("opening: %s\n", argv[1]); fd = open(argv[1], O_RDONLY | O_CLOEXEC); @@ -303,6 +324,7 @@ int main(int argc, char **argv) close(fd); printf("fuse: DONE\n"); + free(zero); return 0; } diff --git a/tools/testing/selftests/memfd/run_fuse_test.sh b/tools/testing/selftests/memfd/run_fuse_test.sh index 407df68dfe27..22e572e2d66a 100755 --- a/tools/testing/selftests/memfd/run_fuse_test.sh +++ b/tools/testing/selftests/memfd/run_fuse_test.sh @@ -10,6 +10,6 @@ set -e mkdir mnt ./fuse_mnt ./mnt -./fuse_test ./mnt/memfd +./fuse_test ./mnt/memfd $@ fusermount -u ./mnt rmdir ./mnt diff --git a/tools/testing/selftests/memfd/run_tests.sh b/tools/testing/selftests/memfd/run_tests.sh index daabb350697c..c2d41ed81b24 100755 --- a/tools/testing/selftests/memfd/run_tests.sh +++ b/tools/testing/selftests/memfd/run_tests.sh @@ -60,6 +60,7 @@ fi # Run the hugetlbfs test # ./memfd_test hugetlbfs +./run_fuse_test.sh hugetlbfs # # Give back any huge pages allocated for the test -- 2.15.0.rc0.40.gaefcc5f6f From 1583406622983588948@xxx Tue Nov 07 11:30:28 +0000 2017 X-GM-THRID: 1583406622983588948 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread