linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>,
	linux-api@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	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>,
	Christian Brauner <christian@brauner.io>,
	Oleg Nesterov <oleg@redhat.com>,
	Tim Murray <timmurray@google.com>,
	kernel-team <kernel-team@android.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [RFC]: userspace memory reaping
Date: Fri, 13 Nov 2020 09:37:18 -0800	[thread overview]
Message-ID: <CAJuCfpHT-ew_d5F=r+SfxZqv1awyJ=e1FGdVx71wYkGZ5ZFOLg@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpGNC1m=tz1fBbFnCc=_87Dr=L4OuORbLDGd=iD6r6Q3Ng@mail.gmail.com>

On Thu, Nov 5, 2020 at 10:02 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Thu, Nov 5, 2020 at 9:44 AM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Thu 05-11-20 09:21:13, Suren Baghdasaryan wrote:
> > > On Thu, Nov 5, 2020 at 9:16 AM Michal Hocko <mhocko@suse.com> wrote:
> > > >
> > > > On Thu 05-11-20 08:50:58, Suren Baghdasaryan wrote:
> > > > > On Thu, Nov 5, 2020 at 4:20 AM Michal Hocko <mhocko@suse.com> wrote:
> > > > > >
> > > > > > On Wed 04-11-20 12:40:51, Minchan Kim wrote:
> > > > > > > On Wed, Nov 04, 2020 at 07:58:44AM +0100, Michal Hocko wrote:
> > > > > > > > On Tue 03-11-20 13:32:28, Minchan Kim wrote:
> > > > > > > > > On Tue, Nov 03, 2020 at 10:35:50AM +0100, Michal Hocko wrote:
> > > > > > > > > > On Mon 02-11-20 12:29:24, Suren Baghdasaryan wrote:
> > > > > > > > > > [...]
> > > > > > > > > > > To follow up on this. Should I post an RFC implementing SIGKILL_SYNC
> > > > > > > > > > > which in addition to sending a kill signal would also reap the
> > > > > > > > > > > victim's mm in the context of the caller? Maybe having some code will
> > > > > > > > > > > get the discussion moving forward?
> > > > > > > > > >
> > > > > > > > > > Yeah, having a code, even preliminary, might help here. This definitely
> > > > > > > > > > needs a good to go from process management people as that proper is land
> > > > > > > > > > full of surprises...
> > > > > > > > >
> > > > > > > > > Just to remind a idea I suggested to reuse existing concept
> > > > > > > > >
> > > > > > > > >     fd = pidfd_open(victim process)
> > > > > > > > >     fdatasync(fd);
> > > > > > > > >     close(fd);
> > > > > > > >
> > > > > > > > I must have missed this proposal. Anyway, are you suggesting fdatasync
> > > > > > > > to act as a destructive operation?
> > > > > > >
> > > > > > > write(fd) && fdatasync(fd) are already destructive operation if the file
> > > > > > > is shared.
> > > > > >
> > > > > > I am likely missing something because fdatasync will not destroy any
> > > > > > underlying data. It will sync
> > > > > >
> > > > > > > You don't need to reaping as destruptive operation. Rather than, just
> > > > > > > commit on the asynchrnous status "write file into page cache and commit
> > > > > > > with fsync" and "killing process and commit with fsync".
> > > > > >
> > > > > > I am sorry but I do not follow. The result of the memory reaping is a
> > > > > > data loss. Any private mapping will simply lose it's content. The caller
> > > > > > will get EFAULT when trying to access it but there is no way to
> > > > > > reconstruct the data. This is everything but not resembling what I see
> > > > > > f{data}sync is used for.
> > > > >
> > > > > I think Minchan considers f{data}sync as a "commit" operation.
> > > >
> > > > But there is nothing like commit in that operation. It is simply a
> > > > destroy operation. ftruncate as Minchan mentions in another reply would
> > > > be a closer fit but how do you interpret the length argument? What about
> > > > memory regions which cannot be reaped?
> > > >
> > > > I do understand that reusing an existing mechanism is usually preferable
> > > > but the semantic should be reasonable and easy to reason about.
> > >
> > > Maybe then we can consider a flag for pidfd_send_signal() to indicate
> > > that we want a synchronous mm cleanup when SIGKILL is being sent?
> > > Similar to my original RFC but cleanup would happen in the context of
> > > the caller. That seems to me like the simplest and most obvious way of
> > > expressing what we want to accomplish. WDYT?
> >
> > Yes that would make sense. Althought it would have to be SIGKILL
> > specific flag IMO. But let's see what process management people think
> > about that.
>
> Very well, I'll brush up the implementation and will post a new RFC. Thanks!
>

Sorry for the delay. The new RFC is posted at
https://lkml.org/lkml/2020/11/13/849

> >
> > --
> > Michal Hocko
> > SUSE Labs

      reply	other threads:[~2020-11-13 17:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15  0:43 [RFC]: userspace memory reaping Suren Baghdasaryan
2020-09-15  0:45 ` Suren Baghdasaryan
2020-10-14 12:09   ` Michal Hocko
2020-10-14 16:57     ` Suren Baghdasaryan
2020-10-14 18:39       ` minchan
2020-10-15  9:20       ` Michal Hocko
2020-10-15 18:43         ` Minchan Kim
2020-10-15 19:32           ` Suren Baghdasaryan
2020-10-15 19:25         ` Suren Baghdasaryan
2020-11-02 20:29           ` Suren Baghdasaryan
2020-11-03  9:35             ` Michal Hocko
2020-11-03 21:28               ` Suren Baghdasaryan
2020-11-03 21:32               ` Minchan Kim
2020-11-03 21:40                 ` Suren Baghdasaryan
2020-11-03 21:46                   ` Minchan Kim
2020-11-04  6:58                 ` Michal Hocko
2020-11-04 20:40                   ` Minchan Kim
2020-11-05 12:20                     ` Michal Hocko
2020-11-05 16:50                       ` Suren Baghdasaryan
2020-11-05 17:07                         ` Minchan Kim
2020-11-05 17:16                         ` Michal Hocko
2020-11-05 17:21                           ` Suren Baghdasaryan
2020-11-05 17:41                             ` Minchan Kim
2020-11-05 17:43                             ` Michal Hocko
2020-11-05 18:02                               ` Suren Baghdasaryan
2020-11-13 17:37                                 ` Suren Baghdasaryan [this message]

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='CAJuCfpHT-ew_d5F=r+SfxZqv1awyJ=e1FGdVx71wYkGZ5ZFOLg@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@android.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=oleg@redhat.com \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=timmurray@google.com \
    --cc=willy@infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).