cgroup: Add "ignore" mode for --manage-cgroups

Submitted by Dmitry Safonov on May 1, 2019, 1:59 p.m.

Details

Message ID 20190501135944.5754-1-dima@arista.com
State Accepted
Series "cgroup: Add "ignore" mode for --manage-cgroups"
Commit 42e5c04f6cdb53172d2d024fe9722a9b7682665a
Headers show

Commit Message

Dmitry Safonov May 1, 2019, 1:59 p.m.
Since commit 6c572bee8f10 ("cgroup: Set "soft" mode by default") it
become impossible to set ignore mode at all. Provide a user option to do
that.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 Documentation/criu.txt | 2 ++
 criu/config.c          | 2 ++
 criu/crtools.c         | 3 ++-
 3 files changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/Documentation/criu.txt b/Documentation/criu.txt
index 414c9bb2df05..6111c3baf0e1 100644
--- a/Documentation/criu.txt
+++ b/Documentation/criu.txt
@@ -440,6 +440,8 @@  The 'mode' may be one of the following:
     *strict*::: Restore all cgroups and their properties from the scratch,
                 requiring them to not present in the system.
 
+    *ignore*::: Don't deal with cgroups and pretend that they don't exist.
+
 *--cgroup-root* ['controller'*:*]/'newroot'::
     Change the root cgroup the controller will be installed into. No controller
     means that root is the default for all controllers not specified.
diff --git a/criu/config.c b/criu/config.c
index f587b6ba227b..1474625ea674 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -368,6 +368,8 @@  static int parse_manage_cgroups(struct cr_options *opts, const char *optarg)
 		opts->manage_cgroups = CG_MODE_FULL;
 	} else if (!strcmp(optarg, "strict")) {
 		opts->manage_cgroups = CG_MODE_STRICT;
+	} else if (!strcmp(optarg, "ignore")) {
+		opts->manage_cgroups = CG_MODE_IGNORE;
 	} else
 		goto Esyntax;
 
diff --git a/criu/crtools.c b/criu/crtools.c
index 95d221b483e8..f32c8c9f53ee 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -447,7 +447,8 @@  usage:
 "  --irmap-scan-path FILE\n"
 "                        add a path the irmap hints to scan\n"
 "  --manage-cgroups [m]  dump/restore process' cgroups; argument can be one of\n"
-"                        'none', 'props', 'soft' (default), 'full' or 'strict'\n"
+"                        'none', 'props', 'soft' (default), 'full', 'strict'\n"
+"                        or 'ignore'\n"
 "  --cgroup-root [controller:]/newroot\n"
 "                        on dump: change the root for the controller that will\n"
 "                        be dumped. By default, only the paths with tasks in\n"

Comments

Cyrill Gorcunov May 1, 2019, 3:50 p.m.
On Wed, May 01, 2019 at 02:59:44PM +0100, Dmitry Safonov wrote:
> Since commit 6c572bee8f10 ("cgroup: Set "soft" mode by default") it
> become impossible to set ignore mode at all. Provide a user option to do
> that.
> 
> Cc: Cyrill Gorcunov <gorcunov@openvz.org>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
Ack
Andrei Vagin May 3, 2019, 7:06 a.m.
Applied, thanks!

On Wed, May 01, 2019 at 02:59:44PM +0100, Dmitry Safonov wrote:
> Since commit 6c572bee8f10 ("cgroup: Set "soft" mode by default") it
> become impossible to set ignore mode at all. Provide a user option to do
> that.
> 
> Cc: Cyrill Gorcunov <gorcunov@openvz.org>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
> ---
>  Documentation/criu.txt | 2 ++
>  criu/config.c          | 2 ++
>  criu/crtools.c         | 3 ++-
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/criu.txt b/Documentation/criu.txt
> index 414c9bb2df05..6111c3baf0e1 100644
> --- a/Documentation/criu.txt
> +++ b/Documentation/criu.txt
> @@ -440,6 +440,8 @@ The 'mode' may be one of the following:
>      *strict*::: Restore all cgroups and their properties from the scratch,
>                  requiring them to not present in the system.
>  
> +    *ignore*::: Don't deal with cgroups and pretend that they don't exist.
> +
>  *--cgroup-root* ['controller'*:*]/'newroot'::
>      Change the root cgroup the controller will be installed into. No controller
>      means that root is the default for all controllers not specified.
> diff --git a/criu/config.c b/criu/config.c
> index f587b6ba227b..1474625ea674 100644
> --- a/criu/config.c
> +++ b/criu/config.c
> @@ -368,6 +368,8 @@ static int parse_manage_cgroups(struct cr_options *opts, const char *optarg)
>  		opts->manage_cgroups = CG_MODE_FULL;
>  	} else if (!strcmp(optarg, "strict")) {
>  		opts->manage_cgroups = CG_MODE_STRICT;
> +	} else if (!strcmp(optarg, "ignore")) {
> +		opts->manage_cgroups = CG_MODE_IGNORE;
>  	} else
>  		goto Esyntax;
>  
> diff --git a/criu/crtools.c b/criu/crtools.c
> index 95d221b483e8..f32c8c9f53ee 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -447,7 +447,8 @@ usage:
>  "  --irmap-scan-path FILE\n"
>  "                        add a path the irmap hints to scan\n"
>  "  --manage-cgroups [m]  dump/restore process' cgroups; argument can be one of\n"
> -"                        'none', 'props', 'soft' (default), 'full' or 'strict'\n"
> +"                        'none', 'props', 'soft' (default), 'full', 'strict'\n"
> +"                        or 'ignore'\n"
>  "  --cgroup-root [controller:]/newroot\n"
>  "                        on dump: change the root for the controller that will\n"
>  "                        be dumped. By default, only the paths with tasks in\n"
> -- 
> 2.21.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu