[PATCH] fix virCgroupGetMemoryStat arguments order

Dmitry Frolov posted 1 patch 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20230904114448.147467-1-frolov@swemel.ru
src/lxc/lxc_cgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] fix virCgroupGetMemoryStat arguments order
Posted by Dmitry Frolov 8 months ago
Reviewing the sources, I noticed that, argumets order in
virCgroupGetMemoryStat() function call does not correspond
to the function declaration:
-instead of   *activeAnon, &meminfo->inactive_anon is passed;
-instead of *inactiveAnon,   &meminfo->active_anon is passed;
-instead of   *activeFile, &meminfo->inactive_file is passed;
-instead of *inactiveFile,   &meminfo->active_file is passed.

Fixes: e634c7cd0d ("lxc: Use virCgroupGetMemoryStat")

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
---
 src/lxc/lxc_cgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 1b516bba73..bc39b16928 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -130,10 +130,10 @@ static int virLXCCgroupGetMemStat(virCgroup *cgroup,
 {
     return virCgroupGetMemoryStat(cgroup,
                                   &meminfo->cached,
-                                  &meminfo->inactive_anon,
                                   &meminfo->active_anon,
-                                  &meminfo->inactive_file,
+                                  &meminfo->inactive_anon,
                                   &meminfo->active_file,
+                                  &meminfo->inactive_file,
                                   &meminfo->unevictable);
 }
 
-- 
2.34.1
Re: [PATCH] fix virCgroupGetMemoryStat arguments order
Posted by Martin Kletzander 8 months ago
On Mon, Sep 04, 2023 at 02:44:48PM +0300, Dmitry Frolov wrote:
>Reviewing the sources, I noticed that, argumets order in
>virCgroupGetMemoryStat() function call does not correspond
>to the function declaration:
>-instead of   *activeAnon, &meminfo->inactive_anon is passed;
>-instead of *inactiveAnon,   &meminfo->active_anon is passed;
>-instead of   *activeFile, &meminfo->inactive_file is passed;
>-instead of *inactiveFile,   &meminfo->active_file is passed.
>
>Fixes: e634c7cd0d ("lxc: Use virCgroupGetMemoryStat")
>
>Signed-off-by: Dmitry Frolov <frolov@swemel.ru>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

Thanks, pushed now