mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Ketan Kishore <ketan.kishore@oss.qualcomm.com>,
	Wei Yang <richard.weiyang@gmail.com>
Cc: Yuan Liu <yuan1.liu@intel.com>,
	Oscar Salvador <osalvador@suse.de>,
	Mike Rapoport <rppt@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Chen Yu <yu.c.chen@intel.com>, Jason Zeng <jason.zeng@intel.com>,
	Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [BUG] mm/memory_hotplug: panic due to race between compaction and memory hot-unplug
Date: Wed, 4 Nov 2026 10:08:23 +0100	[thread overview]
Message-ID: <52a78290-3e4a-4a87-9bb5-5b0e80cf0be7@kernel.org> (raw)
In-Reply-To: <ae386ef8-324c-4704-bc0f-a1eca3280399@oss.qualcomm.com>

On 11/4/26 06:18, Ketan Kishore wrote:
> 
> 
> On 9/10/2026 1:10 PM, David Hildenbrand (Arm) wrote:
>> On 9/10/26 05:16, Wei Yang wrote:
>>>
>>> Does it mean, the combination of pfn_to_online_page() / PageBuddy(page) is not
>>> safe, when there is hot-remove, even for other users. Not only compaction.
>>
>> There is an inherent race between any
>>
>> pfn_to_online_page() user that then takes a look at the memmap (PageBuddy,
>> whatever).
>>
>> Usually, that's not really relevant, because for things to go terrible wrong
>> (instead of only being slightly suboptimal :) )
>>
>> You have to run both, memory offlining *and* memory removal.
>>
> 
> Hello
> 
> We faced similar issue internally on one of our target's guest VM run,
> where kcompactd de-referenced a vmemmap pointer for a PFN after the hot-unplug
> path had already freed that vmemmap,with no lock preventing the two from running
> simultaneously.
> Call trace:
>   suitable_migration_target+0x0/0x8c (P)
>   migrate_pages_batch+0x1b4/0xc74
>   migrate_pages+0x150/0x654
>   compact_zone+0x5bc/0xb30
>   compact_node+0xa0/0x18c
>   kcompactd+0x228/0x4d0
> 
> Would it be okay to introduce something like "try_get_online_mems" as shown
> below to try a readlock in compaction path for hot-unplug to wait
> for kcompactd to complete before freeing the vmemmap?


Likely not what we want :)

Gregory started working on some fixes:

https://lore.kernel.org/r/20261027042204.3741307-1-gourry@gourry.net

They need more discussions. They are a little bit low priority as we are
fighting bigger fires ...


-- 
Cheers,

David

      reply	other threads:[~2026-11-04  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  9:55 Yuan Liu
2026-09-07 14:27 ` David Hildenbrand (Arm)
2026-09-10  3:16   ` Wei Yang
2026-09-10  7:40     ` David Hildenbrand (Arm)
2026-09-12  2:06       ` Wei Yang
2026-09-16 15:03         ` David Hildenbrand (Arm)
2026-11-04  5:18       ` Ketan Kishore
2026-11-04  9:08         ` David Hildenbrand (Arm) [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=52a78290-3e4a-4a87-9bb5-5b0e80cf0be7@kernel.org \
    --to=david@kernel.org \
    --cc=jason.zeng@intel.com \
    --cc=ketan.kishore@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=richard.weiyang@gmail.com \
    --cc=rppt@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=yu.c.chen@intel.com \
    --cc=yuan1.liu@intel.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

all inboxes | Powered by JetHome®