From: David Hildenbrand <david@redhat.com>
To: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>
Cc: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"Yasunori Gotou (Fujitsu)" <y-goto@fujitsu.com>,
Oscar Salvador <osalvador@suse.de>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"Xingtao Yao (Fujitsu)" <yaoxt.fnst@fujitsu.com>,
Zi Yan <ziy@nvidia.com>, Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [BUG ?] Offline Memory gets stuck in offline_pages()
Date: Thu, 4 Jul 2024 10:14:31 +0200 [thread overview]
Message-ID: <95b2bba5-7652-48d8-b6ec-bae7faeed501@redhat.com> (raw)
In-Reply-To: <5a4ef056-73c7-42e9-a839-43d42f8b7eab@fujitsu.com>
On 04.07.24 09:43, Zhijian Li (Fujitsu) wrote:
> All,
>
> Some progress updates
>
> When issue occurs, calling __drain_all_pages() can make offline_pages() escape from the loop.
>
>>
>> Jun 28 15:29:26 linux kernel: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7980dd
>> Jun 28 15:29:26 linux kernel: flags: 0x9fffffc0000000(node=2|zone=3|lastcpupid=0x1fffff)
>> Jun 28 15:29:26 linux kernel: raw: 009fffffc0000000 ffffdfbd9e603788 ffffd4f0ffd97ef0 0000000000000000
>> Jun 28 15:29:26 linux kernel: raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
>> Jun 28 15:29:26 linux kernel: page dumped because: trouble page...
>>
>
> With this problematic page structure contents, it seems that the
> list_head = {ffffdfbd9e603788, ffffd4f0ffd97ef0} is valid.
>
> I guess it was linking to the pcp_list, so I dumped the per_cpu_pages[cpu].count
> in every in critical timings.
So, is your reproducer getting fixed when you call __drain_all_pages()
in the loop? (not that it's the right fix, but a could datapoint :) )
>
> An example is as below,
> offline_pages()
> {
> // per_cpu_pages[1].count = 0
> zone_pcp_disable() // will call __drain_all_pages()
> // per_cpu_pages[1].count = 188
> do {
> do {
> scan_movable_pages()
> ret = do_migrate_range()
> } while (!ret)
>
> ret = test_pages_isolated()
>
> if(is the 1st iteration)
> // per_cpu_pages[1].count = 182
>
> if (issue occurs) { /* if the loop take beyond 10 seconds */
> // per_cpu_pages[1].count = 61
> __drain_all_pages()
> // per_cpu_pages[1].count = 0
> /* will escape from the outer loop in later iterations */
> }
> } while (ret)
> }
>
> Some interesting points:
> - After the 1st __drain_all_pages(), per_cpu_pages[1].count increased to 188 from 0,
> does it mean it's racing with something...?
> - per_cpu_pages[1].count will decrease but not decrease to 0 during iterations
> - when issue occurs, calling __drain_all_pages() will decrease per_cpu_pages[1].count to 0.
That's indeed weird. Maybe there is a race, or zone_pcp_disable() is not
fully effective for a zone?
>
> So I wonder if it's fine to call __drain_all_pages() in the loop?
>
> Looking forward to your insights.
So, in free_unref_page(), we make sure to never place MIGRATE_ISOLATE
onto the PCP. All pageblocks we are going to offline should be isolated
at this point, so no page that is getting freed and part of the
to-be-offlined range should end up on the PCP. So far the theory.
In offlining code we do
1) Set MIGRATE_ISOLATE
2) zone_pcp_disable() -> set high-and-batch to 0 and drain
Could there be a race in free_unref_page(), such that although
zone_pcp_disable() succeeds, we would still end up with a page in the
pcp? (especially, one that has MIGRATE_ISOLATE set for its pageblock?)
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-07-04 8:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 1:25 [BUG ?] Offline Memory gets stuck in offline_pages() Zhijian Li (Fujitsu)
2024-07-01 7:14 ` David Hildenbrand
2024-07-01 12:07 ` Zhijian Li (Fujitsu)
2024-07-04 7:43 ` Zhijian Li (Fujitsu)
2024-07-04 8:14 ` David Hildenbrand [this message]
2024-07-04 13:07 ` Zhijian Li (Fujitsu)
2024-07-12 1:50 ` Zhijian Li (Fujitsu)
2024-07-12 5:51 ` Zhijian Li (Fujitsu)
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=95b2bba5-7652-48d8-b6ec-bae7faeed501@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=hannes@cmpxchg.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizhijian@fujitsu.com \
--cc=osalvador@suse.de \
--cc=y-goto@fujitsu.com \
--cc=yaoxt.fnst@fujitsu.com \
--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;
as well as URLs for NNTP newsgroup(s).