LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>, Michal Hocko <mhocko@suse.com>,
	David Rientjes <rientjes@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <guro@fb.com>, Rik van Riel <riel@surriel.com>,
	Minchan Kim <minchan@kernel.org>,
	Christian Brauner <christian@brauner.io>,
	Christoph Hellwig <hch@infradead.org>,
	Oleg Nesterov <oleg@redhat.com>, Jann Horn <jannh@google.com>,
	Shakeel Butt <shakeelb@google.com>,
	Andy Lutomirski <luto@kernel.org>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	Florian Weimer <fweimer@redhat.com>,
	Jan Engelhardt <jengelh@inai.de>,
	Tim Murray <timmurray@google.com>,
	Linux API <linux-api@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-team <kernel-team@android.com>
Subject: Re: [PATCH v2 2/3] mm: introduce process_mrelease system call
Date: Thu, 22 Jul 2021 09:45:42 +0200	[thread overview]
Message-ID: <472b91d2-d678-2d54-b2d0-8618f32e6e69@redhat.com> (raw)
In-Reply-To: <CAJuCfpHWTA+bGfg=aaRzmiszpo1pphJDL2T7=XSzzjfekSgW8w@mail.gmail.com>

>>> 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


  reply	other threads:[~2021-07-22  7:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 21:41 [PATCH v2 1/3] mm, oom: move task_will_free_mem up in the file to be used in process_mrelease Suren Baghdasaryan
2021-07-18 21:41 ` [PATCH v2 2/3] mm: introduce process_mrelease system call Suren Baghdasaryan
2021-07-21  8:02   ` David Hildenbrand
2021-07-21 15:43     ` Suren Baghdasaryan
2021-07-21 22:59       ` Suren Baghdasaryan
2021-07-22  7:45         ` David Hildenbrand [this message]
2021-07-18 21:41 ` [PATCH v2 3/3] mm: wire up syscall process_mrelease Suren Baghdasaryan
2021-07-20 12:43 ` [PATCH v2 1/3] mm, oom: move task_will_free_mem up in the file to be used in process_mrelease David Hildenbrand
2021-07-20 16:18   ` Suren Baghdasaryan
2021-07-20 23:07   ` Andrew Morton
2021-07-21  7:30     ` David Hildenbrand
2021-07-21 15:33       ` Suren Baghdasaryan
2021-07-21 16:12         ` David Hildenbrand
2021-07-21 20:19           ` Suren Baghdasaryan
2021-07-21 20:50             ` Andrew Morton
2021-07-21 20:59               ` Suren Baghdasaryan
2021-07-23  1:15                 ` Suren Baghdasaryan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472b91d2-d678-2d54-b2d0-8618f32e6e69@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=christian@brauner.io \
    --cc=fweimer@redhat.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=hch@infradead.org \
    --cc=jannh@google.com \
    --cc=jengelh@inai.de \
    --cc=kernel-team@android.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=oleg@redhat.com \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=shakeelb@google.com \
    --cc=surenb@google.com \
    --cc=timmurray@google.com \
    --cc=willy@infradead.org \
    --subject='Re: [PATCH v2 2/3] mm: introduce process_mrelease system call' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).