From mboxrd@z Thu Jan 1 00:00:00 1970 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 7B82F38F62A for ; Fri, 18 Sep 2026 01:46:37 +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=1789696006; cv=none; b=CqfyVNUVEfmi80jAMDKBzFg4ds+NmnUAMNDeYCGFsS6xms0PyjD5l7HqBIHBynWm1U2jsJABdiMSA7knsS/E2JdrqJP+MFYsnzomnA6EhiWEgd/z0RoONWEl0I1DGds8mQyFsboaTdiLgQNOdFIxUXZSWN1+skW4KQrb8UKBGuU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789696006; c=relaxed/simple; bh=V/ZoTEkWXOtImTwoEfhGMxCO3nj3l9asJXzzKsI+Wd4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rIBlgaDqz2ipOeyW9DUxm1a7+1lY7f1ORt81SRwK8hYULlw9QHZq/B5DWjWBp9AE1wG5KKdIr0zi3K9sh4I1PkyFaxDmu6jMNfpxNODPv55hlCc53PToY6GUc4eaZQUKOLb66h5jAFBcfZRvru5Cza/4HBRWazpOoU8R+iiPaYw= 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=QU1uIF3+; 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="QU1uIF3+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789695992; 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=vWKt08g60DdFG3Icxm2Us7CxOftu08depFwjwgt6DxU=; b=QU1uIF3+sFMzkKIcr//8hmc1NTcCg/lLw8jsLdLDubbnh18VPLQ0Rm69vhnGzAjfZcz9pM cwYQDOScAEkr84hfBi9tQLiCwS6G/0mH3D3M16p390F0xAfvPNjqlE3ZsxBMG6PsOTnCU3 sA1IFOzEl5J0Ajw4WXWtEft1VLvGBCE= Received: from mx-prod-mc-01.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-445-3JtACFm8MJC4ZpeM-akWdQ-1; Thu, 17 Sep 2026 21:46:28 -0400 X-MC-Unique: 3JtACFm8MJC4ZpeM-akWdQ-1 X-Mimecast-MFC-AGG-ID: 3JtACFm8MJC4ZpeM-akWdQ_1789695985 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7E7DB195FCDE; Fri, 18 Sep 2026 01:46:25 +0000 (UTC) Received: from lcapitul-thinkpadt14gen3.rmtcaqc.csb (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3CD118004D2; Fri, 18 Sep 2026 01:46:21 +0000 (UTC) From: Luiz Capitulino To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org, baolin.wang@linux.alibaba.com, ziy@nvidia.com, lance.yang@linux.dev Cc: corbet@lwn.net, tsbogend@alpha.franken.de, maddy@linux.ibm.com, mpe@ellerman.id.au, agordeev@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, x86@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, hughd@google.com, dave.hansen@linux.intel.com, djbw@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, yintirui@huawei.com, dev.jain@arm.com, usama.arif@linux.dev Subject: [PATCH v8 05/14] drivers: nvdimm: use pgtable_has_pmd_leaves() Date: Thu, 17 Sep 2026 21:45:26 -0400 Message-ID: <55bb106b95979658b9f8e53d0388e84a8c8de90a.1789695931.git.luizcap@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 nd_pfn_supported_alignments() and nd_pfn_default_alignment() use has_transparent_hugepage() to check if THP is supported with PMD-sized pages. Use pgtable_has_pmd_leaves() instead. Also, check for IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) to preserve the current implementation semantics. Acked-by: Zi Yan Signed-off-by: Luiz Capitulino --- drivers/nvdimm/pfn_devs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index 8fa9c16aba7e..457eb54e7ab6 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -94,7 +94,8 @@ static unsigned long *nd_pfn_supported_alignments(unsigned long *alignments) alignments[0] = PAGE_SIZE; - if (has_transparent_hugepage()) { + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && + pgtable_has_pmd_leaves()) { alignments[1] = HPAGE_PMD_SIZE; if (has_transparent_pud_hugepage()) alignments[2] = HPAGE_PUD_SIZE; @@ -109,7 +110,8 @@ static unsigned long *nd_pfn_supported_alignments(unsigned long *alignments) static unsigned long nd_pfn_default_alignment(void) { - if (has_transparent_hugepage()) + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && + pgtable_has_pmd_leaves()) return HPAGE_PMD_SIZE; return PAGE_SIZE; } -- 2.55.0