tst_cgroup: Don't try to use V2 if V1 controllers are mounted
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in tst_is_mounted so that we do not match cgroup2.
--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_cgroup.c +1 -1
@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) &&tst_is_mounted ("cgroup" )) +if (tst_is_mounted ("cgroup " )) cg_ver =TST_CGROUP_V1 ;else cg_ver =TST_CGROUP_V2 ;
Signature · 1 line
2.28.0
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Hi Richie,
Quoted 6 lines
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in
tst_is_mountedso that we do not match cgroup2.
Thanks for your fix.
Quoted 10 lines
Signed-off-by Richard Palethorpe <[email protected]>--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_cgroup.c +0
-0
lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 47
Quoted 5 lines
lib/tst_cgroup.c +1
-1@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) &&tst_is_mounted ("cgroup" )) +if (tst_is_mounted ("cgroup " ))
On first look the space looks like typo. But people can use git blame.
lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 50
Quoted 3 lines
lib/tst_cgroup.c +0
-0cg_ver =TST_CGROUP_V1 ; else cg_ver =TST_CGROUP_V2 ;
Kind regards,
Petr
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
In reply to Richard PalethorpeHi Richard,
Quoted 17 lines · Richard Palethorpe
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in
tst_is_mountedso that we do not match cgroup2.Signed-off-by Richard Palethorpe <[email protected]>--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_cgroup.c +0
-0
lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 49
Quoted 7 lines
lib/tst_cgroup.c +1
-1@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) && tst_is_mounted("cgroup")) +if (tst_is_mounted ("cgroup " ))
Add a space in the suffix still not work as expected.
The reason is that tst_is_mounted("cgroup ") also get non-zero return if system only mount cgroup_v2, which lead to choose cgroup_v1 in LTP test.
# cat /proc/mounts |grep cgroup cgroup2 /sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime 0 0
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200924/04c3bfa6/attachment.htm>
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Hello Li,
Quoted 32 lines · Li Wang
Hi Richard,
Quoted 17 lines · Richard Palethorpe
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in
tst_is_mountedso that we do not match cgroup2.Signed-off-by Richard Palethorpe <[email protected]>--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_cgroup.c +0
-0lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 49
Quoted 7 lines
lib/tst_cgroup.c +1
-1@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) && tst_is_mounted("cgroup")) +if (tst_is_mounted ("cgroup " ))Add a space in the suffix still not work as expected.
Quoted 5 lines
The reason is that
tst_is_mounted("cgroup ")also get non-zero return if system only mountcgroup_v2, which lead to choosecgroup_v1in LTP test.# cat /proc/mounts |grep cgroup cgroup2 /sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime 0 0
I wonder if it would be better to simply try mounting/using V2 and if that fails try V1?
Signature · 2 lines
Thank you, Richard.
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Quoted 40 lines · Richard Palethorpe
Hello Li,
Quoted 36 lines · Li Wang
Hi Richard,
On Thu, Sep 24, 2020 at 7:11 PM Richard Palethorpe <[email protected]
Quoted 17 lines · wrote:
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in
tst_is_mountedso that we do not match cgroup2.Signed-off-by Richard Palethorpe <[email protected]>--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_cgroup.c +0
-0lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 49
Quoted 7 lines
lib/tst_cgroup.c +1
-1@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) && tst_is_mounted("cgroup")) +if (tst_is_mounted ("cgroup " ))Add a space in the suffix still not work as expected.
The reason is that
tst_is_mounted("cgroup ")also get non-zero return if system only mountcgroup_v2, which lead to choosecgroup_v1in LTP test.
Quoted 7 lines
Quoted 2 lines
# cat /proc/mounts |grep cgroup cgroup2 /sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime0 0
I wonder if it would be better to simply try mounting/using V2 and if that fails try V1?
That will be work but not good, because if cgroup mount fails, how do we know it is a bug or not support?
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200925/67cf14da/attachment-0001.htm>
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Hello Li,
Quoted 45 lines · Li Wang
Quoted 42 lines · Richard Palethorpe
Hello Li,
Quoted 38 lines · Li Wang
Hi Richard,
On Thu, Sep 24, 2020 at 7:11 PM Richard Palethorpe <[email protected]
Quoted 17 lines · wrote:
It is not possible to use a controller in V2 cgroups if it has been mounted as a V1 controller. So if V1 is mounted we use it regardless of if V2 is available.
We have to include a space in
tst_is_mountedso that we do not match cgroup2.Signed-off-by Richard Palethorpe <[email protected]>--- lib/tst_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_cgroup.c +0
-0lib/tst_cgroup.c enum tst_cgroup_ver tst_cgroup_version(void) · line 49
Quoted 7 lines
lib/tst_cgroup.c +1
-1@@ -44,7 +44,7 @@ enum tst_cgroup_ver tst_cgroup_version(void)enum tst_cgroup_ver cg_ver;if (tst_cgroup_check ("cgroup2" )) { -if (!tst_is_mounted ("cgroup2" ) && tst_is_mounted("cgroup")) +if (tst_is_mounted ("cgroup " ))Add a space in the suffix still not work as expected.
The reason is that
tst_is_mounted("cgroup ")also get non-zero return if system only mountcgroup_v2, which lead to choosecgroup_v1in LTP test.# cat /proc/mounts |grep cgroup cgroup2 /sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime
Quoted 8 lines
Quoted 5 lines
0 0
I wonder if it would be better to simply try mounting/using V2 and if that fails try V1?
That will be work but not good, because if cgroup mount fails, how do we know it is a bug or not support?
I think this is a valid point if you are writing a test for mounting cgroups. However if we are testing something else then trying to guess if cgroups should be available before using them, makes the test fragile. I suppose we could check *after* trying to use the cgroups so we can report some diagnostic info.
Signature · 2 lines
Thank you, Richard.
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Richard Palethorpe <[email protected]> wrote:
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I wonder if it would be better to simply try mounting/using V2 and if that fails try V1?
Quoted 9 lines
Quoted 2 lines
That will be work but not good, because if cgroup mount fails, how do we know it is a bug or not support?
I think this is a valid point if you are writing a test for mounting cgroups. However if we are testing something else then trying to guess if cgroups should be available before using them, makes the test fragile. I suppose we could check *after* trying to use the cgroups so we can report some diagnostic info.
This sounds practicable, please feel free to work out the patch.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200925/aa8c31f1/attachment.htm>
PATCH 1/1 tst_cgroup: Don't try to use V2 if V1 controllers are mounted
Hello Li,
Quoted 10 lines · Li Wang
Richard Palethorpe <[email protected]> wrote:
...
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I wonder if it would be better to simply try mounting/using V2 and if that fails try V1?
That will be work but not good, because if cgroup mount fails, how do we know it is a bug or not support?
Quoted 8 lines
Quoted 6 lines
I think this is a valid point if you are writing a test for mounting cgroups. However if we are testing something else then trying to guess if cgroups should be available before using them, makes the test fragile. I suppose we could check *after* trying to use the cgroups so we can report some diagnostic info.
This sounds practicable, please feel free to work out the patch.
OK, I just sent a new patch. However there is no diagnostic info yet, I'm not sure if actually it would be better to make a test specifically checking if cgroups can be mounted and checking what is in filesystems and mounts.
Signature · 2 lines
Thank you, Richard.