xen-devel
[Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC
To: |
dan.magenheimer@xxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Jan Beulich <JBeulich@xxxxxxxxxx> |
Subject: |
[Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC |
From: |
Dan Magenheimer <dan.magenheimer@xxxxxxxxxx> |
Date: |
Mon, 15 Feb 2010 08:36:29 -0800 (PST) |
Cc: |
George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, kurt.hackel@xxxxxxxxxx, Ian Pratt <Ian.Pratt@xxxxxxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, Patrick Colp <pjcolp@xxxxxxxxx>, Grzegorz Milos <gm281@xxxxxxxxx>, Andrew Peace <Andrew.Peace@xxxxxxxxxxxxx> |
Delivery-date: |
Mon, 15 Feb 2010 08:39:58 -0800 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<78c49794-4454-4c3b-80a6-72efcbc73fb3@default> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<2af13319-6b44-44e2-ab62-a0615208cf64@default C79F1B58.A196%keir.fraser@xxxxxxxxxxxxx 78c49794-4454-4c3b-80a6-72efcbc73fb3@default> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
This version should have zero impact if tmem is not enabled.
=======
When tmem is enabled, reserve a fraction of memory
for allocations of 0<order<9 to avoid fragmentation
issues.
Signed-off by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
diff -r 3bb163b74673 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c Fri Feb 12 09:24:18 2010 +0000
+++ b/xen/common/page_alloc.c Mon Feb 15 09:28:01 2010 -0700
@@ -223,6 +223,12 @@ static heap_by_zone_and_order_t *_heap[M
static unsigned long *avail[MAX_NUMNODES];
static long total_avail_pages;
+static long max_total_avail_pages; /* highwater mark */
+
+/* reserved for midsize (0<order<9) allocations, tmem only for now */
+static long midsize_alloc_zone_pages;
+#define MIDSIZE_ALLOC_FRAC 128
+
static DEFINE_SPINLOCK(heap_lock);
@@ -304,6 +310,15 @@ static struct page_info *alloc_heap_page
spin_lock(&heap_lock);
/*
+ When available memory is scarce, allow only mid-size allocations
+ to avoid worst of fragmentation issues. For now, only special-case
+ this when transcendent memory is enabled
+ */
+ if ( opt_tmem && ((order == 0) || (order >= 9)) &&
+ (total_avail_pages <= midsize_alloc_zone_pages) )
+ goto fail;
+
+ /*
* Start with requested node, but exhaust all node memory in requested
* zone before failing, only calc new node value if we fail to find memory
* in target node, this avoids needless computation on fast-path.
@@ -337,6 +352,7 @@ static struct page_info *alloc_heap_page
}
/* No suitable memory blocks. Fail the request. */
+fail:
spin_unlock(&heap_lock);
return NULL;
@@ -503,6 +519,11 @@ static void free_heap_pages(
avail[node][zone] += 1 << order;
total_avail_pages += 1 << order;
+ if ( total_avail_pages > max_total_avail_pages )
+ {
+ max_total_avail_pages = total_avail_pages;
+ midsize_alloc_zone_pages = max_total_avail_pages / MIDSIZE_ALLOC_FRAC;
+ }
/* Merge chunks as far as possible. */
while ( order < MAX_ORDER )
@@ -842,6 +863,8 @@ static unsigned long avail_heap_pages(
unsigned long total_free_pages(void)
{
+ if ( opt_tmem )
+ return total_avail_pages - midsize_alloc_zone_pages ;
return total_avail_pages;
}
tmem_midsize_alloc.patch
Description: Binary data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- RE: [Xen-devel] Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- [Xen-devel] Re: Tmem vs order>0 allocation, workaround RFC, Keir Fraser
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- [Xen-devel] Re: Tmem vs order>0 allocation, workaround RFC, Keir Fraser
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- [Xen-devel] Re: Tmem vs order>0 allocation, workaround RFC, Keir Fraser
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC,
Dan Magenheimer <=
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Jan Beulich
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Jan Beulich
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Jan Beulich
- [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Dan Magenheimer
- Re: [Xen-devel] RE: Tmem vs order>0 allocation, workaround RFC, Konrad Rzeszutek Wilk
|
|
|