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

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



On Mon, 2015-11-02 at 12:12 -0500, Konrad Rzeszutek Wilk wrote:
> And use it amongst the callers of this function.

I expect this will also need some (hopefully trivial) changes for ARM too?

> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> Âxen/arch/x86/mm/hap/hap.cÂÂÂÂÂÂÂ| 2 +-
> Âxen/arch/x86/mm/shadow/common.c | 2 +-
> Âxen/common/domain.cÂÂÂÂÂÂÂÂÂÂÂÂÂ| 2 +-
> Âxen/common/domctl.cÂÂÂÂÂÂÂÂÂÂÂÂÂ| 2 +-
> Âxen/common/grant_table.cÂÂÂÂÂÂÂÂ| 3 ++-
> Âxen/common/vmap.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 8 ++++----
> Âxen/include/asm-x86/domain.hÂÂÂÂ| 4 ++--
> Âxen/include/xen/vmap.hÂÂÂÂÂÂÂÂÂÂ| 4 ++--
> Â8 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
> index e9c0080..acc5219 100644
> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -86,7 +86,7 @@ int hap_track_dirty_vram(struct domain *d,
> ÂÂÂÂÂÂÂÂÂ}
> Â
> ÂÂÂÂÂÂÂÂÂrc = -ENOMEM;
> -ÂÂÂÂÂÂÂÂdirty_bitmap = vzalloc(size);
> +ÂÂÂÂÂÂÂÂdirty_bitmap = vzalloc(size, MEMF_node(domain_to_node(d)));
> ÂÂÂÂÂÂÂÂÂif ( !dirty_bitmap )
> ÂÂÂÂÂÂÂÂÂÂÂÂÂgoto out;
> Â
> diff --git a/xen/arch/x86/mm/shadow/common.c
> b/xen/arch/x86/mm/shadow/common.c
> index bad355b..4169083 100644
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -3491,7 +3491,7 @@ int shadow_track_dirty_vram(struct domain *d,
> ÂÂÂÂÂif ( !nr )
> ÂÂÂÂÂÂÂÂÂgoto out;
> Â
> -ÂÂÂÂdirty_bitmap = vzalloc(dirty_size);
> +ÂÂÂÂdirty_bitmap = vzalloc(dirty_size, MEMF_node(domain_to_node(d)));
> ÂÂÂÂÂif ( dirty_bitmap == NULL )
> ÂÂÂÂÂ{
> ÂÂÂÂÂÂÂÂÂrc = -ENOMEM;
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index b0378aa..55a94d4 100644
> --- 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 )
> ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -ENOMEM;
> Â
> ÂÂÂÂÂÂÂÂÂif ( copy_from_guest(ctxt, arg, 1) )
> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
> index 46b967e..b874b01 100644
> --- 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 )
> ÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> Â
> Â#ifdef CONFIG_COMPAT
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index c92abda..b86286f 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -3200,7 +3200,8 @@ grant_table_create(
> ÂÂÂÂÂ}
> Â
> ÂÂÂÂÂ/* Tracking of mapped foreign frames table */
> -ÂÂÂÂt->maptrack = vzalloc(max_maptrack_frames * sizeof(*t->maptrack));
> +ÂÂÂÂt->maptrack = vzalloc(max_maptrack_frames * sizeof(*t->maptrack),
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂMEMF_node(domain_to_node(d)));
> ÂÂÂÂÂif ( t->maptrack == NULL )
> ÂÂÂÂÂÂÂÂÂgoto no_mem_2;
> Â
> diff --git a/xen/common/vmap.c b/xen/common/vmap.c
> index c57239f..fd295b1 100644
> --- a/xen/common/vmap.c
> +++ b/xen/common/vmap.c
> @@ -216,7 +216,7 @@ void vunmap(const void *va)
> ÂÂÂÂÂvm_free(va);
> Â}
> Â
> -void *vmalloc(size_t size)
> +void *vmalloc(size_t size, unsigned int memflags)
> Â{
> ÂÂÂÂÂmfn_t *mfn;
> ÂÂÂÂÂsize_t pages, i;
> @@ -232,7 +232,7 @@ void *vmalloc(size_t size)
> Â
> ÂÂÂÂÂfor ( i = 0; i < pages; i++ )
> ÂÂÂÂÂ{
> -ÂÂÂÂÂÂÂÂpg = alloc_domheap_page(NULL, 0);
> +ÂÂÂÂÂÂÂÂpg = alloc_domheap_page(NULL, memflags);
> ÂÂÂÂÂÂÂÂÂif ( pg == NULL )
> ÂÂÂÂÂÂÂÂÂÂÂÂÂgoto error;
> ÂÂÂÂÂÂÂÂÂmfn[i] = _mfn(page_to_mfn(pg));
> @@ -252,9 +252,9 @@ void *vmalloc(size_t size)
> ÂÂÂÂÂreturn NULL;
> Â}
> Â
> -void *vzalloc(size_t size)
> +void *vzalloc(size_t size, unsigned int memflags)
> Â{
> -ÂÂÂÂvoid *p = vmalloc(size);
> +ÂÂÂÂvoid *p = vmalloc(size, memflags);
> ÂÂÂÂÂint i;
> Â
> ÂÂÂÂÂif ( p == NULL )
> diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
> index f1d7ed6..a98bf3b 100644
> --- 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);
> Â}
> Â
> Âstatic inline void free_vcpu_guest_context(struct vcpu_guest_context
> *vgc)
> diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
> index 5671ac8..f24a29e 100644
> --- a/xen/include/xen/vmap.h
> +++ b/xen/include/xen/vmap.h
> @@ -11,8 +11,8 @@ void *__vmap(const mfn_t *mfn, unsigned int
> granularity,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂunsigned int nr, unsigned int align, unsigned int flags);
> Âvoid *vmap(const mfn_t *mfn, unsigned int nr);
> Âvoid vunmap(const void *);
> -void *vmalloc(size_t size);
> -void *vzalloc(size_t size);
> +void *vmalloc(size_t size, unsigned int memflags);
> +void *vzalloc(size_t size, unsigned int memflags);
> Âvoid vfree(void *va);
> Â
> Âvoid __iomem *ioremap(paddr_t, size_t);

_______________________________________________
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®.