Message ID | 20220513171811.730-5-mkoutny@suse.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | memcontrol selftests fixups | expand |
On Fri, May 13, 2022 at 07:18:11PM +0200, Michal Koutny wrote: > The reclaim is triggered by memory limit in a subtree, therefore the > testcase does not need configured protection against external reclaim. > > Also, correct/deduplicate respective comments > > Signed-off-by: Michal Koutný <mkoutny@suse.com> > --- > tools/testing/selftests/cgroup/test_memcontrol.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c > index 9ffacf024bbd..9d370aafd799 100644 > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c > @@ -247,7 +247,7 @@ static int cg_test_proc_killed(const char *cgroup) > > /* > * First, this test creates the following hierarchy: > - * A memory.min = 50M, memory.max = 200M > + * A memory.min = 0, memory.max = 200M > * A/B memory.min = 50M, memory.current = 50M > * A/B/C memory.min = 75M, memory.current = 50M > * A/B/D memory.min = 25M, memory.current = 50M > @@ -257,7 +257,7 @@ static int cg_test_proc_killed(const char *cgroup) > * Usages are pagecache, but the test keeps a running > * process in every leaf cgroup. > * Then it creates A/G and creates a significant > - * memory pressure in it. > + * memory pressure in A. > * > * A/B memory.current ~= 50M > * A/B/C memory.current ~= 29M > @@ -335,8 +335,6 @@ static int test_memcg_min(const char *root) > (void *)(long)fd); > } > > - if (cg_write(parent[0], "memory.min", "50M")) > - goto cleanup; > if (cg_write(parent[1], "memory.min", "50M")) > goto cleanup; > if (cg_write(children[0], "memory.min", "75M")) > @@ -404,8 +402,8 @@ static int test_memcg_min(const char *root) > > /* > * First, this test creates the following hierarchy: > - * A memory.low = 50M, memory.max = 200M > - * A/B memory.low = 50M, memory.current = 50M > + * A memory.low = 0, memory.max = 200M > + * A/B memory.low = 50M, memory.current = ... Can you, please, just remove "memory.current = ...", it's not because obvious what "..." means here. Other than that: Acked-by: Roman Gushchin <roman.gushchin@linux.dev> Thank you!
On Fri, May 13, 2022 at 07:18:11PM +0200, Michal Koutný wrote: > The reclaim is triggered by memory limit in a subtree, therefore the > testcase does not need configured protection against external reclaim. > > Also, correct/deduplicate respective comments > > Signed-off-by: Michal Koutný <mkoutny@suse.com> > --- > tools/testing/selftests/cgroup/test_memcontrol.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c > index 9ffacf024bbd..9d370aafd799 100644 > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c > @@ -247,7 +247,7 @@ static int cg_test_proc_killed(const char *cgroup) > > /* > * First, this test creates the following hierarchy: > - * A memory.min = 50M, memory.max = 200M > + * A memory.min = 0, memory.max = 200M > * A/B memory.min = 50M, memory.current = 50M > * A/B/C memory.min = 75M, memory.current = 50M > * A/B/D memory.min = 25M, memory.current = 50M > @@ -257,7 +257,7 @@ static int cg_test_proc_killed(const char *cgroup) > * Usages are pagecache, but the test keeps a running > * process in every leaf cgroup. > * Then it creates A/G and creates a significant > - * memory pressure in it. > + * memory pressure in A. > * > * A/B memory.current ~= 50M > * A/B/C memory.current ~= 29M > @@ -335,8 +335,6 @@ static int test_memcg_min(const char *root) > (void *)(long)fd); > } > > - if (cg_write(parent[0], "memory.min", "50M")) > - goto cleanup; > if (cg_write(parent[1], "memory.min", "50M")) > goto cleanup; > if (cg_write(children[0], "memory.min", "75M")) > @@ -404,8 +402,8 @@ static int test_memcg_min(const char *root) > > /* > * First, this test creates the following hierarchy: > - * A memory.low = 50M, memory.max = 200M > - * A/B memory.low = 50M, memory.current = 50M > + * A memory.low = 0, memory.max = 200M > + * A/B memory.low = 50M, memory.current = ... Is there a reason that we would adjust this comment but not the A/B comment from above in from test_memcg_low()? In both cases, I would just remove the memory.current = ... part altogether, as Roman suggested. > * A/B/C memory.low = 75M, memory.current = 50M > * A/B/D memory.low = 25M, memory.current = 50M > * A/B/E memory.low = 0, memory.current = 50M > @@ -490,8 +488,6 @@ static int test_memcg_low(const char *root) > goto cleanup; > } > > - if (cg_write(parent[0], "memory.low", "50M")) > - goto cleanup; > if (cg_write(parent[1], "memory.low", "50M")) > goto cleanup; > if (cg_write(children[0], "memory.low", "75M")) > -- > 2.35.3 > Looks good otherwise. Reviewed-by: David Vernet <void@manifault.com>
On Fri, 13 May 2022 11:59:56 -0700 Roman Gushchin <roman.gushchin@linux.dev> wrote: > On Fri, May 13, 2022 at 07:18:11PM +0200, Michal Koutny wrote: > > The reclaim is triggered by memory limit in a subtree, therefore the > > testcase does not need configured protection against external reclaim. > > > > Also, correct/deduplicate respective comments > > > > Signed-off-by: Michal Koutný <mkoutny@suse.com> > > --- > > tools/testing/selftests/cgroup/test_memcontrol.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c > > index 9ffacf024bbd..9d370aafd799 100644 > > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c > > @@ -247,7 +247,7 @@ static int cg_test_proc_killed(const char *cgroup) > > > > /* > > * First, this test creates the following hierarchy: > > - * A memory.min = 50M, memory.max = 200M > > + * A memory.min = 0, memory.max = 200M > > * A/B memory.min = 50M, memory.current = 50M > > * A/B/C memory.min = 75M, memory.current = 50M > > * A/B/D memory.min = 25M, memory.current = 50M > > @@ -257,7 +257,7 @@ static int cg_test_proc_killed(const char *cgroup) > > * Usages are pagecache, but the test keeps a running > > * process in every leaf cgroup. > > * Then it creates A/G and creates a significant > > - * memory pressure in it. > > + * memory pressure in A. > > * > > * A/B memory.current ~= 50M > > * A/B/C memory.current ~= 29M > > @@ -335,8 +335,6 @@ static int test_memcg_min(const char *root) > > (void *)(long)fd); > > } > > > > - if (cg_write(parent[0], "memory.min", "50M")) > > - goto cleanup; > > if (cg_write(parent[1], "memory.min", "50M")) > > goto cleanup; > > if (cg_write(children[0], "memory.min", "75M")) > > @@ -404,8 +402,8 @@ static int test_memcg_min(const char *root) > > > > /* > > * First, this test creates the following hierarchy: > > - * A memory.low = 50M, memory.max = 200M > > - * A/B memory.low = 50M, memory.current = 50M > > + * A memory.low = 0, memory.max = 200M > > + * A/B memory.low = 50M, memory.current = ... > > Can you, please, just remove "memory.current = ...", it's not > because obvious what "..." means here. > You mean this? --- a/tools/testing/selftests/cgroup/test_memcontrol.c~selftests-memcg-remove-protection-from-top-level-memcg-fix +++ a/tools/testing/selftests/cgroup/test_memcontrol.c @@ -403,15 +403,14 @@ cleanup: /* * First, this test creates the following hierarchy: * A memory.low = 0, memory.max = 200M - * A/B memory.low = 50M, memory.current = ... + * A/B memory.low = 50M * A/B/C memory.low = 75M, memory.current = 50M * A/B/D memory.low = 25M, memory.current = 50M * A/B/E memory.low = 0, memory.current = 50M * A/B/F memory.low = 500M, memory.current = 0 * * Usages are pagecache. - * Then it creates A/G an creates a significant - * memory pressure in it. + * Then it creates A/G and creates significant memory pressure in it. * * Then it checks actual memory usages and expects that: * A/B memory.current ~= 50M
On Tue, May 17, 2022 at 05:24:43PM -0700, Andrew Morton wrote: > On Fri, 13 May 2022 11:59:56 -0700 Roman Gushchin <roman.gushchin@linux.dev> wrote: > > > On Fri, May 13, 2022 at 07:18:11PM +0200, Michal Koutny wrote: > > > The reclaim is triggered by memory limit in a subtree, therefore the > > > testcase does not need configured protection against external reclaim. > > > > > > Also, correct/deduplicate respective comments > > > > > > Signed-off-by: Michal Koutný <mkoutny@suse.com> > > > --- > > > tools/testing/selftests/cgroup/test_memcontrol.c | 12 ++++-------- > > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > > > diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c > > > index 9ffacf024bbd..9d370aafd799 100644 > > > --- a/tools/testing/selftests/cgroup/test_memcontrol.c > > > +++ b/tools/testing/selftests/cgroup/test_memcontrol.c > > > @@ -247,7 +247,7 @@ static int cg_test_proc_killed(const char *cgroup) > > > > > > /* > > > * First, this test creates the following hierarchy: > > > - * A memory.min = 50M, memory.max = 200M > > > + * A memory.min = 0, memory.max = 200M > > > * A/B memory.min = 50M, memory.current = 50M > > > * A/B/C memory.min = 75M, memory.current = 50M > > > * A/B/D memory.min = 25M, memory.current = 50M > > > @@ -257,7 +257,7 @@ static int cg_test_proc_killed(const char *cgroup) > > > * Usages are pagecache, but the test keeps a running > > > * process in every leaf cgroup. > > > * Then it creates A/G and creates a significant > > > - * memory pressure in it. > > > + * memory pressure in A. > > > * > > > * A/B memory.current ~= 50M > > > * A/B/C memory.current ~= 29M > > > @@ -335,8 +335,6 @@ static int test_memcg_min(const char *root) > > > (void *)(long)fd); > > > } > > > > > > - if (cg_write(parent[0], "memory.min", "50M")) > > > - goto cleanup; > > > if (cg_write(parent[1], "memory.min", "50M")) > > > goto cleanup; > > > if (cg_write(children[0], "memory.min", "75M")) > > > @@ -404,8 +402,8 @@ static int test_memcg_min(const char *root) > > > > > > /* > > > * First, this test creates the following hierarchy: > > > - * A memory.low = 50M, memory.max = 200M > > > - * A/B memory.low = 50M, memory.current = 50M > > > + * A memory.low = 0, memory.max = 200M > > > + * A/B memory.low = 50M, memory.current = ... > > > > Can you, please, just remove "memory.current = ...", it's not > > because obvious what "..." means here. > > > > You mean this? > > --- a/tools/testing/selftests/cgroup/test_memcontrol.c~selftests-memcg-remove-protection-from-top-level-memcg-fix > +++ a/tools/testing/selftests/cgroup/test_memcontrol.c > @@ -403,15 +403,14 @@ cleanup: > /* > * First, this test creates the following hierarchy: > * A memory.low = 0, memory.max = 200M > - * A/B memory.low = 50M, memory.current = ... > + * A/B memory.low = 50M > * A/B/C memory.low = 75M, memory.current = 50M > * A/B/D memory.low = 25M, memory.current = 50M > * A/B/E memory.low = 0, memory.current = 50M > * A/B/F memory.low = 500M, memory.current = 0 > * > * Usages are pagecache. > - * Then it creates A/G an creates a significant > - * memory pressure in it. > + * Then it creates A/G and creates significant memory pressure in it. > * > * Then it checks actual memory usages and expects that: > * A/B memory.current ~= 50M > _ > > (includes gratuitous comment cleanup) Yes, thank you! > > I assume your comment in > https://lkml.kernel.org/r/Yn6pBPq+lAXm9NG8@carbon can be addressed in a > later patch. > > I'm not sure what to amke of https://lkml.kernel.org/r/Yn6pWPodGPlz+D8G@carbon > > Do we feel this series needs more work before merging it up? > Please, go ahead with it. If anything comes up, it can be addressed later. Thanks!
On Tue, May 17, 2022 at 05:52:25PM -0700, Roman Gushchin <roman.gushchin@linux.dev> wrote:
> Please, go ahead with it. If anything comes up, it can be addressed later.
I hope I can still post v2 of the tests cleanups (applying feedback from
here), it's in [1] with more info there. (I sent it to a new thread
based on get_maintainers.pl).
Thanks,
Michal
[1] https://lore.kernel.org/r/20220518154037.18819-1-mkoutny@suse.com
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 9ffacf024bbd..9d370aafd799 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -247,7 +247,7 @@ static int cg_test_proc_killed(const char *cgroup) /* * First, this test creates the following hierarchy: - * A memory.min = 50M, memory.max = 200M + * A memory.min = 0, memory.max = 200M * A/B memory.min = 50M, memory.current = 50M * A/B/C memory.min = 75M, memory.current = 50M * A/B/D memory.min = 25M, memory.current = 50M @@ -257,7 +257,7 @@ static int cg_test_proc_killed(const char *cgroup) * Usages are pagecache, but the test keeps a running * process in every leaf cgroup. * Then it creates A/G and creates a significant - * memory pressure in it. + * memory pressure in A. * * A/B memory.current ~= 50M * A/B/C memory.current ~= 29M @@ -335,8 +335,6 @@ static int test_memcg_min(const char *root) (void *)(long)fd); } - if (cg_write(parent[0], "memory.min", "50M")) - goto cleanup; if (cg_write(parent[1], "memory.min", "50M")) goto cleanup; if (cg_write(children[0], "memory.min", "75M")) @@ -404,8 +402,8 @@ static int test_memcg_min(const char *root) /* * First, this test creates the following hierarchy: - * A memory.low = 50M, memory.max = 200M - * A/B memory.low = 50M, memory.current = 50M + * A memory.low = 0, memory.max = 200M + * A/B memory.low = 50M, memory.current = ... * A/B/C memory.low = 75M, memory.current = 50M * A/B/D memory.low = 25M, memory.current = 50M * A/B/E memory.low = 0, memory.current = 50M @@ -490,8 +488,6 @@ static int test_memcg_low(const char *root) goto cleanup; } - if (cg_write(parent[0], "memory.low", "50M")) - goto cleanup; if (cg_write(parent[1], "memory.low", "50M")) goto cleanup; if (cg_write(children[0], "memory.low", "75M"))
The reclaim is triggered by memory limit in a subtree, therefore the testcase does not need configured protection against external reclaim. Also, correct/deduplicate respective comments Signed-off-by: Michal Koutný <mkoutny@suse.com> --- tools/testing/selftests/cgroup/test_memcontrol.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)