[PATCH 0/2] mm: ksm: support hwpoison for ksm page
From: Longlong Xia
Date: Thu Mar 30 2023 - 03:45:46 EST
Currently, ksm does not support hwpoison. As ksm is being used more widely
for deduplication at the system level, container level, and process level,
supporting hwpoison for ksm has become increasingly important. However, ksm
pages were not processed by hwpoison in 2009 [1].
The main method of implementation:
1. Refactor add_to_kill() and add new add_to_kill_*() to better accommodate
the handling of different types of pages.
2. Add collect_procs_ksm() to collect processes when the error hit an ksm
page.
3. Add task_in_to_kill_list() to avoid duplicate addition of tsk to the
to_kill list.
4. Try_to_unmap ksm page (already supported).
5. Handle related processes such as sending SIGBUS.
Tested with poisoning to ksm page from
1) different process
2) one process
and with/without memory_failure_early_kill set, the processes
are killed as expected with the patchset.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
commit/?h=01e00f880ca700376e1845cf7a2524ebe68e47d6
Longlong Xia (2):
mm: memory-failure: Refactor add_to_kill()
mm: ksm: Support hwpoison for ksm page
include/linux/ksm.h | 11 ++++++++
include/linux/mm.h | 7 +++++
mm/ksm.c | 45 ++++++++++++++++++++++++++++++++
mm/memory-failure.c | 63 +++++++++++++++++++++++++++++++++------------
4 files changed, 109 insertions(+), 17 deletions(-)
--
2.25.1