fixed hart_max_harts bug
authorAndrew Waterman <waterman@parcad.millennium.berkeley.edu>
Sat, 20 Feb 2010 23:53:55 +0000 (15:53 -0800)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:36 +0000 (17:35 -0700)
kern/src/process.c
lib/parlib/hart.c

index 50193d3..6a21169 100644 (file)
@@ -197,7 +197,7 @@ proc_init_procinfo(struct proc* p)
        p->env_procinfo->ppid = p->ppid;
        p->env_procinfo->tsc_freq = system_timing.tsc_freq;
        // TODO: maybe do something smarter here
-       p->env_procinfo->max_harts = MAX(1,num_cpus); // hack to use all cores
+       p->env_procinfo->max_harts = MAX(1,num_cpus-1);
 }
 
 /* Allocates and initializes a process, with the given parent.  Currently
index 0f57f46..a08e9c9 100644 (file)
@@ -91,7 +91,7 @@ int hart_request(size_t k)
        if(k < 0 || _current_harts+k > hart_max_harts())
        {
                errno = EAGAIN;
-               goto fail;
+               goto out;
        }
 
        for(i = _current_harts, j = 0; i < _current_harts+k; i++, j++)
@@ -103,7 +103,7 @@ int hart_request(size_t k)
        if((ret = sys_resource_req(0,_current_harts+k,0)) == 0)
        {
                _current_harts += k;
-               goto success;
+               goto out;
        }
 
 fail:
@@ -113,7 +113,7 @@ fail:
                hart_free_stack(i);
        }
 
-success:
+out:
        hart_lock_unlock(&_hart_lock);
        return ret;
 }