From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) (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 7BEFD3FB7D4 for ; Wed, 3 Jun 2026 07:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780471444; cv=none; b=KU48tacEhSipO17PwfheT7m3ZOXSbGcs7Cf4vBLbEcjSX7IgzOl1BzyC/k3P0LyjVPWDAMWNAFwRHFJw3aLjKA/jz33u5s9J0/k/ePidYe46P2RZXdjvUF+i/6/wtn4xARhkUWETohFa0WcxDhL8vgGyMMkXFnEXw6qD88vovl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780471444; c=relaxed/simple; bh=QCkH1LYNDukCFy6vYX9YJ+TrBui976aZLERlunGzOos=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VOfyBqRiK7rhOGr34ILUNm3yvxN87kX9wrIZBcNFCK42EtPcYb+MhOGDtPEIFY+tjyJo/PK3X7/H3QhoKpcK+I1jQKOQyX8kIwneo/Nah9ZXztVEPW3NC8qxeUnFPHIVJtgP9lgXoF5BZWtSjuAZhtNdBp/gUL90X+dNntMgncg= 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=rvxlpmv/; arc=none smtp.client-ip=115.124.30.99 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="rvxlpmv/" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1780471434; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=3E2ed+XTGVkEd6ShRY49ghkqvXsVF9PM70tqHDvZywg=; b=rvxlpmv/SEaoCYHBhyS4lq7Jr5/7K0uzcRFqjlhu+DCrm57gaYggEk4Orbdo2fND26yypeWvU2UefhihHh5o5Ixng2o1TJ2Q2b5pNdbxuE/Z2n3cNsehAdHemzmyQfH+xJonNHKFQEi6bzZg0w+LJBatV7/76Wbmuy/Eu5RtDY0= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=27;SR=0;TI=SMTPD_---0X46kSRU_1780471430; Received: from 30.74.144.129(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X46kSRU_1780471430 cluster:ay36) by smtp.aliyun-inc.com; Wed, 03 Jun 2026 15:23:52 +0800 Message-ID: <2132b0a3-1085-47cb-95ca-3aaa7f8ed44b@linux.alibaba.com> Date: Wed, 3 Jun 2026 15:23:49 +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 v5 14/14] mm: thp: always enable mTHP support To: Lance Yang , luizcap@redhat.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org, ziy@nvidia.com, 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, ira.weiny@intel.com, 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, ljs@kernel.org References: <8781a9a0f115705ee11884ed3184b65a1ce39923.1780066530.git.luizcap@redhat.com> <20260603064718.81699-1-lance.yang@linux.dev> From: Baolin Wang In-Reply-To: <20260603064718.81699-1-lance.yang@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/3/26 2:47 PM, Lance Yang wrote: > Hi Luiz, > > SHMEM_HUGE_FORCE still assumes PMD order in a few places. > > Is that expected? > > shmem_init() only sets the default inherit mask when PMD leaves are > available. > > if (!shmem_orders_configured && pgtable_has_pmd_leaves()) > huge_shmem_orders_inherit = BIT(HPAGE_PMD_ORDER); > > But shmem_parse_huge() rejects "force" unless the mask is exactly PMD > order. > > if (huge == SHMEM_HUGE_FORCE && > huge_shmem_orders_inherit != BIT(HPAGE_PMD_ORDER)) > return -EINVAL; > > Even if "force" is selected, shmem_huge_global_enabled() still return > only PMD order. > > if (shmem_huge_force || shmem_huge == SHMEM_HUGE_FORCE) > return maybe_pmd_order; > > and shmem_allowable_huge_orders() mask it out. > > if (!pgtable_has_pmd_leaves()) > disabled_orders = BIT(PMD_ORDER); > > if (!vma || !vma_is_anon_shmem(vma)) > return global_orders & ~disabled_orders; > > For anon shmem, it can also return 0 for same reason. > > if (shmem_huge == SHMEM_HUGE_FORCE) > return READ_ONCE(huge_shmem_orders_inherit) & ~disabled_orders; > > Should SHMEM_HUGE_FORCE use the available mTHP orders below PMD when > pgtable_has_pmd_leaves() is false? No. That's exactly the strategy we agreed on after lots of discussion: 1. The options 'force' and 'deny' are dropped for mTHP interfaces, which are rather testing artifacts from the old ages. 2. If top level value is 'force', then only PMD-sized hugepages have enabled="inherit", otherwise configuration will be failed and vice versa. You can check commit 4b98995530b7 ("mm: shmem: add multi-size THP sysfs interface for anonymous shmem") for more information.