[libvirt] [PATCH] node_memory: Add new parameter field to tune the new sysfs knob

Eric Blake eblake at redhat.com
Fri Oct 12 03:55:51 UTC 2012


On 09/28/2012 09:41 AM, Osier Yang wrote:
> Upstream kernel introduced new sysfs knob "merge_across_nodes" to
> specify if pages from different numa nodes can be merged. When set
> to 0, only pages which physically reside in the memory area of
> same NUMA node can be merged. When set to 1, pages from all nodes
> can be merged.
> 
> This patch supports the tuning by adding new param field
> "shm-merge-across-nodes".

Actually shm_merge_across_nodes in the code.

> 
> ---
> Perhaps two bool options like "--disable-shm-merge-across-nodes",
> and "--enable-shm-merge-across-nodes" are good, but could the
> kernel sysfs knob have other values beyond 0 and 1 in future?

I agree with making it an integer.

> +++ b/include/libvirt/libvirt.h.in
> @@ -4489,6 +4489,16 @@ typedef virMemoryParameter *virMemoryParameterPtr;
>   */
>  # define VIR_NODE_MEMORY_SHARED_FULL_SCANS         "shm_full_scans"
>  
> +/* VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES:
> + *
> + * Macro for typed parameter that represents whether pages from
> + * different NUMA nodes can be merged, when its value is 0, only
> + * pages which physically reside in the memory area of same NUMA
> + * node are merged, otherwise pages from all nodes can be merged.

Mention that the parameter has type int, and maybe be more careful about
documenting value '1' means merge across all nodes and other values are
reserved for future use.

> + */
> +# define VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES "shm_merge_across_nodes"

Match the commit message to this.

> +
> +
>  int virNodeGetMemoryParameters(virConnectPtr conn,
>                                 virTypedParameterPtr params,
>                                 int *nparams,
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 021eb05..6002789 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -1004,6 +1004,13 @@ nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
>              /* Out of memory */
>              if (ret == -2)
>                  return -1;
> +        } else if (STREQ(param->field,
> +                         VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES)) {

Missed listing this in the virTypedParameterArrayValidate several lines
earlier.

Needs a v2.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121011/1075f94d/attachment-0001.sig>


More information about the libvir-list mailing list