From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (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 D7A8E34029C for ; Tue, 10 Feb 2026 09:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770715231; cv=none; b=IA3q1Yq2xE/W6LesxKIvYl6MEniJ/OB7iuwiih/gSBfONqI1l2yC6W8c2DbRLFCOS4b+KYukFQlsz3ozVXtA4jjPxqWNfMhSHGoNEo5h7nLtFt7gkuSRnsXSB2MbYGej42rOEovJk6GL5+NefjEVfRdodDmIe9hDGCJPnToWhRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770715231; c=relaxed/simple; bh=FTeTiyYXX811a3Pi6ydIBKHpy2TclFabrxfY/PVEnRQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=U0AsuVE+pmrYpmgFe2BA8rF9n2cMCk0XDSF1MM6quMVsOTTiqU4KjOpjnwVdsc21GUP3LSPVFkmEN3JiWhvQQe6DQrNsgMmnjbDft/6kzMuTxHtLlbsMEGFIVrzxjnQ4xI4/8HECV5TJbjHcAOiLeXI22LDpKeWREFE5s5juHpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=cOOYSZv1; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="cOOYSZv1" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1770715224; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=+RdTK/SFPF7zAPyiMLWbkHB59L5WIFQpZI67N1dwPQ4=; b=cOOYSZv1qLoRVpuxMcioH4Je25y5b+t8KJcaACCS9abW/SUokxRYpxpgo/1EmTjOg9Y2j0ZMsTw7bWb8XTMEX/gFbZH42+St+d0M2IWiHFXDUDFB/KnppxrJhNo2aire3ASgltQDVHBatmJypaiNDP6oTDeCCSVBisrn96Zc5Lg= Received: from 30.74.144.109(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WyyjrVN_1770715223 cluster:ay36) by smtp.aliyun-inc.com; Tue, 10 Feb 2026 17:20:24 +0800 Message-ID: Date: Tue, 10 Feb 2026 17:20:23 +0800 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: [PATCH v2 07/11] mm: shmem: drop has_transparent_hugepage() usage To: Luiz Capitulino , linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com References: <66846ee3aec32c04d20bc7e0e823ba21d4ef278c.1770675272.git.luizcap@redhat.com> From: Baolin Wang In-Reply-To: <66846ee3aec32c04d20bc7e0e823ba21d4ef278c.1770675272.git.luizcap@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/10/26 6:14 AM, Luiz Capitulino wrote: > Shmem performs two kinds of has_transparent_hugepage() usage: > > 1. shmem_parse_one() and shmem_init(): since the calls to > has_transparent_hugepage() are protected by #ifdef > CONFIG_TRANSPARENT_HUGEPAGE, this actually checks if the CPU supports > PMD-sized pages. This is irrelevant for shmem as it supports mTHP > > 2. shmem_parse_huge(): This is checking if THP is enabled and on > architectures that implement has_transparent_hugepage(), this also > checks if the CPU supports PMD-sized pages > > While it's necessary to check if CONFIG_TRANSPARENT_HUGEPAGE is enabled, > shmem can determine mTHP size support at folio allocation time. > Therefore, drop has_transparent_hugepage() usage while keeping the > CONFIG_TRANSPARENT_HUGEPAGE checks. > > Signed-off-by: Luiz Capitulino > --- Looks reasonable to me. Thanks. Reviewed-by: Baolin Wang > mm/shmem.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 79af5f9f8b90..32529586cd78 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -689,7 +689,7 @@ static int shmem_parse_huge(const char *str) > else > return -EINVAL; > > - if (!has_transparent_hugepage() && > + if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && > huge != SHMEM_HUGE_NEVER && huge != SHMEM_HUGE_DENY) > return -EINVAL; > > @@ -4678,8 +4678,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) > case Opt_huge: > ctx->huge = result.uint_32; > if (ctx->huge != SHMEM_HUGE_NEVER && > - !(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && > - has_transparent_hugepage())) > + !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) > goto unsupported_parameter; > ctx->seen |= SHMEM_SEEN_HUGE; > break; > @@ -5463,7 +5462,7 @@ void __init shmem_init(void) > #endif > > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > - if (has_transparent_hugepage() && shmem_huge > SHMEM_HUGE_DENY) > + if (shmem_huge > SHMEM_HUGE_DENY) > SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge; > else > shmem_huge = SHMEM_HUGE_NEVER; /* just in case it was patched */