[PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free

alloc.young@outlook.com posted 2 patches 1 year, 3 months ago
Maintainers: Hyman Huang <yong.huang@smartx.com>
[PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free
Posted by alloc.young@outlook.com 1 year, 3 months ago
From: alloc <alloc.young@outlook.com>

Convert free to g_free to match g_new and g_malloc functions.

Signed-off-by: alloc <alloc.young@outlook.com>
---
 softmmu/dirtylimit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c
index e3ff53b8fc..fa959d7743 100644
--- a/softmmu/dirtylimit.c
+++ b/softmmu/dirtylimit.c
@@ -100,7 +100,7 @@ static void vcpu_dirty_rate_stat_collect(void)
             stat.rates[i].dirty_rate;
     }
 
-    free(stat.rates);
+    g_free(stat.rates);
 }
 
 static void *vcpu_dirty_rate_stat_thread(void *opaque)
@@ -171,10 +171,10 @@ void vcpu_dirty_rate_stat_initialize(void)
 
 void vcpu_dirty_rate_stat_finalize(void)
 {
-    free(vcpu_dirty_rate_stat->stat.rates);
+    g_free(vcpu_dirty_rate_stat->stat.rates);
     vcpu_dirty_rate_stat->stat.rates = NULL;
 
-    free(vcpu_dirty_rate_stat);
+    g_free(vcpu_dirty_rate_stat);
     vcpu_dirty_rate_stat = NULL;
 }
 
@@ -220,10 +220,10 @@ void dirtylimit_state_initialize(void)
 
 void dirtylimit_state_finalize(void)
 {
-    free(dirtylimit_state->states);
+    g_free(dirtylimit_state->states);
     dirtylimit_state->states = NULL;
 
-    free(dirtylimit_state);
+    g_free(dirtylimit_state);
     dirtylimit_state = NULL;
 
     trace_dirtylimit_state_finalize();
-- 
2.39.3
Re: [PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free
Posted by Philippe Mathieu-Daudé 1 year, 3 months ago
On 25/8/23 04:32, alloc.young@outlook.com wrote:
> From: alloc <alloc.young@outlook.com>
> 
> Convert free to g_free to match g_new and g_malloc functions.
> 
> Signed-off-by: alloc <alloc.young@outlook.com>

Fixes: cc2b33eab0 ("softmmu/dirtylimit: Implement vCPU dirtyrate 
calculation periodically")
Fixes: baa609832e ("softmmu/dirtylimit: Implement virtual CPU throttle")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> ---
>   softmmu/dirtylimit.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)


Re: [PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free
Posted by Yong Huang 1 year, 3 months ago
On Fri, Aug 25, 2023 at 10:33 AM <alloc.young@outlook.com> wrote:

> From: alloc <alloc.young@outlook.com>
>
> Convert free to g_free to match g_new and g_malloc functions.
>
> Signed-off-by: alloc <alloc.young@outlook.com>
> ---
>  softmmu/dirtylimit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c
> index e3ff53b8fc..fa959d7743 100644
> --- a/softmmu/dirtylimit.c
> +++ b/softmmu/dirtylimit.c
> @@ -100,7 +100,7 @@ static void vcpu_dirty_rate_stat_collect(void)
>              stat.rates[i].dirty_rate;
>      }
>
> -    free(stat.rates);
> +    g_free(stat.rates);
>  }
>
>  static void *vcpu_dirty_rate_stat_thread(void *opaque)
> @@ -171,10 +171,10 @@ void vcpu_dirty_rate_stat_initialize(void)
>
>  void vcpu_dirty_rate_stat_finalize(void)
>  {
> -    free(vcpu_dirty_rate_stat->stat.rates);
> +    g_free(vcpu_dirty_rate_stat->stat.rates);
>      vcpu_dirty_rate_stat->stat.rates = NULL;
>
> -    free(vcpu_dirty_rate_stat);
> +    g_free(vcpu_dirty_rate_stat);
>      vcpu_dirty_rate_stat = NULL;
>  }
>
> @@ -220,10 +220,10 @@ void dirtylimit_state_initialize(void)
>
>  void dirtylimit_state_finalize(void)
>  {
> -    free(dirtylimit_state->states);
> +    g_free(dirtylimit_state->states);
>      dirtylimit_state->states = NULL;
>
> -    free(dirtylimit_state);
> +    g_free(dirtylimit_state);
>      dirtylimit_state = NULL;
>
>      trace_dirtylimit_state_finalize();
> --
> 2.39.3
>
>
Reviewed-by: Hyman Huang <yong.huang@smartx.com>

-- 
Best regards