From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (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 598A9347C6 for ; Tue, 16 Dec 2025 07:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.118 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765871535; cv=none; b=mMHqUsM7IJUDTrI8zXGcfU6exUQIc2FNq0djKTwGPHM53ylklzkNlHeCttbzNhM+fGiZPtpWrl4muuxF4lZ4P8+EF4Bu674v71g3AZATQTzZDRTZwLiIQOVEbZfajzuYEZ3EKzh4mJrsZg3BTLukpaGvxQAnTTUlt4hx1NuaIQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765871535; c=relaxed/simple; bh=ZGKmJ+OXjyLdV3sVaCZw3zQXLL74CkSoI1XKyz1QXpo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Q1J3TcGruduvDYXTbOMIityNGmH97uZtFNzSTEOy/9uFUG307CYVM7QMdmd28CrBtoZNx9FdCFDBT/qZTNmOYO2xq/1kTTl6YCa5rWDIabkA7qa/dh/PQiv4TOdkceqRXbj5rhYgI29c+cuzyZ4Yv4l6FCGxaJbJk4sINYOO1Dc= 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=Z3mCyKRl; arc=none smtp.client-ip=115.124.30.118 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="Z3mCyKRl" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1765871530; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=ad//iqxbWcgpgqeu9AInRK2mrKIq6ZRYX/gSgmF/jAs=; b=Z3mCyKRlAsz5g1r3wsihv5YQ2Sco6v9EWANwsovp1MppBCGWFjoA8jF2a5OpKUWQH9iuV9AzhwsAvygcfh7lZAZJUGoLLkCwn0unkGdxeJqdIs2UZYjmn7tPtcyAGFObaLy3iNuxKCxCEVYeSJT3n3EvN92B+NcwlWH4gNnDIqc= Received: from 30.74.144.116(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WuyV.-5_1765871529 cluster:ay36) by smtp.aliyun-inc.com; Tue, 16 Dec 2025 15:52:09 +0800 Message-ID: Date: Tue, 16 Dec 2025 15:52:09 +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 07/11] mm: shmem: use pgtable_has_pmd_leaves() 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: From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025/12/16 05:16, Luiz Capitulino wrote: > Shmem uses has_transparent_hugepage() to check if PMD-sized pages are > supported, use pgtable_has_pmd_leaves() instead. > > Signed-off-by: Luiz Capitulino > --- > mm/shmem.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index b329b5302c48..ad5825667b49 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -689,7 +689,8 @@ static int shmem_parse_huge(const char *str) > else > return -EINVAL; > > - if (!has_transparent_hugepage() && > + if (!(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && > + pgtable_has_pmd_leaves()) && > huge != SHMEM_HUGE_NEVER && huge != SHMEM_HUGE_DENY) > return -EINVAL; > > @@ -4655,7 +4656,7 @@ static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) > ctx->huge = result.uint_32; > if (ctx->huge != SHMEM_HUGE_NEVER && > !(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && > - has_transparent_hugepage())) > + pgtable_has_pmd_leaves())) > goto unsupported_parameter; > ctx->seen |= SHMEM_SEEN_HUGE; > break; > @@ -5439,7 +5440,7 @@ void __init shmem_init(void) > #endif > > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > - if (has_transparent_hugepage() && shmem_huge > SHMEM_HUGE_DENY) > + if (pgtable_has_pmd_leaves() && shmem_huge > SHMEM_HUGE_DENY) Using pgtable_has_pmd_leaves() here is a bit confusing because the definition of pgtable_has_pmd_leaves() is: it returns true if the CPU supports PMD-sized pages and false otherwise. However, tmpfs and shmem already support other sizes of large folios, not just PMD-sized large folios. So, for me, using has_transparent_hugepage() to check would be at least clearer (even though it doesn't change the functionality).