From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: keir@xen.org, ian.campbell@citrix.com, jbeulich@suse.com,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/2] xen: introduce a no lock version function of free_heap_pages
Date: Tue, 10 Jun 2014 13:32:48 +0100 [thread overview]
Message-ID: <5396FAF0.3070907@citrix.com> (raw)
In-Reply-To: <1402402717-26736-1-git-send-email-bob.liu@oracle.com>
On 10/06/14 13:18, Bob Liu wrote:
> Function free_heap_pages() needs to get the heap_lock every time. This lock
> may become a problem when there are many CPUs trying to free pages in parallel.
>
> This patch introduces a no lock version function __free_heap_pages(), it can be
> used to free a batch of pages after grabbing the heap_lock.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
> xen/common/page_alloc.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 601319c..56826b4 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -808,8 +808,8 @@ static int reserve_offlined_page(struct page_info *head)
> return count;
> }
>
> -/* Free 2^@order set of pages. */
> -static void free_heap_pages(
> +/* No lock version, the caller must hold heap_lock */
> +static void __free_heap_pages(
> struct page_info *pg, unsigned int order)
> {
> unsigned long mask, mfn = page_to_mfn(pg);
> @@ -819,8 +819,6 @@ static void free_heap_pages(
> ASSERT(order <= MAX_ORDER);
> ASSERT(node >= 0);
Probably best to insert an ASSERT(spin_is_locked(&heap_lock)) here.
~Andrew
>
> - spin_lock(&heap_lock);
> -
> for ( i = 0; i < (1 << order); i++ )
> {
> /*
> @@ -894,7 +892,14 @@ static void free_heap_pages(
>
> if ( tainted )
> reserve_offlined_page(pg);
> +}
>
> +/* Free 2^@order set of pages. */
> +static void free_heap_pages(
> + struct page_info *pg, unsigned int order)
> +{
> + spin_lock(&heap_lock);
> + __free_heap_pages(pg, order);
> spin_unlock(&heap_lock);
> }
>
prev parent reply other threads:[~2014-06-10 12:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 12:18 [PATCH 1/2] xen: introduce a no lock version function of free_heap_pages Bob Liu
2014-06-10 12:18 ` [PATCH 2/2] xen: spread page scrubbing across all idle CPU Bob Liu
2014-06-10 12:42 ` Andrew Cooper
2014-06-10 14:12 ` Jan Beulich
2014-06-11 2:51 ` Bob Liu
2014-06-11 8:13 ` Jan Beulich
2014-06-11 10:13 ` George Dunlap
2014-06-11 10:22 ` Jan Beulich
2014-06-11 10:36 ` Bob Liu
2014-06-11 10:45 ` George Dunlap
2014-06-11 11:17 ` Bob Liu
2014-06-11 10:48 ` Andrew Cooper
2014-06-10 12:32 ` Andrew Cooper [this message]
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=5396FAF0.3070907@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=lliubbo@gmail.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.