virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <graf-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
To: Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jann Horn <jannh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	"Catangiu,
	Adrian Costin" <acatan-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org"
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	"rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org"
	<rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>,
	"len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org"
	<keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	"luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org"
	<luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
	"wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org"
	<wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	"mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"bonzini-mXXj517/zsQ@public.gmane.org"
	<bonzini-mXXj517/zsQ@public.gmane.org>,
	"MacCarthaigh,
	Colm" <colmmacc-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
Subject: Re: [RFC]: mm,power: introduce MADV_WIPEONSUSPEND
Date: Tue, 7 Jul 2020 10:01:23 +0200	[thread overview]
Message-ID: <efa55313-ce8a-bac9-15df-167f93c672b3@amazon.com> (raw)
In-Reply-To: <20200707074425.GC3820-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>



On 07.07.20 09:44, Michal Hocko wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
> 
> 
> 
> On Mon 06-07-20 14:52:07, Jann Horn wrote:
>> On Mon, Jul 6, 2020 at 2:27 PM Alexander Graf <graf-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org> wrote:
>>> Unless we create a vsyscall that returns both the PID as well as the
>>> epoch and thus handles fork *and* suspend. I need to think about this a
>>> bit more :).
>>
>> You can't reliably detect forking by checking the PID if it is
>> possible for multiple forks to be chained before the reuse check runs:
>>
>>   - pid 1000 remembers its PID
>>   - pid 1000 forks, creating child pid 1001
>>   - pid 1000 exits and is waited on by init
>>   - the pid allocator wraps around
>>   - pid 1001 forks, creating child pid 1000
>>   - child with pid 1000 tries to check for forking, determines that its
>> PID is 1000, and concludes that it is still the original process
> 
> I must be really missing something here because I really fail to see why
> there has to be something new even invented. Sure, checking for pid is
> certainly a suboptimal solution because pids are terrible tokens to work
> with. We do have a concept of file descriptors which a much better and
> supports signaling. There is a clear source of the signal IIUC
> (migration) and there are consumers to act upon that (e.g. crypto
> backends). So what does really prevent to use a standard signal delivery
> over fd for this usecase?

I wasn't part of the discussions on why things like WIPEONFORK were 
invented instead of just using signalling mechanisms, but the main 
reason I can think of are libraries.

As a library, you are under no control of the main loop usually, which 
means you just don't have a way to poll for an fd. As a library author, 
I would usually try to avoid very hard to create such a dependency, 
because it makes it really hard to glue pieces together.

The same applies to signals btw, which would also be a possible way to 
propagate such events.


Alex



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879

  parent reply	other threads:[~2020-07-07  8:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 10:34 [RFC]: mm,power: introduce MADV_WIPEONSUSPEND Catangiu, Adrian Costin
     [not found] ` <B7793B7A-3660-4769-9B9A-FFCF250728BB-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2020-07-03 11:04   ` Jann Horn
     [not found]     ` <CAG48ez2CpHX9i3YgkNyMHPz63ohjkaSZscMtwSHOFYN4VQow3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-04  1:33       ` Colm MacCárthaigh
2020-07-06 12:09       ` Alexander Graf
2020-07-03 11:30   ` Michal Hocko
     [not found]     ` <20200703113026.GT18446-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-07-03 12:17       ` Rafael J. Wysocki
     [not found]         ` <CAJZ5v0g+ip-EuUsoK646W-jVSSUhbnvHKsWmFH0+F1w0oYSmGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-03 22:39           ` Pavel Machek
2020-07-03 13:29       ` Jann Horn
     [not found]         ` <CAG48ez2O2z4L=n57Omwy6s1sWQkdTkPKiikhbfdVhiyd_TGRRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-03 22:34           ` Pavel Machek
2020-07-03 22:53             ` Jann Horn
2020-07-07  7:38           ` Michal Hocko
     [not found]             ` <20200707073823.GA3820-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-07-07  8:07               ` Pavel Machek
2020-07-07  8:58                 ` Michal Hocko
     [not found]                   ` <20200707085847.GA5913-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-07-07 16:37                     ` Pavel Machek
     [not found]                       ` <E6B41570-E206-4458-921B-465B9EF74949@amazon.com>
     [not found]                         ` <E6B41570-E206-4458-921B-465B9EF74949-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2020-07-12  7:22                           ` Pavel Machek
2020-07-13  8:02                             ` Michal Hocko
2020-07-04  1:45       ` Colm MacCárthaigh
     [not found]         ` <BC9E44B2-D3C2-43C7-8F4B-A31477147368-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2020-07-07  7:40           ` Michal Hocko
2020-07-03 22:44   ` Pavel Machek
2020-07-03 22:56     ` Jann Horn
     [not found]       ` <CAG48ez0oWQd42a-H-Dzw1Wq7HgB5PpFRGCZeYxP8ohxaoZHmvQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-04 11:48         ` Pavel Machek
2020-07-06 12:26           ` Alexander Graf
     [not found]             ` <57ab4fb3-3f82-d34f-ad74-2214b45a4dd9-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2020-07-06 12:52               ` Jann Horn
     [not found]                 ` <CAG48ez1tAAD+x6n07uCisXpqVpDUPX7xBWiKFkS3u2azHqd41A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-06 13:14                   ` Alexander Graf
2020-07-07  7:44                   ` Michal Hocko
     [not found]                     ` <20200707074425.GC3820-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-07-07  8:01                       ` Alexander Graf [this message]
     [not found]                         ` <efa55313-ce8a-bac9-15df-167f93c672b3-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2020-07-07  9:14                           ` Michal Hocko

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=efa55313-ce8a-bac9-15df-167f93c672b3@amazon.com \
    --to=graf-vv1otcyafmbqt0dzr+alfa@public.gmane.org \
    --cc=acatan-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=bonzini-mXXj517/zsQ@public.gmane.org \
    --cc=colmmacc-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org \
    --cc=fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jannh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
    --cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
    --cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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).