[CRIU] [PATCH 0/3] Synchronize forking on mutex

Kirill Tkhai ktkhai at virtuozzo.com
Thu May 11 07:54:55 PDT 2017


The main goal of this series is optimizing of
synchronization and code simplification. Before
the patchset we used 5 syscalls to order child
creation:

1)open()
2)flock(LOCK_EX)
3)flock(LOCK_UN)
4)close() in parent
5)close() in child

Using mutexes reduces the syscall number to 2,
which sounds definitely better.

I've proposed that earlier, but in different way.
Now we keep ns_last_pid locked globally, and this
guarantees, we're synchronized with concurrent
criu or any other task. Also, the scheme allows
to reduce ns_last_pid locking time in the future,
if we need that. See [3/3] for the details.

https://travis-ci.org/tkhai/criu/builds/231169285

---

Kirill Tkhai (3):
      namespace: Group unlocking/closing operations in do_create_pid_ns_helper()
      forking: Introduce last_pid_mutex and helpers
      forking: Use last_pid_mutex for synchronization during clone()


 criu/cr-restore.c       |   42 ++++++++++++++++++++++--------------------
 criu/include/rst_info.h |   13 +++++++++++++
 criu/namespaces.c       |   30 ++++++++----------------------
 criu/pie/restorer.c     |   36 +++++++++++++++---------------------
 4 files changed, 58 insertions(+), 63 deletions(-)

--
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>


More information about the CRIU mailing list