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.133.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 EDD7F35AC2B for ; Wed, 8 Apr 2026 20:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775680366; cv=none; b=m7cnYd1N6tBz9DFajw15bRpYyYRv6r3S5JH1LSZ3r9emx4DF4oWxr7Ig0UrqXyRZjTRzx9fRUhgzypSyepv7hDpGXgzky8quycOLvn9H2vQhNrXVmRNvcqsLOztkY1YfnTym5ybHJwsiopAL0A6SORrF3LXnUvUdauv470URrpU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775680366; c=relaxed/simple; bh=xOZVwHJmoy7VXYUgr5XWwxy4RInRQKuOG5CnjwZqOkg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pSbsHoeQI9cTzdoDWraaxGLgKUZVtIjxBuSu9ajF+f3KCAn6vktsHWm0mAGeMaQA8ZQu+jyimCfRmZ0QmgW/k6m1EnoF3HHRdQyE12njmHZlUl43v08O//PtI6SXtw1nmwRU3TswjhEKWfjhpMH/fh6pGrgC9yxJgfAm078Yyv0= 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=SKx7QmI2; arc=none smtp.client-ip=170.10.133.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="SKx7QmI2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775680363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ULRpodXrow7zLF+YDro1qvSbuWG8byri0/OE4j9CLPs=; b=SKx7QmI2RGnscn1xlV05aaULZMsx+yVvvdZIN45s8EscHvVJyGnl1g0s6uosLB/aby1d1s iJiJTJEDqyurjBjjfWwRc/9NgwPqFXM+nJGBzL+r7q9Rr6y/0U6tc8cBQGdrmKZEm64rIb gar7QuRpCU2V8SmkcCrg87iNlfS3M0E= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-676-_cUoxl86OzqS_o2nw1uzjg-1; Wed, 08 Apr 2026 16:32:42 -0400 X-MC-Unique: _cUoxl86OzqS_o2nw1uzjg-1 X-Mimecast-MFC-AGG-ID: _cUoxl86OzqS_o2nw1uzjg_1775680362 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-89ce2a7fef6so6745316d6.1 for ; Wed, 08 Apr 2026 13:32:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775680362; x=1776285162; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ULRpodXrow7zLF+YDro1qvSbuWG8byri0/OE4j9CLPs=; b=tKd3r7TKofZSq/ncCxFiC7BgyhP9WjdCB4qPRxo4AnNP90mpqFZxPFRMwklnIAjtSc Jbo+JFxah3IAA++BsdZ/ubpbbSzRfjz40LRVu8sHTkEu7l+i9bNuwI6jVpKrRgT7+bo7 wzWTJgIO/7Zo9FGDsAq0nCXB+6MUgdj8g2j+3zVw9bnMiTBIG2U1LEKFaFx1ZITO+p1x HwLILMUFG8TSLN3urChf9cLE87wGs8PpzTs0W2WRIfm+0gpSbDi3h5cOhB1UjT50dw8F kPxKNDOCabVR4IgC7q8z3aSFlE7kkbqZwPgzxkVBRWqYRKLUaf8YiL+/qF6zPAJdOVqb 1cHw== X-Forwarded-Encrypted: i=1; AJvYcCXh04H0Uv8+f9HS3a8i5Qjg0nc17yZGSFRgmAM7pCFjt/o0B56F3tNyaVuAySxSWRJXfQ2V0cJCS2p4MFo=@vger.kernel.org X-Gm-Message-State: AOJu0YxbtHw1qD55psJn+W1Ux+9EKQaamh7rj/JfPpgeo+9LrXLF333U ibqAbykeJcjqNrQX1iNMxQP2Fh45NTujYuFUBIHOitaivJpPNFLj/nwx8IfhdYmZQcZhKQLYJ8h yKUisTBtCfI2UZlHxPfc1lEmSVjiwVrWzt3iTM9zrgeMxdIpsKk1JjhtG4w5O7JORog== X-Gm-Gg: AeBDiet0EBfzOdEJZpm3q0bVu1Wve1sj7+pyRutIZmVpCa5dP3ZPiK17TC4Vw4ORtR6 XYKvQXq+JGSxyC1MMbDguD5H65mQ/u5iDnAGYy4E7n8qK/XiJHBSCU1TI1CvDWmbsPVelqYLS3j TouVL+C5TCffsGBGjDrvrWm7OWihdkX06a5gOwYiL9U3aNd/BL1kRWkjlkqUzt4tnLYRTbD4w77 a/2dofinexWE8zrK1yAsTbHGc9TTdHHw9/DIbu3biq6u9vOegIHlnd+QlHcJ9nvlsCbgfnEzUp0 YXbuL+VLxw8cX2jldL4AUsCLtfQ6XqXJtOcsQ3M9p/lHY29u485MkywfaTXVzOOt1fXm4FdAnFI 8yFzIzDx+8l5rEhyTjVojthZNrg== X-Received: by 2002:a05:6214:5c82:b0:8a0:f8b7:391d with SMTP id 6a1803df08f44-8a7042f27cdmr307415106d6.31.1775680362225; Wed, 08 Apr 2026 13:32:42 -0700 (PDT) X-Received: by 2002:a05:6214:5c82:b0:8a0:f8b7:391d with SMTP id 6a1803df08f44-8a7042f27cdmr307414636d6.31.1775680361799; Wed, 08 Apr 2026 13:32:41 -0700 (PDT) Received: from [192.168.2.110] ([69.159.169.238]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8a5974e8e8esm182785836d6.43.2026.04.08.13.32.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Apr 2026 13:32:41 -0700 (PDT) Message-ID: <89fb16bc-5075-4102-bf6c-cdaeda07a211@redhat.com> Date: Wed, 8 Apr 2026 16:32:30 -0400 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: Baolin Wang , 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> Content-Language: en-US, en-CA From: Luiz Capitulino In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026-02-10 04:20, Baolin Wang wrote: > > > 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 Thanks for your review. I didn't add your reviewed-by tag because I updated the changelog. Also, sorry for the delay in resume my work on this series. > >> 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 */ >