Messages in this thread | | | Subject | Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer | From | Tetsuo Handa <> | Date | Sat, 5 Aug 2017 01:49:17 +0900 |
| |
Michal Hocko wrote: > And that's why we still see the corruption. That, however, means that > the MMF_UNSTABLE implementation has to be more complex and we have to > hook into all anonymous memory fault paths which I hoped I could avoid > previously.
I don't understand mm internals including pte/ptl etc. , but I guess that the direction is correct. Since the OOM reaper basically does
Set MMF_UNSTABLE flag on mm_struct. For each reapable page in mm_struct { Take ptl lock. Remove pte. Release ptl lock. }
the page fault handler will need to check MMF_UNSTABLE with lock held.
For each faulted page in mm_struct { Take ptl lock. Add pte only if MMF_UNSTABLE flag is not set. Release ptl lock. }
| |