[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] There is an allocation-failure path in sched_credit.c that BUGs. The



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 556022fb8eb6d62846bc106356fb23d3e5201ad1
# Parent  bbc27b921e2af0948bd9af3742be149c746eed0f
There is an allocation-failure path in sched_credit.c that BUGs.  The
attached patch handles this potential failure case more gracefully.

Signed-off-by:  Charles Coffing <ccoffing@xxxxxxxxxx>
---
 xen/common/sched_credit.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff -r bbc27b921e2a -r 556022fb8eb6 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Wed Aug 02 09:16:26 2006 +0100
+++ b/xen/common/sched_credit.c Wed Aug 02 09:20:09 2006 +0100
@@ -296,11 +296,16 @@ __runq_tickle(unsigned int cpu, struct c
         cpumask_raise_softirq(mask, SCHEDULE_SOFTIRQ);
 }
 
-static void
+static int
 csched_pcpu_init(int cpu)
 {
     struct csched_pcpu *spc;
     unsigned long flags;
+
+    /* Allocate per-PCPU info */
+    spc = xmalloc(struct csched_pcpu);
+    if ( spc == NULL )
+        return -1;
 
     spin_lock_irqsave(&csched_priv.lock, flags);
 
@@ -311,9 +316,6 @@ csched_pcpu_init(int cpu)
     if ( csched_priv.master >= csched_priv.ncpus )
         csched_priv.master = cpu;
 
-    /* Allocate per-PCPU info */
-    spc = xmalloc(struct csched_pcpu);
-    BUG_ON( spc == NULL );
     INIT_LIST_HEAD(&spc->runq);
     spc->runq_sort_last = csched_priv.runq_sort;
     schedule_data[cpu].sched_priv = spc;
@@ -323,6 +325,8 @@ csched_pcpu_init(int cpu)
     cpu_set(cpu, csched_priv.idlers);
 
     spin_unlock_irqrestore(&csched_priv.lock, flags);
+
+    return 0;
 }
 
 #ifndef NDEBUG
@@ -490,7 +494,10 @@ csched_vcpu_init(struct vcpu *vc)
 
     /* Allocate per-PCPU info */
     if ( unlikely(!CSCHED_PCPU(vc->processor)) )
-        csched_pcpu_init(vc->processor);
+    {
+        if ( csched_pcpu_init(vc->processor) != 0 )
+            return -1;
+    }
 
     CSCHED_VCPU_CHECK(vc);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.