From: Ian Campbell <ian.campbell@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com,
jbeulich@suse.com
Subject: Re: [PATCH RFC] vmalloc/vzalloc: Add memflags parameter.
Date: Tue, 3 Nov 2015 12:39:47 +0000 [thread overview]
Message-ID: <1446554387.10390.20.camel@citrix.com> (raw)
In-Reply-To: <1446484327-17865-1-git-send-email-konrad.wilk@oracle.com>
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@oracle.com>
> ---
> 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@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-11-03 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 17:12 [PATCH RFC] vmalloc/vzalloc: Add memflags parameter Konrad Rzeszutek Wilk
2015-11-03 12:39 ` Ian Campbell [this message]
2015-11-05 17:08 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446554387.10390.20.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.