On 3/24/26 8:43 AM, Lisa Wang wrote:
On Sat, Mar 21, 2026 at 02:30:04PM +0800, Baolin Wang wrote:


On 3/20/26 7:30 AM, Lisa Wang wrote:
Add a shmem memory failure selftest to test the shmem memory failure is
correct after modifying shmem return value.

Test that
+ madvise() call returns 0 at the first time
+ trigger a SIGBUS when the poisoned shmem page is fault-in again.

Signed-off-by: Lisa Wang <[email protected]>
---

Why not move the shmem memory failure test into memory-failure.c?

Do you mean let memory-failure.c kernel code check by itself?
The reason I write the selftest instead of combining in memory-failure.c
is because
+ do not need extra checking code in kernel code
+ make it easier to trace the entire execution flow, starting from the
   madvise() down through shmem_error_remove_folio() and into the
   truncate_error_folio() logic.

Pleas let me know if I've missed something. Thanks!

That's not quite what I meant. I mean, since there is already a memory-failure.c in mm selftests (see [1]), I think we should move the shmem memory failure test cases into that file.

[1] https://lore.kernel.org/all/[email protected]/T/#m18e62ccb3e87316ec37dcde9389c1ba1c56d0951

Reply via email to