On Mon, Jan 3, 2022 at 1:16 PM Hugh Dickins <hughd@xxxxxxxxxx> wrote: > > On Mon, 3 Jan 2022, Michal Hocko wrote: > > On Thu 30-12-21 09:29:40, Suren Baghdasaryan wrote: > > > On Thu, Dec 30, 2021 at 12:24 AM Michal Hocko <mhocko@xxxxxxxx> wrote: > > > > > > > > It would be really great to make unlock_range oom reaper aware IMHO. > > > > > > What exactly do you envision? Say unlock_range() knows that it's > > > racing with __oom_reap_task_mm() and that calling follow_page() is > > > unsafe without locking, what should it do? > > > > My original plan was to make the page lock conditional and use > > trylocking from the oom reaper (aka lockless context). It is OK to > > simply bail out and leave some mlocked memory behind if there is a > > contention on a specific page. The overall objective is to free as much > > memory as possible, not all of it. > > > > IIRC Hugh was not a fan of this approach and he has mentioned that the > > lock might not be even really needed and that the area would benefit > > from a clean up rather than oom reaper specific hacks. I do tend to > > agree with that. I just never managed to find any spare time for that > > though and heavily mlocked oom victims tend to be really rare. > > I forget when that was, and what I had in mind at that time. > But yes, by now I am very sure that munlocking needs a cleanup. > > And I do have that cleanup (against a much older tree), but never > the time to rebase or post or shepherd it through N revisions. How old was that tree? > > It was 22 files changed, 464 insertions, 706 deletions: > which is too much to help with this immediate oom reaper question. > > I'd better not drive this discussion further off-course; but it pains > me to see munlock_vma_pages obstructing, knowing there's a better way. > > I wonder: what if I were to steal time and promise to post a > rebased series against 5.17-rc1 or rc2: not support it thereafter, > but might there be someone to pick it up and shepherd it through? > But there's no answer to that, without you seeing what it's like. I would be interested in taking a look and see if it can be upstreamed and supported without bugging you too much. Thanks, Suren. > > Hugh