Message ID | 20220203081820.29521-4-rpalethorpe@suse.com |
---|---|
State | Superseded |
Headers | show |
Series | Add memcontrol03 and declarative CG API | expand |
Hi! > static const struct cgroup_file memory_ctrl_files[] = { > { "memory.current", "memory.usage_in_bytes", CTRL_MEMORY }, > + { "memory.min", NULL, CTRL_MEMORY }, This is obviously OK. > { "memory.max", "memory.limit_in_bytes", CTRL_MEMORY }, > { "memory.stat", "memory.stat", CTRL_MEMORY }, > { "memory.swappiness", "memory.swappiness", CTRL_MEMORY }, > @@ -896,7 +897,7 @@ tst_cgroup_group_mk(const struct tst_cgroup_group *const parent, > > for_each_dir(parent, 0, dir) { > new_dir = SAFE_MALLOC(sizeof(*new_dir)); > - cgroup_dir_mk(*dir, group_name, new_dir); > + cgroup_dir_mk(*dir, cg->group_name, new_dir); However this change should go in in a separate ptach. I guess that what we do is that we store a pointer passed to us by the user of the API into our structures instead of the copy we made, which is mostly working fine, since we pass pointers to statically allocated strings, but it should be fixed. But please do so in a separate patch. If you split this change into two separate patches you can consider both of them to have my Reviewed-by: > cgroup_group_add_dir(parent, cg, new_dir); > } > > -- > 2.34.1 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp
Hello, Cyril Hrubis <chrubis@suse.cz> writes: > Hi! >> static const struct cgroup_file memory_ctrl_files[] = { >> { "memory.current", "memory.usage_in_bytes", CTRL_MEMORY }, >> + { "memory.min", NULL, CTRL_MEMORY }, > > This is obviously OK. > >> { "memory.max", "memory.limit_in_bytes", CTRL_MEMORY }, >> { "memory.stat", "memory.stat", CTRL_MEMORY }, >> { "memory.swappiness", "memory.swappiness", CTRL_MEMORY }, >> @@ -896,7 +897,7 @@ tst_cgroup_group_mk(const struct tst_cgroup_group *const parent, >> >> for_each_dir(parent, 0, dir) { >> new_dir = SAFE_MALLOC(sizeof(*new_dir)); >> - cgroup_dir_mk(*dir, group_name, new_dir); >> + cgroup_dir_mk(*dir, cg->group_name, new_dir); > > However this change should go in in a separate ptach. > > I guess that what we do is that we store a pointer passed to us by the > user of the API into our structures instead of the copy we made, which > is mostly working fine, since we pass pointers to statically allocated > strings, but it should be fixed. But please do so in a separate patch. > > If you split this change into two separate patches you can consider both > of them to have my Reviewed-by: Ah, this should have been in the patch to make it printf like. > >> cgroup_group_add_dir(parent, cg, new_dir); >> } >> >> -- >> 2.34.1 >> >> >> -- >> Mailing list info: https://lists.linux.it/listinfo/ltp
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index e694d353b..d9cd6aa8e 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -160,6 +160,7 @@ static const struct cgroup_file cgroup_ctrl_files[] = { static const struct cgroup_file memory_ctrl_files[] = { { "memory.current", "memory.usage_in_bytes", CTRL_MEMORY }, + { "memory.min", NULL, CTRL_MEMORY }, { "memory.max", "memory.limit_in_bytes", CTRL_MEMORY }, { "memory.stat", "memory.stat", CTRL_MEMORY }, { "memory.swappiness", "memory.swappiness", CTRL_MEMORY }, @@ -896,7 +897,7 @@ tst_cgroup_group_mk(const struct tst_cgroup_group *const parent, for_each_dir(parent, 0, dir) { new_dir = SAFE_MALLOC(sizeof(*new_dir)); - cgroup_dir_mk(*dir, group_name, new_dir); + cgroup_dir_mk(*dir, cg->group_name, new_dir); cgroup_group_add_dir(parent, cg, new_dir); }
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> --- lib/tst_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)