[CRIU] [PATCH 0/7] Skip iteration on open files to find parent's leftovers (optimize child creation)

Andrei Vagin avagin at virtuozzo.com
Thu Jul 6 09:05:17 MSK 2017


Applied, thanks

On Wed, Jun 28, 2017 at 06:53:48PM +0300, Kirill Tkhai wrote:
> We are CRIU, and we control our own file descriptors.
> We know, where we open them, and where we close them.
> 
> So, we can skip iterations on parent files leftovers
> in the most cases, and this should speed up child
> creation (just because there will be one less operation).
> 
> The only case, we can't control parent's open files state,
> is when parent has shared fd table. This case, parent's
> siblings create files in parallel with the parent creates
> the child, so we should find the leftovers. But it's
> less then 1% cases, and it's good to skip such unnecessary
> actions for generic case.
> 
> https://travis-ci.org/tkhai/criu/builds/247938937
> 
> ---
> 
> Kirill Tkhai (7):
>       mnt_ns: Move open_proc() up in prepare_mnt_ns()
>       utils: Introduce SWAP() helper to exchange two variables
>       mnt: Move ns_fd assignment down in prepare_mnt_ns()
>       mnt_ns: Use fdstore to keep mount namespaces
>       forking: Always close pid proc before child creation
>       restore: Use vpid in log_init_by_pid() instead of getpid()
>       restore: Do not iterate over parent's files to find leftovers
> 
> 
>  criu/cr-restore.c         |   47 ++++++++++++++++++++++++++-------------------
>  criu/include/criu-log.h   |    2 +-
>  criu/include/namespaces.h |    2 +-
>  criu/include/pid.h        |    8 ++------
>  criu/log.c                |    6 +++---
>  criu/mount.c              |   28 +++++++++++++--------------
>  include/common/compiler.h |    7 +++++++
>  7 files changed, 55 insertions(+), 45 deletions(-)
> 
> --
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>


More information about the CRIU mailing list