[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] rcu: reduce half heap memory size by malloc_tri

From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] rcu: reduce half heap memory size by malloc_trim()
Date: Fri, 17 Nov 2017 13:54:09 +0000
User-agent: Mutt/1.9.1 (2017-09-22)

On Fri, Nov 17, 2017 at 02:23:34PM +0800, Yang Zhong wrote:
> diff --git a/util/rcu.c b/util/rcu.c
> index ca5a63e..8d491a6 100644
> --- a/util/rcu.c
> +++ b/util/rcu.c
> @@ -26,6 +26,7 @@
>   * IBM's contributions to this file may be relicensed under LGPLv2 or later.
>   */
> +#include <malloc.h>

This header file is not mentioned in the C99 standard or POSIX.  It is
probably not available on all host OSes that QEMU supports.  Please use

>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "qemu/rcu.h"
> @@ -272,6 +273,9 @@ static void *call_rcu_thread(void *opaque)
>              node->func(node);
>          }
>          qemu_mutex_unlock_iothread();
> +#ifdef CONFIG_LINUX
> +        malloc_trim(0);
> +#endif

It is important that the rcu thread isn't overzealous in minimizing heap
size if that means ordinary malloc(3) calls will experience latency
spikes.  Please leave a few MB free so that malloc(3) doesn't take the
slow path.


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]