WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

RE: [Xen-devel] Tmem vs order>0 allocation, workaround RFC

To: dan.magenheimer@xxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: RE: [Xen-devel] Tmem vs order>0 allocation, workaround RFC
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: 2010年2月12日 10:07:43 -0800 (PST)
Cc: Ian, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, kurt.hackel@xxxxxxxxxx, Patrick Colp <pjcolp@xxxxxxxxx>, Andrew, Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, Pratt <Ian.Pratt@xxxxxxxxxxxxx>, Grzegorz Milos <gm281@xxxxxxxxx>, Peace <Andrew.Peace@xxxxxxxxxxxxx>
Delivery-date: 2010年2月12日 10:09:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <dd8af362-e0b4-4ad7-9a44-5960e2563e7c@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: <dd8af362-e0b4-4ad7-9a44-5960e2563e7c@default >
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> Simply, avail_heap_pages would fail if total_avail_pages
> is less than 1%(?) of the total memory on the system AND
> the request is order==0. Essentially, this is reserving
> a "zone" for order>0 allocations.
Avoid worst fragmentation issues by reserving a "zone"
of physical memory only for order>0 allocations.
Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
g`"--- a/xen/common/page_alloc.c Fri Feb 12 09:24:18 2010 +0000
+++ b/xen/common/page_alloc.c Fri Feb 12 11:05:19 2010 -0700
@@ -223,6 +223,10 @@ 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 */
+#define ORDER_NONZERO_FRAC 128
+static long order_nonzero_zonesize; /* reserved for order>0 allocations */
+
 
 static DEFINE_SPINLOCK(heap_lock);
 
@@ -304,6 +308,13 @@ static struct page_info *alloc_heap_page
 spin_lock(&heap_lock);
 
 /*
+ When available memory is scarce, allow only larger allocations
+ to avoid worst of fragmentation issues
+ */
+ if ( !order && (total_avail_pages <= order_nonzero_zonesize) )
+ 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 +348,7 @@ static struct page_info *alloc_heap_page
 }
 
 /* No suitable memory blocks. Fail the request. */
+fail:
 spin_unlock(&heap_lock);
 return NULL;
 
@@ -503,6 +515,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;
+ order_nonzero_zonesize = max_total_avail_pages / ORDER_NONZERO_FRAC;
+ }
 
 /* Merge chunks as far as possible. */
 while ( order < MAX_ORDER )

Attachment: nonzero_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>
Previous by Date: [Xen-users] Xen Summit NA Date Change - NOW April 28-29, 2010 , Stephen Spector
Next by Date: [Xen-users] Xen.org Community Weekly Newsletter Vol 10 No 6 , Stephen Spector
Previous by Thread: [Xen-devel] Tmem vs order>0 allocation, workaround RFC , Dan Magenheimer
Next by Thread: [Xen-devel] Re: Tmem vs order>0 allocation, workaround RFC , Keir Fraser
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /