mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Longlong Xia <xialonglong2025@163.com>,
	linmiaohe@huawei.com, nao.horiguchi@gmail.com
Cc: akpm@linux-foundation.org, wangkefeng.wang@huawei.com,
	xu.xin16@zte.com.cn, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Longlong Xia <xialonglong@kylinos.cn>
Subject: Re: [PATCH RFC 0/1] mm/ksm: Add recovery mechanism for memory failures
Date: Thu, 9 Oct 2025 20:57:21 +0200	[thread overview]
Message-ID: <8c4d8ebe-885e-40f0-a10e-7290067c7b96@redhat.com> (raw)
In-Reply-To: <20251009070045.2011920-1-xialonglong2025@163.com>

On 09.10.25 09:00, Longlong Xia wrote:
> From: Longlong Xia <xialonglong@kylinos.cn>
> 
> When a hardware memory error occurs on a KSM page, the current
> behavior is to kill all processes mapping that page. This can
> be overly aggressive when KSM has multiple duplicate pages in
> a chain where other duplicates are still healthy.
> 
> This patch introduces a recovery mechanism that attempts to migrate
> mappings from the failing page to another healthy duplicate within
> the same chain before resorting to killing processes.

An alternative could be to allocate a new page and effectively migrate 
from the old (degraded) page to the new page by copying page content 
from one of the healty duplicates.

That would keep the #mappings per page in the chain balanced.

> 
> The recovery process works as follows:
> 1. When a memory failure is detected on a KSM page, identify if the
> failing node is part of a chain (has duplicates) (maybe add dup_haed
> item to save head_node to struct stable_node?, saving searching
> the whole stable tree, or other way to find head_node)
> 2. Search for another healthy duplicate page within the same chain
> 3. For each process mapping the failing page:
> - Update the PTE to point to the healthy duplicate page ( maybe reuse
> replace_page?, or split repalce_page into smaller function and use the
> common part)
> - Migrate the rmap_item to the new stable node
> 4. If all migrations succeed, remove the failing node from the chain
> 5. Only kill processes if recovery is impossible or fails

Does not sound too crazy.

But how realistic do we consider that in practice? We need quite a bunch 
of processes to dedup the same page to end up getting duplicates in the 
chain IIRC.

So isn't this rather an improvement only for less likely scenarios in 
practice?

-- 
Cheers

David / dhildenb


      parent reply	other threads:[~2025-10-09 18:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09  7:00 Longlong Xia
2025-10-09  7:00 ` [PATCH RFC 1/1] " Longlong Xia
2025-10-09 12:13   ` Lance Yang
2025-10-11  7:52     ` Lance Yang
2025-10-11  9:23       ` Miaohe Lin
2025-10-11  9:38         ` Lance Yang
2025-10-11 12:57           ` Lance Yang
2025-10-13  3:39           ` Miaohe Lin
2025-10-13  4:42             ` Lance Yang
2025-10-13  9:15               ` Lance Yang
2025-10-13  9:25                 ` David Hildenbrand
2025-10-13  9:46                   ` Balbir Singh
2025-10-13 11:00                   ` Lance Yang
2025-10-13 11:13                     ` David Hildenbrand
2025-10-13 11:18                       ` Lance Yang
2025-10-11  3:25   ` Miaohe Lin
2025-10-13 20:10   ` [PATCH RFC] " Markus Elfring
2025-10-09 18:57 ` 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=8c4d8ebe-885e-40f0-a10e-7290067c7b96@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nao.horiguchi@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xialonglong2025@163.com \
    --cc=xialonglong@kylinos.cn \
    --cc=xu.xin16@zte.com.cn \
    /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®