Re: [PATCH RFC v2 5/7] mm: selftests: Add shmem memory failure test

Lisa Wang
2026-03-24T00:43:33Z

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 <wyihan@google.com>
> > ---
>
> 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!