Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Re: [PATCH v2] mm/migrate: fix shmem xarray update during migration
       [not found] <20250228174953.2222831-1-ziy@nvidia.com>
@ 2025-03-04  2:03 ` Zi Yan
  2025-03-04  5:30   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Zi Yan @ 2025-03-04  2:03 UTC (permalink / raw)
  To: Liu Shixin, Baolin Wang, linux-mm
  Cc: Andrew Morton, Barry Song, David Hildenbrand, Kefeng Wang,
	Lance Yang, Ryan Roberts, Matthew Wilcox, Hugh Dickins,
	Charan Teja Kalla, linux-kernel, Zi Yan, Shivank Garg, stable

On 28 Feb 2025, at 12:49, Zi Yan wrote:

> Pagecache uses multi-index entries for large folio, so does shmem. Only
> swap cache still stores multiple entries for a single large folio.
> Commit fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
> fixed swap cache but got shmem wrong by storing multiple entries for
> a large shmem folio. Fix it by storing a single entry for a shmem
> folio.
>
> Fixes: fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
> Reported-by: Liu Shixin <liushixin2@huawei.com>
> Closes: https://lore.kernel.org/all/28546fb4-5210-bf75-16d6-43e1f8646080@huawei.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> Reviewed-by: Shivank Garg <shivankg@amd.com>

+Cc:stable

> ---
>  mm/migrate.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 365c6daa8d1b..2c9669135a38 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -524,7 +524,11 @@ static int __folio_migrate_mapping(struct address_space *mapping,
>  			folio_set_swapcache(newfolio);
>  			newfolio->private = folio_get_private(folio);
>  		}
> -		entries = nr;
> +		/* shmem uses high-order entry */
> +		if (!folio_test_anon(folio))
> +			entries = 1;
> +		else
> +			entries = nr;
>  	} else {
>  		VM_BUG_ON_FOLIO(folio_test_swapcache(folio), folio);
>  		entries = 1;
> -- 
> 2.47.2


Best Regards,
Yan, Zi

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

* Re: [PATCH v2] mm/migrate: fix shmem xarray update during migration
  2025-03-04  2:03 ` [PATCH v2] mm/migrate: fix shmem xarray update during migration Zi Yan
@ 2025-03-04  5:30   ` Greg KH
  2025-03-04 17:00     ` Zi Yan
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2025-03-04  5:30 UTC (permalink / raw)
  To: Zi Yan
  Cc: Liu Shixin, Baolin Wang, linux-mm, Andrew Morton, Barry Song,
	David Hildenbrand, Kefeng Wang, Lance Yang, Ryan Roberts,
	Matthew Wilcox, Hugh Dickins, Charan Teja Kalla, linux-kernel,
	Shivank Garg, stable

On Mon, Mar 03, 2025 at 09:03:04PM -0500, Zi Yan wrote:
> On 28 Feb 2025, at 12:49, Zi Yan wrote:
> 
> > Pagecache uses multi-index entries for large folio, so does shmem. Only
> > swap cache still stores multiple entries for a single large folio.
> > Commit fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
> > fixed swap cache but got shmem wrong by storing multiple entries for
> > a large shmem folio. Fix it by storing a single entry for a shmem
> > folio.
> >
> > Fixes: fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
> > Reported-by: Liu Shixin <liushixin2@huawei.com>
> > Closes: https://lore.kernel.org/all/28546fb4-5210-bf75-16d6-43e1f8646080@huawei.com/
> > Signed-off-by: Zi Yan <ziy@nvidia.com>
> > Reviewed-by: Shivank Garg <shivankg@amd.com>
> 
> +Cc:stable
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* Re: [PATCH v2] mm/migrate: fix shmem xarray update during migration
  2025-03-04  5:30   ` Greg KH
@ 2025-03-04 17:00     ` Zi Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Zi Yan @ 2025-03-04 17:00 UTC (permalink / raw)
  To: Greg KH
  Cc: Liu Shixin, Baolin Wang, linux-mm, Andrew Morton, Barry Song,
	David Hildenbrand, Kefeng Wang, Lance Yang, Ryan Roberts,
	Matthew Wilcox, Hugh Dickins, Charan Teja Kalla, linux-kernel,
	Shivank Garg, stable

On 4 Mar 2025, at 0:30, Greg KH wrote:

> On Mon, Mar 03, 2025 at 09:03:04PM -0500, Zi Yan wrote:
>> On 28 Feb 2025, at 12:49, Zi Yan wrote:
>>
>>> Pagecache uses multi-index entries for large folio, so does shmem. Only
>>> swap cache still stores multiple entries for a single large folio.
>>> Commit fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
>>> fixed swap cache but got shmem wrong by storing multiple entries for
>>> a large shmem folio. Fix it by storing a single entry for a shmem
>>> folio.
>>>
>>> Fixes: fc346d0a70a1 ("mm: migrate high-order folios in swap cache correctly")
>>> Reported-by: Liu Shixin <liushixin2@huawei.com>
>>> Closes: https://lore.kernel.org/all/28546fb4-5210-bf75-16d6-43e1f8646080@huawei.com/
>>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>>> Reviewed-by: Shivank Garg <shivankg@amd.com>
>>
>> +Cc:stable
>>
>
> <formletter>
>
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read:
>   https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
>
> </formletter>

Sure. And this is not the right fix. I will resend a new one. Sorry
for the noise.


Best Regards,
Yan, Zi

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

end of thread, other threads:[~2025-03-04 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250228174953.2222831-1-ziy@nvidia.com>
2025-03-04  2:03 ` [PATCH v2] mm/migrate: fix shmem xarray update during migration Zi Yan
2025-03-04  5:30   ` Greg KH
2025-03-04 17:00     ` Zi Yan

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