All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xen: introduce a no lock version function of free_heap_pages
@ 2014-06-10 12:18 Bob Liu
  2014-06-10 12:18 ` [PATCH 2/2] xen: spread page scrubbing across all idle CPU Bob Liu
  2014-06-10 12:32 ` [PATCH 1/2] xen: introduce a no lock version function of free_heap_pages Andrew Cooper
  0 siblings, 2 replies; 13+ messages in thread
From: Bob Liu @ 2014-06-10 12:18 UTC (permalink / raw)
  To: xen-devel; +Cc: keir, ian.campbell, andrew.cooper3, jbeulich

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);
 
-    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);
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-06-11 11:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] xen: introduce a no lock version function of free_heap_pages Andrew Cooper

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.