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 9E86B1A9FBA for ; Thu, 16 Apr 2026 01:05:04 +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=1776301506; cv=none; b=kSIzJgb67K4C6kELRskkuM4zSEzYoWe8+x6t2W5eZnRk4wKUFDipiYoW9iI/a+1ScKEuT48tRXchMnaFy29KtXEA44pwnSdCkNnH6fJHg6HGmqy7LhzZI39GxKKHUWKaKJHLnb6nxiWl+/YMcQ58sngCvT0WWr/d9dkYtr8jpFg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776301506; c=relaxed/simple; bh=+BSIKGCB3ySTJ7GTBGoH3ryNqFOuNd307fbVloYChfU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Uq2h89c4GoprbBi5Wh7pb2UMXH1kcXuCaYJZ1pbt2PECMA1BliNjgXo7HLMR2WnaY4s9y+0NnjUnF3In+8zsn76ORyZSkyrKtN3dmUEqhBYKYOrzFcNMBaBFi12nfXGE69oodzvQI5qUllUxK8sDErkP4YWjmkzGGCsk8sLKcnE= 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=ZyECTbxY; 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="ZyECTbxY" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1776301502; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=KhCUtwnuwXWKHBNoQctAn5OfOaLasJOFejmyE9cNMfY=; b=ZyECTbxYksTUWV05wZZJer3+Rf/6DA7cQSJnwKRQn0VfatsRpbpih9mbUwIqsy11qCFVkSSCbTyujzaouV4Hivt/lxf7Cb+KNWEqxc/oZupvfXTktTRcHB/a+koYGvoUTO0D0Gwfg1gbd8iZLf2h1gaaoT/JP7EaeQD9Y06t8Lg= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0X162pFv_1776301501; Received: from 30.74.144.131(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X162pFv_1776301501 cluster:ay36) by smtp.aliyun-inc.com; Thu, 16 Apr 2026 09:05:01 +0800 Message-ID: Date: Thu, 16 Apr 2026 09:05:01 +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] mm: shmem: don't set large-order range for internal shmem mount To: "David Hildenbrand (Arm)" , akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, ziy@nvidia.com, ljs@kernel.org, lance.yang@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <2d138a3f-0006-4a01-852a-4570d7ba781d@linux.alibaba.com> <1a3cb6b2-94e0-4268-8cd9-1f9a9deb6c6b@linux.alibaba.com> <875dc63b-0cd2-49e5-8b0d-3fb062789813@kernel.org> From: Baolin Wang In-Reply-To: <875dc63b-0cd2-49e5-8b0d-3fb062789813@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 4/15/26 10:36 PM, David Hildenbrand (Arm) wrote: > On 4/15/26 12:05, Baolin Wang wrote: >> >> >> On 4/15/26 5:54 PM, David Hildenbrand (Arm) wrote: >>>> >>>> Yes, that makes sense. >>>> >>>> However, it’s also possible that the mapping does not support large >>>> folios, yet anonymous shmem can still allocate large folios via the >>>> sysfs interfaces. That doesn't make sense, right? >>> >>> That's what I am saying: if there could be large folios in there, then >>> let's tell the world. >>> >>> Getting in a scenario where the mapping claims to not support large >>> folios, but then we have large folios in there is inconsistent, not? >>> >>> [...] >>> >>>> >>>> For the current anonymous shmem (tmpfs is already clear, no questions), >>>> I don’t think there will be any "will never have/does never allow" >>>> cases, because it can be changed dynamically via the sysfs interfaces. >>> >>> Right. It's about non-anon shmem with huge=off. >>> >>>> >>>> If we still want that logic, then for anonymous shmem we can treat it as >>>> always "might have large folios". >> >> OK. To resolve the confusion about 1, the logic should be changed as >> follows. Does that make sense to you? >> >> if (sbinfo->huge || (sb->s_flags & SB_KERNMOUNT)) >>     mapping_set_large_folios(inode->i_mapping); > > I think that's better. Thanks for your valuable input. But has Willy says, maybe we can just > unconditionally set it and have it even simpler. However, for tmpfs mounts, we should still respect the 'huge=' mount option. See commit 5a90c155defa ("tmpfs: don't enable large folios if not supported").