Messages in this thread | | | From | David Hildenbrand <> | Subject | Re: [PATCH v2 2/3] mm: introduce process_mrelease system call | Date | Thu, 22 Jul 2021 09:45:42 +0200 |
| |
>>> Getting a hold of the mm and locking the mmap_lock would be sufficient I guess. > > That's exactly what I do here. The simplified sequence is: > > task_lock > if (task_will_free_mem()) > mm=mmget() > task_unlock > if (!mm) return; > > mmap_read_lock(mm) > __oom_reap_task_mm(mm) > mmap_read_unlock(mm) > mmput(mm) > > Or did I misunderstand your comments?
Oh, sorry, my tired eyes confused "put_task_struct()" with "task_unlock()" and even "mmget()" with "mmgrab()" ...
So this is essentially get_task_mm() with an additional task_will_free_mem() check.
LGHTM!
:)
-- Thanks,
David / dhildenb
| |