Re: [PATCH] swap: Check nrexceptional of swap cache before being freed

Michal Hocko
2021-01-20T07:59:52Z

On Wed 20-01-21 15:54:04, Huang, Ying wrote:
> Michal Hocko <mhocko@suse.com> writes:
>
> > On Wed 20-01-21 15:27:11, Huang Ying wrote:
> >> To catch the error in updating the swap cache shadow entries or their count.
> >
> > What is the error?
>
> There's no error in the current code. But we will change the related
> code in the future. So this checking will help us to prevent error in
> the future. I will change the patch description to make it more clear.
>
> > Can it happens in the real life? Why do we need this
> > patch? Is crashing the kernel the right way to handle the situation?
>
> Emm... The mistake to update swap shadow entries will hurt performance,
> but will not trigger functionality bug. So it may be better to use
> VM_WARN_ON_ONCE().

Yes a warning is much more appropriate approach. The question is whether
a test like this is really necessary. But I will leave that to others to
decide. It was really the bug on that hit my eyes.

--
Michal Hocko
SUSE Labs