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

Re: [Xen-devel] [PATCH RFC] vmalloc/vzalloc: Add memflags parameter.



>>> On 02.11.15 at 18:12, <konrad.wilk@xxxxxxxxxx> wrote:
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -1223,7 +1223,7 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>          if ( v->vcpu_info == &dummy_vcpu_info )
>              return -EINVAL;
>  
> -        if ( (ctxt = alloc_vcpu_guest_context()) == NULL )
> +        if ( (ctxt = alloc_vcpu_guest_context(MEMF_node(domain_to_node(d)))) 
> == NULL )

This one's a temporary allocation that gets freed a few lines down.
Hence best performance would be achieved by using the current
CPU's node, which iiuc will result if you pass just zero here.

> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -492,7 +492,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
> u_domctl)
>                       < sizeof(struct compat_vcpu_guest_context));
>  #endif
>          ret = -ENOMEM;
> -        if ( (c.nat = alloc_vcpu_guest_context()) == NULL )
> +        if ( (c.nat = 
> alloc_vcpu_guest_context(MEMF_node(domain_to_node(d)))) == NULL )

Same here.

> --- a/xen/include/asm-x86/domain.h
> +++ b/xen/include/asm-x86/domain.h
> @@ -577,9 +577,9 @@ void domain_cpuid(struct domain *d,
>  
>  #define domain_max_vcpus(d) (is_hvm_domain(d) ? HVM_MAX_VCPUS : 
> MAX_VIRT_CPUS)
>  
> -static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
> +static inline struct vcpu_guest_context *alloc_vcpu_guest_context(unsigned 
> int memflags)
>  {
> -    return vmalloc(sizeof(struct vcpu_guest_context));
> +    return vmalloc(sizeof(struct vcpu_guest_context), memflags);

With the above you won't need to add a parameter to the
function anymore, but if for some reason you did you'd need
to mirror this to ARM code.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.