Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "tmpfs: don't enable large folios if not supported"
@ 2026-04-23  1:41 Baolin Wang
  2026-04-23  2:37 ` Zi Yan
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Baolin Wang @ 2026-04-23  1:41 UTC (permalink / raw)
  To: akpm, hughd
  Cc: willy, ziy, david, ljs, lance.yang, wangkefeng.wang, baolin.wang,
	linux-mm, linux-kernel

This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.

Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
determine whether the shmem mount supports large folios. However, for anonymous
shmem, whether it supports large folios can be dynamically configured via sysfs
interfaces, so setting or not setting mapping_set_large_folios() during initialization
cannot accurately reflect whether anonymous shmem actually supports large folios,
which has already caused some confusion[1].

Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
setting consistent across all mappings in the entire tmpfs mount. In other words,
under the same tmpfs mount, after remount, we might end up with some mappings
supporting large folios (calling mapping_set_large_folios()) while others don't.

After some investigation, I found that the write performance regression addressed
by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
("filemap: move prefaulting out of hot write path"). See the following test data:

Base:
dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)

Base + revert 5a90c155defa:
dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)

The data is basically consistent with minor fluctuation noise. So we can now
safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
shmem mounts unconditionally.

[1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
Note: for more investigation and test data, see:
https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
Thanks Kefeng for confirming the performance issue.
---
 mm/shmem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 4ecefe02881d..dafbea53b22d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3087,10 +3087,7 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap,
 	cache_no_acl(inode);
 	if (sbinfo->noswap)
 		mapping_set_unevictable(inode->i_mapping);
-
-	/* Don't consider 'deny' for emergencies and 'force' for testing */
-	if (sbinfo->huge)
-		mapping_set_large_folios(inode->i_mapping);
+	mapping_set_large_folios(inode->i_mapping);
 
 	switch (mode & S_IFMT) {
 	default:
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
@ 2026-04-23  2:37 ` Zi Yan
  2026-04-23  2:46 ` Kefeng Wang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Zi Yan @ 2026-04-23  2:37 UTC (permalink / raw)
  To: Baolin Wang
  Cc: akpm, hughd, willy, david, ljs, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel

On 22 Apr 2026, at 21:41, Baolin Wang wrote:

> This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
>
> Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
> determine whether the shmem mount supports large folios. However, for anonymous
> shmem, whether it supports large folios can be dynamically configured via sysfs
> interfaces, so setting or not setting mapping_set_large_folios() during initialization
> cannot accurately reflect whether anonymous shmem actually supports large folios,
> which has already caused some confusion[1].
>
> Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
> setting consistent across all mappings in the entire tmpfs mount. In other words,
> under the same tmpfs mount, after remount, we might end up with some mappings
> supporting large folios (calling mapping_set_large_folios()) while others don't.
>
> After some investigation, I found that the write performance regression addressed
> by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
> ("filemap: move prefaulting out of hot write path"). See the following test data:
>
> Base:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
> dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
> Base + revert 5a90c155defa:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
> The data is basically consistent with minor fluctuation noise. So we can now
> safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
> shmem mounts unconditionally.
>
> [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> Note: for more investigation and test data, see:
> https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
> Thanks Kefeng for confirming the performance issue.
> ---
>  mm/shmem.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
Thank you for the investigation and explanation.

Acked-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
  2026-04-23  2:37 ` Zi Yan
@ 2026-04-23  2:46 ` Kefeng Wang
  2026-04-23  2:57 ` Lance Yang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Kefeng Wang @ 2026-04-23  2:46 UTC (permalink / raw)
  To: Baolin Wang, akpm, hughd
  Cc: willy, ziy, david, ljs, lance.yang, linux-mm, linux-kernel



On 4/23/2026 9:41 AM, Baolin Wang wrote:
> This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
> 
> Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
> determine whether the shmem mount supports large folios. However, for anonymous
> shmem, whether it supports large folios can be dynamically configured via sysfs
> interfaces, so setting or not setting mapping_set_large_folios() during initialization
> cannot accurately reflect whether anonymous shmem actually supports large folios,
> which has already caused some confusion[1].
> 
> Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
> setting consistent across all mappings in the entire tmpfs mount. In other words,
> under the same tmpfs mount, after remount, we might end up with some mappings
> supporting large folios (calling mapping_set_large_folios()) while others don't.
> 
> After some investigation, I found that the write performance regression addressed
> by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
> ("filemap: move prefaulting out of hot write path"). See the following test data:
> 
> Base:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
> dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
> 
> Base + revert 5a90c155defa:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
> 
> The data is basically consistent with minor fluctuation noise. So we can now
> safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
> shmem mounts unconditionally.


> 
> [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> Note: for more investigation and test data, see:
> https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
> Thanks Kefeng for confirming the performance issue.

LGTM, Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>

> ---
>   mm/shmem.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 4ecefe02881d..dafbea53b22d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3087,10 +3087,7 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap,
>   	cache_no_acl(inode);
>   	if (sbinfo->noswap)
>   		mapping_set_unevictable(inode->i_mapping);
> -
> -	/* Don't consider 'deny' for emergencies and 'force' for testing */
> -	if (sbinfo->huge)
> -		mapping_set_large_folios(inode->i_mapping);
> +	mapping_set_large_folios(inode->i_mapping);
>   
>   	switch (mode & S_IFMT) {
>   	default:



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
  2026-04-23  2:37 ` Zi Yan
  2026-04-23  2:46 ` Kefeng Wang
@ 2026-04-23  2:57 ` Lance Yang
  2026-04-23 13:20 ` David Hildenbrand (Arm)
  2026-05-05 10:46 ` Lorenzo Stoakes
  4 siblings, 0 replies; 13+ messages in thread
From: Lance Yang @ 2026-04-23  2:57 UTC (permalink / raw)
  To: baolin.wang
  Cc: akpm, hughd, willy, ziy, david, ljs, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel


On Thu, Apr 23, 2026 at 09:41:42AM +0800, Baolin Wang wrote:
>This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
>
>Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
>determine whether the shmem mount supports large folios. However, for anonymous
>shmem, whether it supports large folios can be dynamically configured via sysfs
>interfaces, so setting or not setting mapping_set_large_folios() during initialization
>cannot accurately reflect whether anonymous shmem actually supports large folios,
>which has already caused some confusion[1].
>
>Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
>setting consistent across all mappings in the entire tmpfs mount. In other words,
>under the same tmpfs mount, after remount, we might end up with some mappings
>supporting large folios (calling mapping_set_large_folios()) while others don't.
>
>After some investigation, I found that the write performance regression addressed
>by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
>("filemap: move prefaulting out of hot write path"). See the following test data:
>
>Base:
>dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
>dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
>Base + revert 5a90c155defa:
>dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
>dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
>The data is basically consistent with minor fluctuation noise. So we can now
>safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
>shmem mounts unconditionally.
>
>[1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
>Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>---
>Note: for more investigation and test data, see:
>https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
>Thanks Kefeng for confirming the performance issue.
>---

Thanks for tackling this!

Reviewed-by: Lance Yang <lance.yang@linux.dev>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
                   ` (2 preceding siblings ...)
  2026-04-23  2:57 ` Lance Yang
@ 2026-04-23 13:20 ` David Hildenbrand (Arm)
  2026-04-26  5:55   ` Baolin Wang
  2026-05-05 10:46 ` Lorenzo Stoakes
  4 siblings, 1 reply; 13+ messages in thread
From: David Hildenbrand (Arm) @ 2026-04-23 13:20 UTC (permalink / raw)
  To: Baolin Wang, akpm, hughd
  Cc: willy, ziy, ljs, lance.yang, wangkefeng.wang, linux-mm,
	linux-kernel

On 4/23/26 03:41, Baolin Wang wrote:
> This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
> 
> Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
> determine whether the shmem mount supports large folios. However, for anonymous
> shmem, whether it supports large folios can be dynamically configured via sysfs
> interfaces, so setting or not setting mapping_set_large_folios() during initialization
> cannot accurately reflect whether anonymous shmem actually supports large folios,
> which has already caused some confusion[1].
> 
> Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
> setting consistent across all mappings in the entire tmpfs mount. In other words,
> under the same tmpfs mount, after remount, we might end up with some mappings
> supporting large folios (calling mapping_set_large_folios()) while others don't.
> 
> After some investigation, I found that the write performance regression addressed
> by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
> ("filemap: move prefaulting out of hot write path"). See the following test data:
> 
> Base:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
> dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
> 
> Base + revert 5a90c155defa:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
> 
> The data is basically consistent with minor fluctuation noise. So we can now
> safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
> shmem mounts unconditionally.
> 
> [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> Note: for more investigation and test data, see:
> https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/


Maybe add that as

Link: https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/

above?


Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23 13:20 ` David Hildenbrand (Arm)
@ 2026-04-26  5:55   ` Baolin Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Baolin Wang @ 2026-04-26  5:55 UTC (permalink / raw)
  To: David Hildenbrand (Arm), akpm, hughd
  Cc: willy, ziy, ljs, lance.yang, wangkefeng.wang, linux-mm,
	linux-kernel



On 4/23/26 9:20 PM, David Hildenbrand (Arm) wrote:
> On 4/23/26 03:41, Baolin Wang wrote:
>> This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
>>
>> Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
>> determine whether the shmem mount supports large folios. However, for anonymous
>> shmem, whether it supports large folios can be dynamically configured via sysfs
>> interfaces, so setting or not setting mapping_set_large_folios() during initialization
>> cannot accurately reflect whether anonymous shmem actually supports large folios,
>> which has already caused some confusion[1].
>>
>> Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
>> setting consistent across all mappings in the entire tmpfs mount. In other words,
>> under the same tmpfs mount, after remount, we might end up with some mappings
>> supporting large folios (calling mapping_set_large_folios()) while others don't.
>>
>> After some investigation, I found that the write performance regression addressed
>> by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
>> ("filemap: move prefaulting out of hot write path"). See the following test data:
>>
>> Base:
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>>
>> Base + revert 5a90c155defa:
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
>> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>>
>> The data is basically consistent with minor fluctuation noise. So we can now
>> safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
>> shmem mounts unconditionally.
>>
>> [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>> ---
>> Note: for more investigation and test data, see:
>> https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
> 
> 
> Maybe add that as
> 
> Link: https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
> 
> above?

Sure. And I noticed that Andrew has already helped add this link. Thanks 
Andrew!

> Acked-by: David Hildenbrand (Arm) <david@kernel.org>

Thanks.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
                   ` (3 preceding siblings ...)
  2026-04-23 13:20 ` David Hildenbrand (Arm)
@ 2026-05-05 10:46 ` Lorenzo Stoakes
  2026-05-05 10:47   ` Lorenzo Stoakes
  4 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Stoakes @ 2026-05-05 10:46 UTC (permalink / raw)
  To: Baolin Wang
  Cc: akpm, hughd, willy, ziy, david, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel

On Thu, Apr 23, 2026 at 09:41:42AM +0800, Baolin Wang wrote:
> This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c.
>
> Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' to
> determine whether the shmem mount supports large folios. However, for anonymous
> shmem, whether it supports large folios can be dynamically configured via sysfs
> interfaces, so setting or not setting mapping_set_large_folios() during initialization
> cannot accurately reflect whether anonymous shmem actually supports large folios,
> which has already caused some confusion[1].
>
> Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_set_large_folios()
> setting consistent across all mappings in the entire tmpfs mount. In other words,
> under the same tmpfs mount, after remount, we might end up with some mappings
> supporting large folios (calling mapping_set_large_folios()) while others don't.
>
> After some investigation, I found that the write performance regression addressed
> by commit 5a90c155defa has already been fixed by the following commit 665575cff098b
> ("filemap: move prefaulting out of hot write path"). See the following test data:
>
> Base:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s )
> dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
> Base + revert 5a90c155defa:
> dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s)
> dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s)
>
> The data is basically consistent with minor fluctuation noise. So we can now
> safely revert commit 5a90c155defa to set mapping_set_large_folios() for all
> shmem mounts unconditionally.
>
> [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.alibaba.com/
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Acked-by: Lorenzo Stoakes <ljs@kernel.org>

As David asked, should we have a Fixes tag? What about cc: stable?

Cheers, Lorenzo

> ---
> Note: for more investigation and test data, see:
> https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/
> Thanks Kefeng for confirming the performance issue.
> ---
>  mm/shmem.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 4ecefe02881d..dafbea53b22d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3087,10 +3087,7 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap,
>  	cache_no_acl(inode);
>  	if (sbinfo->noswap)
>  		mapping_set_unevictable(inode->i_mapping);
> -
> -	/* Don't consider 'deny' for emergencies and 'force' for testing */
> -	if (sbinfo->huge)
> -		mapping_set_large_folios(inode->i_mapping);
> +	mapping_set_large_folios(inode->i_mapping);
>
>  	switch (mode & S_IFMT) {
>  	default:
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-05 10:46 ` Lorenzo Stoakes
@ 2026-05-05 10:47   ` Lorenzo Stoakes
  2026-05-06  8:58     ` Baolin Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Stoakes @ 2026-05-05 10:47 UTC (permalink / raw)
  To: Baolin Wang
  Cc: akpm, hughd, willy, ziy, david, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel

On Tue, May 05, 2026 at 11:46:11AM +0100, Lorenzo Stoakes wrote:
> Acked-by: Lorenzo Stoakes <ljs@kernel.org>
>
> As David asked, should we have a Fixes tag? What about cc: stable?

Oh he mentioned link :P yes that too ;)

>
> Cheers, Lorenzo
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-05 10:47   ` Lorenzo Stoakes
@ 2026-05-06  8:58     ` Baolin Wang
  2026-05-11 12:03       ` Lorenzo Stoakes
  0 siblings, 1 reply; 13+ messages in thread
From: Baolin Wang @ 2026-05-06  8:58 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: akpm, hughd, willy, ziy, david, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel



On 5/5/26 6:47 PM, Lorenzo Stoakes wrote:
> On Tue, May 05, 2026 at 11:46:11AM +0100, Lorenzo Stoakes wrote:
>> Acked-by: Lorenzo Stoakes <ljs@kernel.org>
>>
>> As David asked, should we have a Fixes tag? What about cc: stable?

Sure. But this fix tag depends on the commit 665575cff098b, so the fixes 
tag should be:

Fixes: 5a90c155defa ("tmpfs: don't enable large folios if not supported")
Depends-on: 665575cff098b ("filemap: move prefaulting out of hot write 
path").

I don't think we need to cc stable, as it doesn't appear to cause any 
serious issues currently.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-06  8:58     ` Baolin Wang
@ 2026-05-11 12:03       ` Lorenzo Stoakes
  2026-05-11 22:01         ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Stoakes @ 2026-05-11 12:03 UTC (permalink / raw)
  To: Baolin Wang
  Cc: akpm, hughd, willy, ziy, david, lance.yang, wangkefeng.wang,
	linux-mm, linux-kernel

On Wed, May 06, 2026 at 04:58:20PM +0800, Baolin Wang wrote:
>
>
> On 5/5/26 6:47 PM, Lorenzo Stoakes wrote:
> > On Tue, May 05, 2026 at 11:46:11AM +0100, Lorenzo Stoakes wrote:
> > > Acked-by: Lorenzo Stoakes <ljs@kernel.org>
> > >
> > > As David asked, should we have a Fixes tag? What about cc: stable?
>
> Sure. But this fix tag depends on the commit 665575cff098b, so the fixes tag
> should be:
>
> Fixes: 5a90c155defa ("tmpfs: don't enable large folios if not supported")
> Depends-on: 665575cff098b ("filemap: move prefaulting out of hot write
> path").

Oh is Depends-on a tag? Wasn't aware of it :>)

>
> I don't think we need to cc stable, as it doesn't appear to cause any
> serious issues currently.

Ack ok!

Cheers, Lorenzo


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-11 12:03       ` Lorenzo Stoakes
@ 2026-05-11 22:01         ` Andrew Morton
  2026-05-12  0:55           ` Baolin Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Morton @ 2026-05-11 22:01 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Baolin Wang, hughd, willy, ziy, david, lance.yang,
	wangkefeng.wang, linux-mm, linux-kernel

On Mon, 11 May 2026 13:03:04 +0100 Lorenzo Stoakes <ljs@kernel.org> wrote:

> On Wed, May 06, 2026 at 04:58:20PM +0800, Baolin Wang wrote:
> >
> >
> > On 5/5/26 6:47 PM, Lorenzo Stoakes wrote:
> > > On Tue, May 05, 2026 at 11:46:11AM +0100, Lorenzo Stoakes wrote:
> > > > Acked-by: Lorenzo Stoakes <ljs@kernel.org>
> > > >
> > > > As David asked, should we have a Fixes tag? What about cc: stable?
> >
> > Sure. But this fix tag depends on the commit 665575cff098b, so the fixes tag
> > should be:
> >
> > Fixes: 5a90c155defa ("tmpfs: don't enable large folios if not supported")
> > Depends-on: 665575cff098b ("filemap: move prefaulting out of hot write
> > path").
> 
> Oh is Depends-on a tag? Wasn't aware of it :>)

It is not.

hp2:/usr/src/25> grep -ri Depends-on Documentation | wc -l 
0

But it is!

hp2:/usr/src/25> grep -ri Depends-on ../gitlog | wc -l    
156

I actually removed it because a) various tools whine at me and b) we
didn't cc:stable anyway.

Please let's not add new metadata without having told others what that
metadata means?

"Fixes:" should be sufficient.  I interpret Fixes: as "apply this to any
kernel which contains <that>".  Is more needed?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-11 22:01         ` Andrew Morton
@ 2026-05-12  0:55           ` Baolin Wang
  2026-05-12  1:15             ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Baolin Wang @ 2026-05-12  0:55 UTC (permalink / raw)
  To: Andrew Morton, Lorenzo Stoakes
  Cc: hughd, willy, ziy, david, lance.yang, wangkefeng.wang, linux-mm,
	linux-kernel



On 5/12/26 6:01 AM, Andrew Morton wrote:
> On Mon, 11 May 2026 13:03:04 +0100 Lorenzo Stoakes <ljs@kernel.org> wrote:
> 
>> On Wed, May 06, 2026 at 04:58:20PM +0800, Baolin Wang wrote:
>>>
>>>
>>> On 5/5/26 6:47 PM, Lorenzo Stoakes wrote:
>>>> On Tue, May 05, 2026 at 11:46:11AM +0100, Lorenzo Stoakes wrote:
>>>>> Acked-by: Lorenzo Stoakes <ljs@kernel.org>
>>>>>
>>>>> As David asked, should we have a Fixes tag? What about cc: stable?
>>>
>>> Sure. But this fix tag depends on the commit 665575cff098b, so the fixes tag
>>> should be:
>>>
>>> Fixes: 5a90c155defa ("tmpfs: don't enable large folios if not supported")
>>> Depends-on: 665575cff098b ("filemap: move prefaulting out of hot write
>>> path").
>>
>> Oh is Depends-on a tag? Wasn't aware of it :>)
> 
> It is not.
> 
> hp2:/usr/src/25> grep -ri Depends-on Documentation | wc -l
> 0
> 
> But it is!
> 
> hp2:/usr/src/25> grep -ri Depends-on ../gitlog | wc -l
> 156
> 
> I actually removed it because a) various tools whine at me and b) we
> didn't cc:stable anyway.

Okay, I remember I've seen that tag :)

> 
> Please let's not add new metadata without having told others what that
> metadata means?
> 
> "Fixes:" should be sufficient.  I interpret Fixes: as "apply this to any
> kernel which contains <that>".  Is more needed?

My concern is that if someone backports this patch to an older kernel 
version without also backporting commit 665575cff098b, it would cause a 
performance regression.

Is there a good way to mark this kind of dependency on another patch? 
But I've already described this potential dependency in the commit 
message, so I'm fine with just adding the "Fixes:" tag.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported"
  2026-05-12  0:55           ` Baolin Wang
@ 2026-05-12  1:15             ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2026-05-12  1:15 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Lorenzo Stoakes, hughd, willy, ziy, david, lance.yang,
	wangkefeng.wang, linux-mm, linux-kernel

On Tue, 12 May 2026 08:55:05 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:

> > 
> > Please let's not add new metadata without having told others what that
> > metadata means?
> > 
> > "Fixes:" should be sufficient.  I interpret Fixes: as "apply this to any
> > kernel which contains <that>".  Is more needed?
> 
> My concern is that if someone backports this patch to an older kernel 
> version without also backporting commit 665575cff098b, it would cause a 
> performance regression.
> 
> Is there a good way to mark this kind of dependency on another patch? 

Not that I know of.  Has someone sent 665575cff098b to -stable
maintainers and asked them to treat it as Fixes: 5a90c155defa?

> But I've already described this potential dependency in the commit 
> message, so I'm fine with just adding the "Fixes:" tag.

Yeah, I guess the supporting text will help clear confusion.

But you're right - our tooling should be able to express such things.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-05-12  1:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23  1:41 [PATCH] Revert "tmpfs: don't enable large folios if not supported" Baolin Wang
2026-04-23  2:37 ` Zi Yan
2026-04-23  2:46 ` Kefeng Wang
2026-04-23  2:57 ` Lance Yang
2026-04-23 13:20 ` David Hildenbrand (Arm)
2026-04-26  5:55   ` Baolin Wang
2026-05-05 10:46 ` Lorenzo Stoakes
2026-05-05 10:47   ` Lorenzo Stoakes
2026-05-06  8:58     ` Baolin Wang
2026-05-11 12:03       ` Lorenzo Stoakes
2026-05-11 22:01         ` Andrew Morton
2026-05-12  0:55           ` Baolin Wang
2026-05-12  1:15             ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox