X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fextensions%2Fext_cpu_mapper_edf.c;h=ebb01cd50ea00583efbf482a5b9e87a90ab335c6;hb=4d1d8fadad33de7d3ebce2083d9782048f78b44e;hp=33d919586ccf5ab2f3235c30db73f765dc81672d;hpb=40b983b217e8b8d0881309a9440195abbfdcce57;p=palacios.git diff --git a/palacios/src/extensions/ext_cpu_mapper_edf.c b/palacios/src/extensions/ext_cpu_mapper_edf.c index 33d9195..ebb01cd 100644 --- a/palacios/src/extensions/ext_cpu_mapper_edf.c +++ b/palacios/src/extensions/ext_cpu_mapper_edf.c @@ -23,7 +23,6 @@ #include #include - #ifndef V3_CONFIG_DEBUG_EXT_CPU_MAPPER_EDF #undef PrintDebug #define PrintDebug(fmt, args...) @@ -38,34 +37,31 @@ #define MAX_TDF 20 #define MIN_TDF 1 +#define UTILIZATION 80 +// Next Fit heuristic implementation -// First Next Fit heuristic implementation - -int firstNextFit(int save, int tdf,struct v3_vm_info *vm){ +int nextFit(int save, int tdf,struct v3_vm_info *vm){ - V3_Print(vm, VCORE_NONE,"firstNextFit for tdf %d \n", tdf); - - int V = vm->num_cores; // Number of virtual cores - int L = vm->avail_cores; // Number of Logical cores - int ULCores[L]; // Utilization array for logical cores - int uVCores[V]; // Utilization array for virtual cores - int mapping[V]; - int vc=0; // virtual core id - int lc=0; // logical core id + PrintDebug(vm, VCORE_NONE,"nextFit for tdf %d \n", tdf); + int V = vm->num_cores; // Number of virtual cores + int L = vm->avail_cores; // Number of Logical cores + int speedRatio[L]; // mapped virtual cores to logical core ratio. Must be less or equal than UTILIZATION X TDF + uint64_t speedVCores[V]; // Virtual core speeds + int mapping[V]; // mapping array + int vc=0; // virtual core id + int lc=0; // logical core id + uint_t cpu_khz = V3_CPU_KHZ(); // Physical core speed int i=0; for(i=0;i 0 ){ - mappable = firstNextFit(-1,tdf,vm); + mappable = nextFit(-1,tdf,vm); if(mappable != -1){ max_tdf = tdf/2; @@ -166,22 +177,21 @@ int edf_mapper_vm_init(struct v3_vm_info *vm, unsigned int cpu_mask){ tdf = max_tdf; } - firstNextFit(0,tdf,vm); - - - return 0; -} - + mappable = nextFit(-1,tdf,vm); + if(mappable !=-1){ + nextFit(0,tdf,vm); + } + else{ + tdf = 2*tdf; + nextFit(0,tdf,vm); + } -int edf_mapper_admit(struct v3_vm_info *vm){ - // TODO - PrintDebug(vm, VCORE_NONE,"mapper. Edf cpu_mapper admit"); - return 0; + PrintDebug(vm, VCORE_NONE,"mapper. Calculated TDF denom %d\n",tdf); + return 0; } int edf_mapper_admit_core(struct v3_vm_info * vm, int vcore_id, int target_cpu){ - // TODO - PrintDebug(vm, VCORE_NONE,"mapper. Edf cpu_mapper admit core"); + PrintDebug(vm, VCORE_NONE,"mapper. Edf cpu_mapper admit core\n"); return 0; }