From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1D83A27FB03 for ; Tue, 2 Dec 2025 10:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764672667; cv=none; b=eIw6aTM9LGnt0m2S7jS2RzG3Ttr//UgvG2W79OXpoJsox2a4fpEohDFcTAyG3AQj9KOOvMAJlse8m7FM6ZUkBL5ULUhe6ksVWVSaPzYgJO5IKZ7uPOc67uDbAtFDdS/5s1dqO7eFDUJpfGRxvHl7wffgAXJ6BMa/S2fHmzO8c4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764672667; c=relaxed/simple; bh=90lsWaeNJmpMVHdssqjw9Hi4PwEk2F90+PBNDk6Ln24=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MqV52YfelIjZKvVAefNu/sLkdi8DYf9qeJ6W6dACfqENtPadRFwx8YvuHB2cqwPdOr2GAZsp/KF9WEubPFyHy3LZs4GuOVUab4IHw79vqfOnBRulGLkzconyyfAscN3ooXQjLIrn2hiqvVLo/8Pale9AIK79ZT20L4uZVZZi7g8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NCd1yM3Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NCd1yM3Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7A24C4CEF1; Tue, 2 Dec 2025 10:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764672664; bh=90lsWaeNJmpMVHdssqjw9Hi4PwEk2F90+PBNDk6Ln24=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=NCd1yM3QoEVUBJvgqQR9JjnTFRw7YOqbY8JftMXSCPIAjP1JzutD8fI+aGoFbyXa2 uL/st5oZOvI9/JX8mV1aGH4jcxIErmiD7jxpZsR3aCV4617Sge2CRLRngHqzqZe2nZ AgBGTgL32+QvlzfbKZuqpLllgQtPJaLtkn/eV+QucHBIUXv3JMCUG3mug9ktUUxkM6 mqKhgM2YCEWjJrMn3ryjFlD5/D6YAHM/l7J6cvR0PGahskkDw2OgWlty5bZkZVQZFk jfHr+ZbMFghUim+228H6Itwr4T6oZUyxWDOmvFXHE2srizLrJehWy/ei0kXYvKXBwI EI58493AYr7SQ== Message-ID: <2149802c-b7cd-430c-8af0-99d26b0b7330@kernel.org> Date: Tue, 2 Dec 2025 11:51:00 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 04/10] drivers: i915 selftest: use pgtable_has_pmd_leaves() To: Luiz Capitulino , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com References: <297c6fa3dfc50c28c05c0974c86a205984d752ed.1762464515.git.luizcap@redhat.com> <8c745e54-1cb1-44d4-abc3-00e6511cf67c@kernel.org> <21386400-9a67-4fcf-b686-1e7c9678d123@redhat.com> From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: <21386400-9a67-4fcf-b686-1e7c9678d123@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/17/25 19:55, Luiz Capitulino wrote: > On 2025-11-17 12:30, David Hildenbrand (Red Hat) wrote: >> On 06.11.25 22:28, Luiz Capitulino wrote: >>> igt_can_allocate_thp() uses has_transparente_hugepage() to check if >>> PMD-sized pages are supported, use pgtable_has_pmd_leaves() instead. >>> >>> Signed-off-by: Luiz Capitulino >>> --- >>> drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c >>> index bd08605a1611..c76aafa36d2b 100644 >>> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c >>> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c >>> @@ -1316,7 +1316,7 @@ typedef struct drm_i915_gem_object * >>> static inline bool igt_can_allocate_thp(struct drm_i915_private *i915) >>> { >>> - return i915->mm.gemfs && has_transparent_hugepage(); >>> + return i915->mm.gemfs && pgtable_has_pmd_leaves(); >> >> On second thought, is it problematic that we might be losing the CONFIG_TRANSPARENT_HUGEPAGE check? Should we check for that separately? > > That's a good point. > > In this RFC, pgtable_has_pmd_leaves() should be functionally equivalent > to has_transparent_hugepage() so I think we're good. That beind said, I > also think that we should disentangle pgtable_has_pmd_leaves() from THP > now or in the future. When we do this the breakage you're spotting will > happen. > > What about adding thp_has_pmd_support() which does: > > return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && pgtable_has_pmd_leaves(); > > Then I can convert all the cases you spotted to thp_has_pmd_support(). I hope we can avoid such a wrapper for the time being. Maybe we can just keep pgtable_has_pmd_leaves() glued to CONFIG_TRANSPARENT_HUGEPAGE for now, and leave untangling that for the next cleanup? -- Cheers David