linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Liu Shixin <liushixin2@huawei.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Barry Song <baohua@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Lance Yang <ioworker0@gmail.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Hugh Dickins <hughd@google.com>,
	Charan Teja Kalla <quic_charante@quicinc.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/migrate: fix shmem xarray update during migration
Date: Fri, 28 Feb 2025 12:05:49 -0500	[thread overview]
Message-ID: <BBC5BC50-C32A-4609-A235-AFB0ADA30B52@nvidia.com> (raw)
In-Reply-To: <Z8HlvyKod4pbi6le@casper.infradead.org>

On 28 Feb 2025, at 11:35, Matthew Wilcox wrote:

> On Fri, Feb 28, 2025 at 10:42:19AM -0500, Zi Yan wrote:
>> @@ -524,7 +525,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 (shmem_mapping(mapping))
>
> It's be cheaper to check folio_test_anon() here, right?

Yes and it gets rid of the new include. Let me send v2.

>
> Also, how did this bug remain unnoticed for almost 4 years?
> Our testing is terrible ;-(

Probably not 4 years. Before fc346d0a70a1 (2023), shmem was right,
swap cache was wrong. After fc346d0a70a1, shmem is wrong, swap cache
is right. And before Baolin’s patch, shmem only has PMD size folio
to use multi-index entries. Maybe getting PMD size folio is
really impossible when compaction runs a lot?

>
>> +			entries = 1;
>> +		else
>> +			entries = nr;
>>  	} else {
>>  		VM_BUG_ON_FOLIO(folio_test_swapcache(folio), folio);
>>  		entries = 1;
>> -- 
>> 2.47.2
>>


Best Regards,
Yan, Zi


  reply	other threads:[~2025-02-28 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 15:42 Zi Yan
2025-02-28 16:35 ` Matthew Wilcox
2025-02-28 17:05   ` Zi Yan [this message]
2025-02-28 17:02 ` Shivank Garg
2025-02-28 17:17   ` Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BBC5BC50-C32A-4609-A235-AFB0ADA30B52@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=quic_charante@quicinc.com \
    --cc=ryan.roberts@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox