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 939E623A562 for ; Sun, 3 May 2026 15:02:43 +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=1777820563; cv=none; b=sOGlB90DDmbto3FjHZXh5/q9gEjteoBBeEot6W1xmj0gDLUQ3C5gMXR09cRkLKkIzpq8T5CFkJs2dOCeshhL3C0j+GFCkiKwx0JQ3v9HftBwkUweaAVziL8I6ovm58PkxZjpjwXcZMBsOLmFZ/4zdNU/YrntU+5v3CJo/vRpP3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777820563; c=relaxed/simple; bh=LElIeDOTpHsqNMcDsaQLxB7JqdocbC+VJFujQHOSic0=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=JQSg6tQk4cLhndiP5+/Dt47XkNJmkpQPB81hg9mMI6+WE5a5Xv/BTY7SB81VfclfoUiChUQ7eQOozAQtgyvCoVpRhmqa8zpttloAS8XgZ/j/i7YwZJhQndrDZd9AVOFTM1Cn2MrVTbZcIC42qllJw64Tng/syTmuyPWWI8LiXfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=KjWgS8Yi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="KjWgS8Yi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 589CAC2BCB4; Sun, 3 May 2026 15:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777820563; bh=LElIeDOTpHsqNMcDsaQLxB7JqdocbC+VJFujQHOSic0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KjWgS8Yi09HktsXwEj0X32oeSUm6hFNnKPxjKolb+3/FOZDdFTNBDTcPbjJLfYKD/ jincMbatuAl7HplWQuRJXke29Q+vKGYqaHeYwrOL2RwLPY4owoDj/SuEXK/hVpgUEx pC/N0XL1ZfEIecHsuSgjre8i5C6HfqAIeXWaklVQ= Date: Sun, 3 May 2026 08:02:36 -0700 From: Andrew Morton To: Luiz Capitulino Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org, baolin.wang@linux.alibaba.com, ziy@nvidia.com, lance.yang@linux.dev, 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, dave.hansen@linux.intel.com, djbw@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, lorenzo.stoakes@oracle.com Subject: Re: [PATCH v4 0/9] mm: thp: always enable mTHP support Message-Id: <20260503080236.4ea7f3fec0e5788d50113599@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 1 May 2026 15:18:42 -0400 Luiz Capitulino wrote: > Today, if an architecture implements has_transparent_hugepage() and the CPU > lacks support for PMD-sized pages, the THP code disables all THP, including > mTHP. In addition, the kernel lacks a well defined API to check for > PMD-sized page support. It currently relies on has_transparent_hugepage() > and thp_disabled_by_hw(), but they are not well defined and are tied to > THP support. > > This series addresses both issues by introducing a new well defined API > to query PMD-sized page support: pgtable_has_pmd_leaves(). Using this > new helper, we ensure that mTHP remains enabled even when the > architecture or CPU doesn't support PMD-sized pages. > > Thanks to David Hildenbrand for suggesting this improvement and for > providing guidance (all bugs and misconceptions are mine). > > This applies to Linus tree 08d0d3466664 ("Merge tag 'net-7.1-rc2' > of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net") > > NOTE: I used Claude Code Opus 4.6 to *review* the series before > posting. It did find one issue where a pgtable_has_pmd_leaves() > check was missing when assining huge_shmem_orders_inherit in > shmem_init(). Thanks. Sashiko found a few other things to ask about: https://sashiko.dev/#/patchset/cover.1777663129.git.luizcap@redhat.com