linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: linux-mm@kvack.org, Mike Kravetz <mike.kravetz@oracle.com>,
	mhocko@suse.com, "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Prakash Sangappa <prakash.sangappa@oracle.com>,
	Pavel Emelyanov <xemul@virtuozzo.com>
Subject: Re: RFC: spurious UFFD_EVENT_FORK with pending signals
Date: Fri, 20 Oct 2017 20:02:00 +0200	[thread overview]
Message-ID: <20171020180200.GG3394@redhat.com> (raw)
In-Reply-To: <20171009061949.GA20101@rapoport-lnx>

On Mon, Oct 09, 2017 at 09:19:50AM +0300, Mike Rapoport wrote:
> Indeed in CRIU we don't close the parent uffd and a couple of spurious
> UFFD_EVENT_FORK won't cause a real problem. Yet, if we'll run out of file
> descriptors because of signal flood during migration, even with graceful
> failure we'd loose the migrated process entirely.

That's precisely the problem. The only risk is file descriptor exhaustion.

> Currently userfault related code in fork.c neatly fits into dup_mmap() and
> moving the uffd structures up into the callers would be ugly :(

Which is why for now I'm going to patch the selftest with a #define
that can be undefined if the fork stops generating false
positives.

And this is needed only because the selftests cannot handle non
cooperative workload, and for it, the spurious fork event is otherwise
unexpected.

You couldn't notice this with CRIU (unless the manager run out fds).

> I'm going to experiment with the list of userfaultfd_ctx in mm_struct, it
> seems to me that it may have additional value, e.g. to simplify
> userfaultfd_event_wait_completion(). I'll need a bit of time to see if I'm
> not talking complete nonsense :)

Up to you, it's only a (minor) issue for non cooperative usage.

> > diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c

I'll submit the selftest fix after I split this up and submit it, but
in the meantime if you work on this, to test any kernel change to the
event fork, you can apply the patch I already sent and define those
two:

#define REPRODUCE_SPURIOUS_UFFD_EVENT_FORK_IN_SIG_TEST
#define REPRODUCE_SPURIOUS_UFFD_EVENT_FORK_IN_EVENTS_TEST

You'll reproduce the spurious fork events immediately with it. Perhaps
the background signal flood can be slowed down a bit over time but it
doesn't seem to slow down the workload too much, it starts and stops
the signal flood (needed for immediate reproduction) every other second.

Thanks,
Andrea

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2017-10-20 18:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07 15:16 RFC: spurious UFFD_EVENT_FORK with pending signals Andrea Arcangeli
2017-10-09  6:19 ` Mike Rapoport
2017-10-20 18:02   ` Andrea Arcangeli [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=20171020180200.GG3394@redhat.com \
    --to=aarcange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=prakash.sangappa@oracle.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=xemul@virtuozzo.com \
    /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).