From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: "David Hildenbrand (Red Hat)" <david@kernel.org>,
Zi Yan <ziy@nvidia.com>, Bijan Tabatabai <bijan311@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, shivankg@amd.com,
Hugh Dickins <hughd@google.com>, Chris Li <chrisl@kernel.org>,
Kairui Song <kasong@tencent.com>
Subject: Re: [PATCH] mm: Consider non-anon swap cache folios in folio_expected_ref_count()
Date: Wed, 17 Dec 2025 11:09:24 +0800 [thread overview]
Message-ID: <1c6cfc9b-046e-4dec-a859-032e89e707d4@linux.alibaba.com> (raw)
In-Reply-To: <a47adffe-b2c6-4d86-a970-b31c2e620146@kernel.org>
On 2025/12/17 09:04, David Hildenbrand (Red Hat) wrote:
>>>>
>>>> I am not very familiar with the memory hot-(un)plug or swapping
>>>> code, so
>>>> I am not 100% certain if this patch actually solves the root of the
>>>> problem. I believe the issue is from shmem folios, in which case I
>>>> believe
>>>> this patch is correct. However, I couldn't think of an easy way to
>>>> confirm
>>>> that the affected folios were from shmem. I guess it could be
>>>> possible that
>>>> the root cause could be from some bug where some anonymous pages do not
>>>> return true to folio_test_anon(). I don't think that's the case, but
>>>> figured the MM maintainers would have a better idea of what's going on.
>>
>> I am not sure about if shmem in swapcache causes the issue, since
>> the above setup does not involve shmem. +Baolin and Hugh for some
>> insight.
>
> We might just push out another unrelated shmem page to swap as we create
> memory pressure in the system I think.
>
>>
>> But David also mentioned that in __read_swap_cache_async() there is a
>> chance
>> that anon folio in swapcache can have anon flag not set yet. +Chris
>> and Kairui
>> for more analysis.
>
> Right, when we swapin an anon folio and did not map it into the page
> table yet. Likely we can trigger something similar when we proactively
> read a shmem page from swap into the swapcache.
>
> So it's unclear "where" a swapcache page belongs to until we move it to
> its owner (anon / shmem), which is also why I cannot judge easily from
>
> [ 49.641309] migrating pfn b12f25 failed ret:7
> [ 49.641310] page: refcount:2 mapcount:0 mapping:0000000033bd8fe2
> index:0x7f404d925 pfn:0xb12f25
> [ 49.641311] aops:swap_aops
> [ 49.641313] flags: 0x300000000030508(uptodate|active|owner_priv_1|
> reclaim|swapbacked|node=0|zone=3)
> [ 49.641314] raw: 0300000000030508 ffffed312c4bc908 ffffed312c4bc9c8
> 0000000000000000
> [ 49.641315] raw: 00000007f404d925 00000000000c823b 00000002ffffffff
> 0000000000000000
> [ 49.641315] page dumped because: migration failure
>
> What exactly that was.
>
> It was certainly an order-0 folio.
Thanks David for the explanation. It completely makes sense to me. So
feel free to add:
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
next prev parent reply other threads:[~2025-12-17 3:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 20:07 Bijan Tabatabai
2025-12-17 0:07 ` David Hildenbrand (Red Hat)
2025-12-17 0:34 ` Zi Yan
2025-12-17 1:04 ` David Hildenbrand (Red Hat)
2025-12-17 3:09 ` Baolin Wang [this message]
2025-12-19 0:21 ` Wei Yang
2025-12-19 1:42 ` Baolin Wang
2025-12-19 2:35 ` Kairui Song
2025-12-20 0:47 ` Wei Yang
2025-12-17 6:04 ` Kairui Song
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=1c6cfc9b-046e-4dec-a859-032e89e707d4@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=bijan311@gmail.com \
--cc=chrisl@kernel.org \
--cc=david@kernel.org \
--cc=hughd@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shivankg@amd.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.com \
/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