From nobody Mon Apr 6 12:18:31 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F27343DEFE0 for ; Thu, 19 Mar 2026 16:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773936447; cv=none; b=tbds4b8oW4s2UI6SrnPJ5P1kksi5JuifoTt6HQQ0NbFknBARvKb0OIx0rDJLrvUyBajZLeMfLn/Hx7dYdcGoiTuC6BqW9GutigSwtJuK5+f3EQNfzfBqkkrN7+yLvnV2jpagKJ0bIK2yFivn9pC4hj2Xur9H120+12JR8k4pf2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773936447; c=relaxed/simple; bh=afErkGsbJipaWxq6WqWFYT/fGtnRdwo8GCJK6dQjc44=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C6hpzQsx2NrhLOhJQIRzdw1S5ds547H/CjT0XZNOj3j4Zhu9xrrIkQa1nJlQZL+G56mtpbeLQBMggpCe1D5gaaTFrQ9h831aHp5MwmoUPK5RpHi93MHDW4LMNsCW2Z5gVIWR0OC8jJmmuMKmBBH6cKiBg+A7mvsNUbs2d9/a3oQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=e+cIx6q3; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="e+cIx6q3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773936445; 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=V9AAlpSGzxdv8c6CONczdhhLumdRpfeuyMphF9hSKuI=; b=e+cIx6q3go9Oqz+b9zQ4Pyjd4CjtXQG0nDs3jXRD4lzaV/arHsrzjtPskz/CSO/opEGkwp PPireVxZgyeaRgPY/2Ytr2JUSyFyHY3fJemSlu9Dku3edN8baMrEY5VLANC+lfOerzZfrd uv03tNT/E4PJ9eiVQU/q3ihSMLE74hM= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-v8jH_6VhOHm2yCsrThtz8g-1; Thu, 19 Mar 2026 12:07:21 -0400 X-MC-Unique: v8jH_6VhOHm2yCsrThtz8g-1 X-Mimecast-MFC-AGG-ID: v8jH_6VhOHm2yCsrThtz8g_1773936439 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 96AC6195608E; Thu, 19 Mar 2026 16:07:18 +0000 (UTC) Received: from dell-per7425-02.rhts.eng.pek2.redhat.com (dell-per7425-02.rhts.eng.pek2.redhat.com [10.73.116.18]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1D2E330001A1; Thu, 19 Mar 2026 16:07:09 +0000 (UTC) From: Chunyu Hu To: akpm@linux-foundation.org, david@kernel.org, shuah@kernel.org, linux-mm@kvack.org, ljs@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, chuhu@redhat.com, Li Wang Subject: [PATCH v4 1/5] selftests/mm/guard-regions: skip collapse test when thp not enabled Date: Fri, 20 Mar 2026 00:06:52 +0800 Message-ID: <20260319160656.1480279-2-chuhu@redhat.com> In-Reply-To: <20260319160656.1480279-1-chuhu@redhat.com> References: <20260319160656.1480279-1-chuhu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" When thp is not available, just skip the collape tests to avoid the false negative. Without the change, run with a thp disabled kernel: ./run_vmtests.sh -t madv_guard -n 1 # RUN guard_regions.anon.collapse ... # guard-regions.c:2217:collapse:Expected madvise(ptr, size, MADV_NOHUGEPA= GE) (-1) =3D=3D 0 (0) # collapse: Test terminated by assertion # FAIL guard_regions.anon.collapse not ok 2 guard_regions.anon.collapse # RUN guard_regions.shmem.collapse ... # guard-regions.c:2217:collapse:Expected madvise(ptr, size, MADV_NOHUGEPA= GE) (-1) =3D=3D 0 (0) # collapse: Test terminated by assertion # FAIL guard_regions.shmem.collapse not ok 32 guard_regions.shmem.collapse # RUN guard_regions.file.collapse ... # guard-regions.c:2217:collapse:Expected madvise(ptr, size, MADV_NOHUGEPA= GE) (-1) =3D=3D 0 (0) # collapse: Test terminated by assertion # FAIL guard_regions.file.collapse not ok 62 guard_regions.file.collapse # FAILED: 87 / 90 tests passed. # 17 skipped test(s) detected. Consider enabling relevant config options = to improve coverage. # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0 With this change, run with thp disabled kernel: ./run_vmtests.sh -t madv_guard -n 1 # RUN guard_regions.anon.collapse ... # SKIP Transparent Hugepages not available # OK guard_regions.anon.collapse ok 2 guard_regions.anon.collapse # SKIP Transparent Hugepages not availab= le # RUN guard_regions.file.collapse ... # SKIP Transparent Hugepages not available # OK guard_regions.file.collapse ok 62 guard_regions.file.collapse # SKIP Transparent Hugepages not availa= ble # RUN guard_regions.shmem.collapse ... # SKIP Transparent Hugepages not available # OK guard_regions.shmem.collapse ok 32 guard_regions.shmem.collapse # SKIP Transparent Hugepages not avail= able # PASSED: 90 / 90 tests passed. # 20 skipped test(s) detected. Consider enabling relevant config options = to improve coverage. # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0 CC: Li Wang Signed-off-by: Chunyu Hu Acked-by: David Hildenbrand (Arm) Acked-by: Mike Rapoport (Microsoft) Reviewed-by: Zi Yan --- Changes in v4: - use thp_available instead of thp_is_enabled() as when thp is set to never, madvise(MADV_COLLAPSE) will still succeed by design. So a failure in madvise(MADV_COLLAPSE) on guard region will verify guard region denies it. This is suggested from AI. - removed the 'Reviewed-by' and 'Acked-by' as the code changes. Sorry for that but it seems the changes is a little huge? (1 out of 2 lines).. Changes in v3: - commit message: update the log snippet with where the fail happens and add the '-n1' to the command. - fix the 'false positive' to 'false negative' - add reviwed by from Mike Changes in v2: - add reviewed by from Zi and Lorenzo - add acked-by from David --- tools/testing/selftests/mm/guard-regions.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/sel= ftests/mm/guard-regions.c index dbd21d66d383..48e8b1539be3 100644 --- a/tools/testing/selftests/mm/guard-regions.c +++ b/tools/testing/selftests/mm/guard-regions.c @@ -21,6 +21,7 @@ #include #include #include "vm_util.h" +#include "thp_settings.h" =20 #include "../pidfd/pidfd.h" =20 @@ -2195,6 +2196,9 @@ TEST_F(guard_regions, collapse) char *ptr; int i; =20 + if (!thp_available()) + SKIP(return, "Transparent Hugepages not available\n"); + /* Need file to be correct size for tests for non-anon. */ if (variant->backing !=3D ANON_BACKED) ASSERT_EQ(ftruncate(self->fd, size), 0); base-commit: 8a30aeb0d1b4e4aaf7f7bae72f20f2ae75385ccb --=20 2.53.0