linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Yang Yanchao <yangyanchao6@huawei.com>, linux-mm@kvack.org
Cc: wuxu.wu@huawei.com
Subject: Re: The process hangs during memory-hotplug.
Date: Mon, 14 Feb 2022 12:55:02 +0100	[thread overview]
Message-ID: <cb388ee5-b843-77d7-f5dd-a810ecd3cd84@redhat.com> (raw)
In-Reply-To: <20220213110703.2008-1-yangyanchao6@huawei.com>

On 13.02.22 12:07, Yang Yanchao wrote:
> Hello,
> 

Hi,

> I find a hanging issue during memory-hotplug on kernel-4.18.

you actually mean memory hotunplug / memory offlinig IIUC.

> Repetition steps:
> 1. malloc for all system memory, write 'x', then free
> 2. for each removable memory block:

Note that "removable=yes" was always racy and upstream Linux nowadays
only keeps that property around to not break older user space --
upstream Linux always reports "removable=yes" if memory offlining is
supported.

> echo offline > /sys/devices/system/memory/memoryXXX/state
> Then during the offline process, there is a high probability of being stuck for more than 20 minutes to five hours.
> cat /sys/ Device/system/Memory/memoryXXX/state
> The status is "going-offline"
> I try to understand it by adding some print to the kernel.The discovery process can't exit in this loop:
> __offline_pages
>     do_migrate_range
>         migrate_pages
>             unmap_and_move
>                 move_to_new_page
>                     fallback_migrate_page   --> return EAGAIN
> I try to clear the cache, but it don't seems to solve the problem.
> echo 3 > /proc/sys/vm/drop_caches
> Can I fix this problem with other Settings? Or can I see why it's stuck?

There are no real guarantees what will happen when trying offlinig a
memory block that's not onlined to ZONE_MOVABLE.

You can observe the zone e.g., via

$ cat /sys/devices/system/memory/memory40/valid_zones
Normal

Even with ZONE_MOVABLE, it can take quite a while (and in corner cases
eventually forever) until offlining succeeds.

Now, 20 minutes are a bit extreme. User space can always cancel
offlining -- in your example, by killing the "echo offline >
/sys/devices/system/memory/memoryXXX/state" process.


Having that said, as raised by Matthew, a lot changed since 4.18, so you
should try reproducing upstream. But even there, you can just cancel
offlining if it takes too long. If you observe similar behavior on
ZONE_MOVABLE, it would be interesting to find out how to better handle
that to make offlining succeed faster.

-- 
Thanks,

David / dhildenb



      parent reply	other threads:[~2022-02-14 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-13 11:07 Yang Yanchao
2022-02-13 12:24 ` Matthew Wilcox
2022-02-14 11:55 ` David Hildenbrand [this message]

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=cb388ee5-b843-77d7-f5dd-a810ecd3cd84@redhat.com \
    --to=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=wuxu.wu@huawei.com \
    --cc=yangyanchao6@huawei.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