From patchwork Wed Mar 6 22:37:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Pache X-Patchwork-Id: 13584695 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 DAB5FC54E49 for ; Wed, 6 Mar 2024 22:38:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D169F6B00A3; Wed, 6 Mar 2024 17:38:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA2386B00A2; Wed, 6 Mar 2024 17:38:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B41846B00A5; Wed, 6 Mar 2024 17:38:10 -0500 (EST) 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 A73CA6B00A2 for ; Wed, 6 Mar 2024 17:38:10 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 61EDF805F5 for ; Wed, 6 Mar 2024 22:38:10 +0000 (UTC) X-FDA: 81868078740.04.118443A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id D74C2C0018 for ; Wed, 6 Mar 2024 22:38:07 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=K94+mZtF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.hostedemail.com: domain of npache@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=npache@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709764687; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zDmyGePUUlnnXiKRIxOi1EKt7GfptI6swe//338fxpI=; b=3NGHiAkLSj878GJZsOQrXdL1tmCX/b24pg0UWYz1novXZmbG98tK+rzcydaYpChdBGj6eb Zwgy//r9HXzzmxI1EZs5UHPZKVfJ74iXKTUkvfFS2fCVadDSGYri1moVxR8f7QC99Cjcmd tZSOqx/xh9VcWx8XGw6GrF3y+BUYiWM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=K94+mZtF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.hostedemail.com: domain of npache@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=npache@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709764687; a=rsa-sha256; cv=none; b=YmMTO9sKtbFy/+BtT7eBSvOOcG6YutvN1Ih+T2da/u7ufK2vIrvxM4XchpOMdXpWhCETOD UFOKxiwglsjUIIcGcIkoeJ4s4yHcMZg/H6nS7lv5djWkVIgg7oACIWXZgKxQMQpzhKrbOO j8XWzj29K83s6dDuVT9ZRVo7s86TbnM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709764687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zDmyGePUUlnnXiKRIxOi1EKt7GfptI6swe//338fxpI=; b=K94+mZtFuULgVsWKLuKMupYqcGPVB7Mcs4bB0K/pOTEBeis4NE2cnsGbwqRuy7FPbU1ACG dTSwc4x9+mz7VLvX+1xSR1bsw1/P7sTTwzIww81I4lR4IKtsoscTdFxb4UfFEDC/PNo56O wS82Q7JC1amsefI5eW0buYyL9+Iexck= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-T2GTcx7CNWKwblB0nSnOpw-1; Wed, 06 Mar 2024 17:38:03 -0500 X-MC-Unique: T2GTcx7CNWKwblB0nSnOpw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CA50800269; Wed, 6 Mar 2024 22:38:03 +0000 (UTC) Received: from localhost.redhat.com (unknown [10.22.9.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB4D1111D789; Wed, 6 Mar 2024 22:38:02 +0000 (UTC) From: Nico Pache To: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ben@decadent.org.uk, shuah@kernel.org, akpm@linux-foundation.org, usama.anjum@collabora.com Subject: [PATCH v2 2/3] selftests/mm: Skip uffd hugetlb tests with insufficient hugepages Date: Wed, 6 Mar 2024 15:37:13 -0700 Message-ID: <20240306223714.320681-3-npache@redhat.com> In-Reply-To: <20240306223714.320681-1-npache@redhat.com> References: <20240306223714.320681-1-npache@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D74C2C0018 X-Stat-Signature: ep5z5jzi773ybb7rephnryyduizi1i3o X-HE-Tag: 1709764687-754558 X-HE-Meta: U2FsdGVkX1+6td8pfRSjaSlD3sd7r99/CudtpOCLumwmCZssKQvNwbLXY2juj278WDAgJUe1mFO2pmCej3gI9nlXFqoVY6XcldtlMoSl5AVy1lWMgCa8e00rMP4bRc+7fMsOXd1Ung+z8cFjfqrtGUkFTUP3xhq8XBzPjtTP3TO7UpveqYFnbGj8GQk+JQP83bIqzxZFeZ/g6c6Gh81q7liPwETJcI7F7924PkEbWM6jWOONbrc30iF3bSIt1L4UiYr84PxnwxAZPSRSlZ6svYPUT9hY+weLP0jBUzD0hIM0fstXX6S26kaqpKu35CvniyXXTOs+AfuIM8luMRRXWYMb9ZwYIUvQjjty9rVE3AM0RFgLOQz68BE3O8G6/L4PWBgj0KXoaBcwXQC7Hv6xcuzgaCsR/2gOqJLk7GBEZCeARpqg4Q0qy8yhEUQrCTsKzyBtZcsvODa80pVCdt5ySkE/AcRUKGHPpJN+Tp5vjiLW9nEeFo3Wm+8A1051+Y4MQjQVbHsLQ/+ZEWXkY8u5O2wwWYijXfNValGfxtqPAXOMgt579ndFx2kHVH+6zUqreOkPsQUiH1U8aCsFHWy3sXtX/l+W6yaCpIBh1Kv5e0ncHPrAHi0R9ywvF5IDxLKaXOOQvhRDMgA0N2cs7S52PK4Ktsh5qVmZWSlC7S8YFEOYKUhnwdBguu/8XZNtU9+7bhmOkpKqK+hO7Szj1vCROpuyB17Y3sNjDFenS0rdZb7Ma4DiCI6MLVV4UynRnh4invurls0h1AOe5hpxJSbE0hTqQZUSir8LfGVAhF5s40qhuL/KHsqN2umgWQbtmj6hVSoILB72pePTweu+Ix3wjPoWgP9ekWOMMqAnXSK74v3CB7H3dLstHYE/v5jz/okLwWUJEN2TRRXKQJ3yk7slCA== 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: List-Subscribe: List-Unsubscribe: Now that run_vmtests.sh does not guarantee that the correct hugepage count is available, add a check inside the userfaultfd hugetlb test to verify the nr_hugepages count before continuing. Signed-off-by: Nico Pache --- tools/testing/selftests/mm/uffd-stress.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index 7e83829bbb335..1165446f10883 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -441,6 +441,12 @@ int main(int argc, char **argv) parse_test_type_arg(argv[1]); bytes = atol(argv[2]) * 1024 * 1024; + if (test_type == TEST_HUGETLB && + get_free_hugepages() < bytes / page_size) { + printf("skip: Skipping userfaultfd... not enough hugepages\n"); + return KSFT_SKIP; + } + nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); nr_pages_per_cpu = bytes / page_size / nr_cpus;