Message ID | 67956539824ea9dd66a94d67b046b2f4bb0aa6f2.1676680548.git.ackerleytng@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 D6779C05027 for <linux-mm@archiver.kernel.org>; Sat, 18 Feb 2023 00:43:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 783716B0099; Fri, 17 Feb 2023 19:43:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 734426B009A; Fri, 17 Feb 2023 19:43:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D4C86B009B; Fri, 17 Feb 2023 19:43:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4E8516B0099 for <linux-mm@kvack.org>; Fri, 17 Feb 2023 19:43:24 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 291A3808A7 for <linux-mm@kvack.org>; Sat, 18 Feb 2023 00:43:24 +0000 (UTC) X-FDA: 80478563928.28.B397449 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf21.hostedemail.com (Postfix) with ESMTP id 6AF231C000C for <linux-mm@kvack.org>; Sat, 18 Feb 2023 00:43:22 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=eMm01hnu; spf=pass (imf21.hostedemail.com: domain of 3KR_wYwsKCE4qs0u71uE93ww44w1u.s421y3AD-220Bqs0.47w@flex--ackerleytng.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3KR_wYwsKCE4qs0u71uE93ww44w1u.s421y3AD-220Bqs0.47w@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676681002; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9mwmDPnm22mSNSwTn0VodViIvXaPz9XlM8QDWYhbyM8=; b=vrOGNmbxcfiAvneTAdqQLAQMJwn3XfDeV1dSSpMWBbsC3s4w/uWUNHUgqfWgAi5keRem2S W3NANlD2E5lhFQfvozMbcgKwLRcRKaSh3DR3r4iDzuqlkkqiAw3yyh9ERYOMZAk0USSAdU g9XSSkVDgO7hkHc1ByWZ4ARGB3kTdk8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=eMm01hnu; spf=pass (imf21.hostedemail.com: domain of 3KR_wYwsKCE4qs0u71uE93ww44w1u.s421y3AD-220Bqs0.47w@flex--ackerleytng.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3KR_wYwsKCE4qs0u71uE93ww44w1u.s421y3AD-220Bqs0.47w@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676681002; a=rsa-sha256; cv=none; b=QIg4nF098FfGiUlNj+D/HfBTxGS2p0k10B8WoTWSD1nuOeRfsWIb7fYrUbeXYuK3DhAOf6 TG2blQHWpRys4zr3DeACu3z4KL2pCmzz3FfVrKtPkDI4pcBGkrg5r1aazrlz7eZph6c/e9 e0unikQdKtb07j+SUvGdjt8TkV7B75Y= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5365742524fso24999127b3.13 for <linux-mm@kvack.org>; Fri, 17 Feb 2023 16:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9mwmDPnm22mSNSwTn0VodViIvXaPz9XlM8QDWYhbyM8=; b=eMm01hnumElMl3UotGf8lJtLmKUjjLEmp4ZHK0o1H0LRyNA5w7x33BZeE7ifCfM7pg Cd3CBejXIUZT0dDASkiYet2Q11r1oqaxT2jWL7729gQTvNyIV+Z3A265SCXl8KKZFvM6 J2aSWma9rqTSDwyH7vONqfORZObAwWA+6hRLW5QjldLuMtFrDr6CiZLUw313wtVBTkEY Uql860ZaIf2fzbiPBXmxv8De94uhU4jaykP5woFVxM5M2xVs65vFvbC27a8oelqLROik ucodFnqa/c0QR5Ark7refIrmAYAsOKE19K26vuVEVEq0bwodrw1HGi4stiNrcoXlrrSh sdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9mwmDPnm22mSNSwTn0VodViIvXaPz9XlM8QDWYhbyM8=; b=dYSHj49VbgFgOVmzBuShQh76oTJ6rrgGznFneNNTqsX3nFwyZDM+jX2/1e/AGdxg4T KfB8Xbe/6piAKVCN3YO8C3zmBhePfQlxk/mCSqmuTDIlX9UQRwcQfAv8ay/GMs9W1wLH v7asDgr3zm6xoMf28nv7L3458/0c2zxib3Ror0zZSfmzXZw4PheZWpWbjbj6rpYe5up2 hV1Z6mKTFERbJbIIv5h1z3o1L2lOvX3rv7P659RpE3f6jcUCdq6XgfqZAjSAzeSvPcvn bvqBNrl5HCpyx1r2ZaOxXwfjx3oYFG5L1EDgt1kmySiL2PO36TeqFX7FxkI4YmzkyIMr 5xWQ== X-Gm-Message-State: AO0yUKU3d8tMh5mzLqiCx6l+wEDsek42DpaUWvknKhsuvkNf8LS+4E23 btxBJjVciGlgG96NPsRW87+E/1UQCkUt+ozH9Q== X-Google-Smtp-Source: AK7set8GCw+l6Q5gppx0SI7xgHF70UCy3j05OUIa+XJfbCoB3vIVoiRjffivwnfUze8k0uHuDZvSsWzxIhc/w0Mo2w== X-Received: from ackerleytng-cloudtop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1f5f]) (user=ackerleytng job=sendgmr) by 2002:a05:6902:10e:b0:95d:6b4f:a73a with SMTP id o14-20020a056902010e00b0095d6b4fa73amr5895ybh.8.1676681001601; Fri, 17 Feb 2023 16:43:21 -0800 (PST) Date: Sat, 18 Feb 2023 00:43:02 +0000 In-Reply-To: <cover.1676680548.git.ackerleytng@google.com> Mime-Version: 1.0 References: <cover.1676680548.git.ackerleytng@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <67956539824ea9dd66a94d67b046b2f4bb0aa6f2.1676680548.git.ackerleytng@google.com> Subject: [RFC PATCH 2/2] selftests: restrictedmem: Add selftest for RMFD_HUGEPAGE From: Ackerley Tng <ackerleytng@google.com> To: kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, qemu-devel@nongnu.org Cc: aarcange@redhat.com, ak@linux.intel.com, akpm@linux-foundation.org, arnd@arndb.de, bfields@fieldses.org, bp@alien8.de, chao.p.peng@linux.intel.com, corbet@lwn.net, dave.hansen@intel.com, david@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, hpa@zytor.com, hughd@google.com, jlayton@kernel.org, jmattson@google.com, joro@8bytes.org, jun.nakajima@intel.com, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, luto@kernel.org, mail@maciej.szmigiero.name, mhocko@suse.com, michael.roth@amd.com, mingo@redhat.com, naoya.horiguchi@nec.com, pbonzini@redhat.com, qperret@google.com, rppt@kernel.org, seanjc@google.com, shuah@kernel.org, steven.price@arm.com, tabba@google.com, tglx@linutronix.de, vannapurve@google.com, vbabka@suse.cz, vkuznets@redhat.com, wanpengli@tencent.com, wei.w.wang@intel.com, x86@kernel.org, yu.c.zhang@linux.intel.com, Ackerley Tng <ackerleytng@google.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6AF231C000C X-Rspam-User: X-Stat-Signature: 88oqzwfan63xhkio1hx6t19xf4fc4bf3 X-HE-Tag: 1676681002-970068 X-HE-Meta: U2FsdGVkX1/9QRwT22O+mtqTDwbcfSt3oxjrUJL6ejcqNeg0T+xMy87d24pr5iJivy6nQFQC/NG/6zv/4c3Gd16yEfFHmB8NByue5rTmklgYD0xlkPjJtQu/65TTIuFx1uY4i+StJVZ04M4tpWAMwMGojwZ0LYf0C6MylXm+RFX/vPeHNPxqffVQgr+GiBcuBi2Qz1YiMc0+jqWOlTKTB563BbjGvc6FV1k/PHOE2PybQEzKcHw3iWpThWRSw9oYCodV5nBD9fDcFCHVLUfBC6FLa/E0y8YDUeTBKbD9jeowRyyPEigunutie1sh1OmY8+uLz2poWW6nefnq7XW5S4Ja+4lMPEQC9Gtf7yMfJ4uFHK5YJAo82nb3dZHPiWlolCBBJXZ2GOJ8h88WWCm/HboQqaroNULc8VegJwKg++u8us3WSL9OiPpW+vfzv99oqW+bhCWsd2zxMbAmD0yzm7OVNeIwIiOCPnE7blNagDQgm/+2FFrY2z1+GWXrsNN0U2kKMUyYTI/5WTZ2x9u6fvlS2dktvVUsaZKYw0jsnjjERMJVS46MMGko1GvZje9wC2JTq5THfed/Zcb1pQsUjRPVVfeZkqVqgh6QXm3Rp8MLemVMd8X36i4H3u0aumbXoSQwBPg/c4jQoPtFPa5kJSHYm6LdAGZOE04jpw789SmUf/soTwbQMmykdtNiXtNU01lIuK3CTjzGPhLDHpFAlviZvsOsZ56TkIpIWCv4Eo4isA6tYoBNRnIX4+MlyryDuAxJUnH6AZOpg03KxxkoVM2IWDqpffJ1f1ixwYZ6YHLAeQQIcHbV5F2vqkfleU9HJYGXBMIYB6sgqYGZ5vovo2lR9Tnl6+q0IPZ33o4kIuBzYh+YT5nJXdqsNj5/Ul5AtrUI4vjBEhz7fPkzAiofoO5EyxY89OLqgZTrSXu7O0sURKUDRzReJeM+T6bKAhSXJL+sEjkfXkymRGPa0qI qYhD/mgD oNbhTU3XoWsGvMzLSL1O4nM4mouh3F2HBFv8XCN0f49AKuchF02l58fCqZT3b6ZffHgHZ5z9o5n5FaZa6sJVVfkvocm8jFdH7aNzF34Kid7vKWZH2ni6XTFJNSjopqzHWpqg6o3pehoVCKts72lGkItHz+Bal5Gh9rQ1k0jQ4uw5F99XI3lfQYPfeMJOeXaE6N7R1MHXotFI6BXlLdQtAuzV8s4i2Nhxmgnehunt7gS5f7aX4f5ctPsgYm+CeA5BCab9ihzDfmqdQkFrBdfKS8bspAGYZ/X6YvU5BMP5Y1eXDO0wRvSdtx3BOCZsrGF/r+EGiAWBCV8C/MEzHeUnWuS8jNG4kFq8hNOth0nIaLFq4MJ6PuAHw65TfeUhoP6YcNoBPH2++Rh310+etbryh6BVx9U5rWok4TwMESgnKFH+soF0SlOzVT3XdEvkYDoZXOFpNJOwXkUe+ax0e6BAKfW0pRSAmZt0jA1Ac7InD1sftCQB9eXUPeqCRTGIDC2HuK7mZzR65ZTKFnKY/IIl4q2YbD/CxgjZBVHCmEZNx+qs58JEehaDM+zUCyiT456ESMm0hy4eXWtjIh6JtUz/9FVkIRur0AXocv6RlqDesXKmZz/kz0uxqc+h8+334iHeeUqSQPuXvngVYd6aDUaoHNoDV+KUwW2OahHGb9+TnBK5Pwh58OTZP+IoKlTDM/Wpz+eHCQxkbyyQRJX4= 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: <linux-mm.kvack.org> |
Series |
Add flag as THP allocation hint for memfd_restricted() syscall
|
expand
|
diff --git a/tools/testing/selftests/restrictedmem/restrictedmem_hugepage_test.c b/tools/testing/selftests/restrictedmem/restrictedmem_hugepage_test.c index 0d9cf2ced754..75283d68696f 100644 --- a/tools/testing/selftests/restrictedmem/restrictedmem_hugepage_test.c +++ b/tools/testing/selftests/restrictedmem/restrictedmem_hugepage_test.c @@ -180,6 +180,31 @@ TEST_F(reset_shmem_enabled, restrictedmem_fstat_shmem_enabled_always) close(mfd); } +TEST(restrictedmem_invalid_flags) +{ + int mfd = memfd_restricted(99, NULL); + + ASSERT_EQ(-1, mfd); + ASSERT_EQ(EINVAL, errno); +} + +TEST_F(reset_shmem_enabled, restrictedmem_rmfd_hugepage) +{ + int mfd = -1; + struct stat stat; + + ASSERT_EQ(0, set_shmem_thp_policy("never")); + + mfd = memfd_restricted(RMFD_HUGEPAGE, NULL); + ASSERT_NE(-1, mfd); + + ASSERT_EQ(0, fstat(mfd, &stat)); + + ASSERT_EQ(stat.st_blksize, get_hpage_pmd_size()); + + close(mfd); +} + TEST(restrictedmem_tmpfile_no_mount_path) { int mfd = memfd_restricted(RMFD_TMPFILE, NULL);
Tests that when RMFD_HUGEPAGE is specified, restrictedmem will be backed by Transparent HugePages. Signed-off-by: Ackerley Tng <ackerleytng@google.com> --- .../restrictedmem_hugepage_test.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)