[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC] vmalloc/vzalloc: Add memflags parameter.
And use it amongst the callers of this function. 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); -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |