mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: "Oscar Salvador (SUSE)" <osalvador@kernel.org>,
	"David Hildenbrand (Arm)" <david@kernel.org>
Cc: Mani Tofigh <mt4022@columbia.edu>,
	Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	Gregory Price <gourry@gourry.net>, <linux-mm@kvack.org>,
	<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<tz2294@columbia.edu>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] mm/memory_hotplug: don't offline a hwpoisoned page still in the page cache
Date: Fri, 27 Nov 2026 11:39:22 +0800	[thread overview]
Message-ID: <0b947b66-81d8-e921-ec57-76bad1ae1202@huawei.com> (raw)
In-Reply-To: <awf6RghUETgb41pr@localhost.localdomain>

On 2026/11/26 17:22, Oscar Salvador (SUSE) wrote:
> On Mon, Nov 23, 2026 at 08:45:37PM +0100, David Hildenbrand (Arm) wrote:
>> We'll have to find a way to make that reliable. Everything else is just hacking
>> around it.
>>
>> Why can we block concurrent offlining through get_online_mems/put_online_mems?

I once tried to fix the race between memory_failure and memory offlining [1],
but ultimately failed.

>> But I hate these functions.
>>
>> Or alternatively (better?), have a memory notifier that block concurrent
>> memory_failure() by grabbing the mf_mutex when MEM_GOING_OFFLINE and releasing
>> it when MEM_CANCEL_OFFLINE/MEM_OFFLINE.
> 
> I think this is the way to go.
> memory-failure is a shaky operation and over the years we have seen how challenging
> was to interact with other parts of the kernel without crashing.

I'd also prefer making memory_failure() and memory offlining mutually
exclusive instead of adding more ad-hoc synchronization or spreading
get_online_mems()/put_online_mems() into another path.

> 
> IMHO, we can try to be clever and try to workaround those issues
> (memhotplug vs memfailure) or just make the two exclusive.
> 
> @Miaohe: Thoughts?

We've already run into quite a few race conditions, and there will likely be
more in the future. memory_failure and memory offlining happen very infrequently,
so it's not really worth adding all sorts of code just for them. Therefore, I feel
that making the two mutually exclusive is a better, more permanent fix.

[1] https://lore.kernel.org/all/20220226094034.23938-1-linmiaohe@huawei.com/

Thanks.
.

  reply	other threads:[~2026-11-27  3:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 20:50 Mani Tofigh via B4 Relay
2026-11-06 20:58 ` David Hildenbrand (Arm)
2026-11-23  5:46   ` Mani Tofigh
2026-11-23 19:45     ` David Hildenbrand (Arm)
2026-11-26  9:22       ` Oscar Salvador (SUSE)
2026-11-27  3:39         ` Miaohe Lin [this message]
2026-11-23 12:29 ` Miaohe Lin

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=0b947b66-81d8-e921-ec57-76bad1ae1202@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mt4022@columbia.edu \
    --cc=nao.horiguchi@gmail.com \
    --cc=osalvador@kernel.org \
    --cc=osalvador@suse.de \
    --cc=stable@vger.kernel.org \
    --cc=tz2294@columbia.edu \
    --cc=vbabka@kernel.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

all inboxes | Powered by JetHome®