Re: [PATCH v2 2/3] mm: introduce process_mrelease system call

From: David Hildenbrand
Date: Thu Jul 22 2021 - 03:45:49 EST


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