Prevent 2LSs from asking for too many vcores
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 4 May 2016 20:11:59 +0000 (16:11 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 4 May 2016 20:13:57 +0000 (16:13 -0400)
Some 2LSs just ask for more, regardless of how many the platform will take.
The kernel will ignore you, but no sense poking the beast.  Right now, the
kernel actually prints a debug message, since setting amt_wanted wrong is a
sign of a buggy program/library.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/vcore.c

index ae76bcc..7d6a6df 100644 (file)
@@ -228,6 +228,7 @@ static void __vc_req_poke(void *nr_vc_wanted)
 {
        long nr_vcores_wanted = *(long*)nr_vc_wanted;
 
+       nr_vcores_wanted = MIN(nr_vcores_wanted, max_vcores());
        if (prep_new_vcores(nr_vcores_wanted))
                panic("Unable to prep up to %d vcores!", nr_vcores_wanted);
        if (nr_vcores_wanted > __procdata.res_req[RES_CORES].amt_wanted)