[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <472b91d2-d678-2d54-b2d0-8618f32e6e69@redhat.com>
Date: Thu, 22 Jul 2021 09:45:42 +0200
From: David Hildenbrand <david@...hat.com>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...nel.org>,
Michal Hocko <mhocko@...e.com>,
David Rientjes <rientjes@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <guro@...com>, Rik van Riel <riel@...riel.com>,
Minchan Kim <minchan@...nel.org>,
Christian Brauner <christian@...uner.io>,
Christoph Hellwig <hch@...radead.org>,
Oleg Nesterov <oleg@...hat.com>, Jann Horn <jannh@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Andy Lutomirski <luto@...nel.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Florian Weimer <fweimer@...hat.com>,
Jan Engelhardt <jengelh@...i.de>,
Tim Murray <timmurray@...gle.com>,
Linux API <linux-api@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel-team <kernel-team@...roid.com>
Subject: Re: [PATCH v2 2/3] mm: introduce process_mrelease system call
>>> 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
Powered by blists - more mailing lists