direct-io.hg

changeset 4642:214ccc480724

bitkeeper revision 1.1346.1.2 (42692edeXI3qQBmD6woxfDOQaO7VKg)

Finished port of the sEDF scheduler to 3.0.
sEDF is a new scheduler for Xen, that provides time guarantees using
an EDF like algorithm, and also distributes idle cpu time on a weighted
fair share policy.

Signed off by: Stephan.Diestelhorst@{cl.cam.ac.uk , inf.tu-dresden.de}
author sd386@font.cl.cam.ac.uk
date Fri Apr 22 17:05:34 2005 +0000 (2005-04-22)
parents 9c88ba91d330
children 93a7ffae49b3
files xen/common/sched_sedf.c
line diff
     1.1 --- a/xen/common/sched_sedf.c	Thu Apr 21 01:42:29 2005 +0000
     1.2 +++ b/xen/common/sched_sedf.c	Fri Apr 22 17:05:34 2005 +0000
     1.3 @@ -56,10 +56,12 @@ if ((_f)<=SEDFLEVEL) printk(_a );
     1.4  #define WEIGHT_PERIOD (MILLISECS(100))
     1.5  #define WEIGHT_SAFETY (MILLISECS(5))
     1.6  
     1.7 -
     1.8 -struct sedf_dom_info
     1.9 +struct sedf_dom_info {
    1.10 +	struct domain		*domain;
    1.11 +};
    1.12 +struct sedf_edom_info
    1.13  {
    1.14 -	struct domain		*owner;
    1.15 +	struct exec_domain	*exec_domain;
    1.16  	struct list_head	list;
    1.17  	struct list_head	extralist[2];
    1.18  	
    1.19 @@ -79,13 +81,12 @@ struct sedf_dom_info
    1.20  	short			weight;
    1.21  	
    1.22  	/*Bookkeeping*/
    1.23 -	s_time_t		absdead;
    1.24 -	s_time_t		sched_start;
    1.25 +	s_time_t		deadl_abs;
    1.26 +	s_time_t		sched_start_abs;
    1.27  	s_time_t		cputime;
    1.28 -	s_time_t		absblock;
    1.29 -	
    1.30 -	/*time the domain unblocked, used to determine unblocking intervals*/
    1.31 -	s_time_t		absunblock;
    1.32 +	/* times the domain un-/blocked */
    1.33 +	s_time_t		block_abs;
    1.34 +	s_time_t		unblock_abs;
    1.35  	
    1.36  	/*scores for {util, block penalty}-weighted extratime distribution*/
    1.37  	int			score[2];	
    1.38 @@ -112,48 +113,47 @@ struct sedf_cpu_info {
    1.39  	struct list_head extraq[2];
    1.40  };
    1.41  
    1.42 -#define DOM_INFO(d)		((struct sedf_dom_info *)((d)->sched_priv))
    1.43 +#define EDOM_INFO(d)		((struct sedf_edom_info *)((d)->ed_sched_priv))
    1.44  #define CPU_INFO(cpu)	((struct sedf_cpu_info *)schedule_data[cpu].sched_priv)
    1.45 -#define LIST(d)			(&DOM_INFO(d)->list)
    1.46 -#define EXTRALIST(d,i)		(&(DOM_INFO(d)->extralist[i]))
    1.47 +#define LIST(d)			(&EDOM_INFO(d)->list)
    1.48 +#define EXTRALIST(d,i)		(&(EDOM_INFO(d)->extralist[i]))
    1.49  #define RUNQ(cpu)   		(&CPU_INFO(cpu)->runnableq)
    1.50  #define WAITQ(cpu)   		(&CPU_INFO(cpu)->waitq)
    1.51  #define EXTRAQ(cpu,i)  		(&(CPU_INFO(cpu)->extraq[i]))
    1.52 -#define IDLETASK(cpu)		((struct domain *)schedule_data[cpu].idle)
    1.53 +#define IDLETASK(cpu)		((struct exec_domain *)schedule_data[cpu].idle)
    1.54  
    1.55 -#define PERIOD_BEGIN(inf)	((inf)->absdead - (inf)->period)
    1.56 +#define PERIOD_BEGIN(inf)	((inf)->deadl_abs - (inf)->period)
    1.57  
    1.58  #define MIN(x,y) (((x)<(y))?(x):(y))
    1.59  #define DIV_UP(x,y) (((x) + (y) - 1) / y)
    1.60  
    1.61 -static xmem_cache_t *dom_info_cache;
    1.62 -
    1.63  static void sedf_dump_cpu_state(int i);
    1.64  
    1.65 -static inline int extraq_on(struct domain *d, int i) {
    1.66 +static inline int extraq_on(struct exec_domain *d, int i) {
    1.67  	return ((EXTRALIST(d,i)->next != NULL) &&
    1.68  		(EXTRALIST(d,i)->next != EXTRALIST(d,i)));
    1.69  }
    1.70  
    1.71 -static inline void extraq_add_head(struct domain *d, int i)
    1.72 +static inline void extraq_add_head(struct exec_domain *d, int i)
    1.73  {
    1.74      list_add(EXTRALIST(d,i), EXTRAQ(d->processor,i));
    1.75  }
    1.76  
    1.77 -static inline void extraq_add_tail(struct domain *d, int i)
    1.78 +static inline void extraq_add_tail(struct exec_domain *d, int i)
    1.79  {
    1.80      list_add_tail(EXTRALIST(d,i), EXTRAQ(d->processor,i));
    1.81  }
    1.82  
    1.83 -static inline void extraq_del(struct domain *d, int i)
    1.84 +static inline void extraq_del(struct exec_domain *d, int i)
    1.85  {
    1.86  	struct list_head *list = EXTRALIST(d,i);
    1.87  	/*if (!extraq_on(d,i)) {
    1.88 -		PRINT(0,"extraq_del: domain %i is NOT on L%i extraq "\
    1.89 -			"HALTING\n",d->id,i);
    1.90 +		PRINT(0,"extraq_del: domain %i.%i is NOT on L%i extraq "\
    1.91 +			"HALTING\n",d->domain->id, d->eid,i);
    1.92  		sedf_dump_cpu_state(0);(*((int*)0))++;
    1.93  	}*/
    1.94 -	PRINT(3, "Removing domain %i from L%i extraq\n", d->id,i);	
    1.95 +	PRINT(3, "Removing domain %i.%i from L%i extraq\n", d->domain->id,
    1.96 +	   d->eid, i);	
    1.97  	list_del(list);
    1.98  	list->next = NULL;
    1.99  }
   1.100 @@ -164,28 +164,29 @@ static inline void extraq_del(struct dom
   1.101     each entry, in order to avoid overflow. The algorithm works by simply
   1.102     charging each domain that recieved extratime with an inverse of its weight.
   1.103   */ 
   1.104 -static inline void extraq_add_sort_update(struct domain *d, int i, int sub) {
   1.105 -	struct list_head     *cur;
   1.106 -	struct sedf_dom_info *curinf;
   1.107 +static inline void extraq_add_sort_update(struct exec_domain *d, int i, int sub) {
   1.108 +	struct list_head      *cur;
   1.109 +	struct sedf_edom_info *curinf;
   1.110  	
   1.111  	/*if (extraq_on(d,i)) {
   1.112 -		PRINT(0,"extraq_add_sort_update: domain %i is already on "\
   1.113 -		        "L%i extraq! HALTING\n",d->id,i);
   1.114 +		PRINT(0,"extraq_add_sort_update: domain %i.%i is already on "\
   1.115 +		        "L%i extraq! HALTING\n",d->domain->id, d->eid, i);
   1.116  		sedf_dump_cpu_state(0);(*((int*)0))++;
   1.117  	}*/
   1.118 -	PRINT(3, "Adding domain %i (score= %i, short_pen= %lli) to L%i "\
   1.119 -	         "extraq\n", d->id, DOM_INFO(d)->score[i],
   1.120 -	         DOM_INFO(d)->short_block_lost_tot, i);	
   1.121 +	PRINT(3, "Adding domain %i.%i (score= %i, short_pen= %lli) to L%i "\
   1.122 +	         "extraq\n", d->domain->id, d->eid, EDOM_INFO(d)->score[i],
   1.123 +	         EDOM_INFO(d)->short_block_lost_tot, i);	
   1.124  	/*iterate through all elements to find our "hole" and on our way
   1.125  	  update all the other scores*/
   1.126  	list_for_each(cur,EXTRAQ(d->processor,i)){
   1.127 -		curinf = list_entry(cur,struct sedf_dom_info,extralist[i]);
   1.128 +		curinf = list_entry(cur,struct sedf_edom_info,extralist[i]);
   1.129  		curinf->score[i] -= sub;
   1.130 -		if (DOM_INFO(d)->score[i] < curinf->score[i])
   1.131 +		if (EDOM_INFO(d)->score[i] < curinf->score[i])
   1.132  	 		break;
   1.133  		else
   1.134 -			PRINT(4,"\tbehind domain %i (score= %i)\n",
   1.135 -			      curinf->owner->id, curinf->score[i]);
   1.136 +			PRINT(4,"\tbehind domain %i.%i (score= %i)\n",
   1.137 +			      curinf->exec_domain->domain->id,
   1.138 +			      curinf->exec_domain->eid, curinf->score[i]);
   1.139  	}
   1.140  	/*cur now contains the element, before which we'll enqueue*/
   1.141  	PRINT(3, "\tlist_add to %x\n", cur->prev);
   1.142 @@ -195,24 +196,27 @@ static inline void extraq_add_sort_updat
   1.143  	if ((cur != EXTRAQ(d->processor,i)) && sub)
   1.144  		for (cur = cur->next; cur != EXTRAQ(d->processor,i);
   1.145  		     cur = cur-> next) {
   1.146 -			curinf = list_entry(cur,struct sedf_dom_info,
   1.147 +			curinf = list_entry(cur,struct sedf_edom_info,
   1.148  				extralist[i]);
   1.149  			curinf->score[i] -= sub;
   1.150 -			PRINT(4, "\tupdating domain %i (score= %llu)\n",
   1.151 -			      curinf->owner->id, curinf->score[i]);
   1.152 +			PRINT(4, "\tupdating domain %i.%i (score= %llu)\n",
   1.153 +			      curinf->exec_domain->domain->id, 
   1.154 +			      curinf->exec_domain->eid, curinf->score[i]);
   1.155  		}
   1.156  }
   1.157 -static inline void extraq_check(struct domain *d) {
   1.158 +static inline void extraq_check(struct exec_domain *d) {
   1.159  	if (extraq_on(d, EXTRA_UTIL_Q)) {
   1.160 -		PRINT(2,"Dom %i is on extraQ\n",d->id);
   1.161 -		if (!(DOM_INFO(d)->extra & EXTRA_AWARE) &&
   1.162 -		    !extra_runs(DOM_INFO(d))) {
   1.163 +		PRINT(2,"Dom %i is on extraQ\n",d->domain->id, d->eid);
   1.164 +		if (!(EDOM_INFO(d)->extra & EXTRA_AWARE) &&
   1.165 +		    !extra_runs(EDOM_INFO(d))) {
   1.166  			extraq_del(d, EXTRA_UTIL_Q);
   1.167 -			PRINT(2,"Removed dom %i from L1 extraQ\n",d->id);
   1.168 +			PRINT(2,"Removed dom %i.%i from L1 extraQ\n",
   1.169 +			      d->domain->id, d->eid);
   1.170  		}
   1.171  	} else {
   1.172 -		PRINT(2,"Dom %i is NOT on L1 extraQ\n",d->id);
   1.173 -		if ((DOM_INFO(d)->extra & EXTRA_AWARE) && domain_runnable(d))
   1.174 +		PRINT(2,"Dom %i.%i is NOT on L1 extraQ\n",d->domain->id,
   1.175 +		      d->eid);
   1.176 +		if ((EDOM_INFO(d)->extra & EXTRA_AWARE) && domain_runnable(d))
   1.177  		{
   1.178  			#if (EXTRA == EXTRA_ROUNDR)
   1.179  			/*Favour domains which got short unblocked*/
   1.180 @@ -223,15 +227,16 @@ static inline void extraq_check(struct d
   1.181  			#elif
   1.182  			;
   1.183  			#endif
   1.184 -			PRINT(2,"Added dom %i to L1 extraQ\n",d->id);
   1.185 +			PRINT(2,"Added dom %i.%i to L1 extraQ\n",d->domain->id,
   1.186 +			      d->eid);
   1.187  		}
   1.188  	}
   1.189  }
   1.190 -static inline void __del_from_queue(struct domain *d)
   1.191 +static inline void __del_from_queue(struct exec_domain *d)
   1.192  {
   1.193      struct list_head *list = LIST(d);
   1.194 -    PRINT(3,"Removing domain %i (bop= %llu) from runq/waitq\n", d->id,
   1.195 -          PERIOD_BEGIN(DOM_INFO(d)));
   1.196 +    PRINT(3,"Removing domain %i.%i (bop= %llu) from runq/waitq\n", d->domain->id,
   1.197 +          d->eid, PERIOD_BEGIN(EDOM_INFO(d)));
   1.198      list_del(list);
   1.199      list->next = NULL;
   1.200  }
   1.201 @@ -240,26 +245,26 @@ static inline void __del_from_queue(stru
   1.202     next period; this list is therefore sortet by this time, which is simply
   1.203     absol. deadline - period
   1.204   */ 
   1.205 -static inline void __add_to_waitqueue_sort(struct domain *d) {
   1.206 +static inline void __add_to_waitqueue_sort(struct exec_domain *d) {
   1.207  	struct list_head     *cur;
   1.208 -	struct sedf_dom_info *curinf;
   1.209 +	struct sedf_edom_info *curinf;
   1.210  	
   1.211 -	PRINT(3,"Adding domain %i (bop= %llu) to waitq\n", d->id,
   1.212 -	      PERIOD_BEGIN(DOM_INFO(d)));
   1.213 +	PRINT(3,"Adding domain %i.%i (bop= %llu) to waitq\n", d->domain->id,
   1.214 +	d->eid, PERIOD_BEGIN(EDOM_INFO(d)));
   1.215  	      
   1.216  	/*iterate through all elements to find our "hole"*/
   1.217 -	list_for_each(cur,WAITQ(d->processor)){
   1.218 -		curinf = list_entry(cur,struct sedf_dom_info,list);
   1.219 -		if (PERIOD_BEGIN(DOM_INFO(d)) < PERIOD_BEGIN(curinf))
   1.220 +	list_for_each(cur, WAITQ(d->processor)){
   1.221 +		curinf = list_entry(cur,struct sedf_edom_info,list);
   1.222 +		if (PERIOD_BEGIN(EDOM_INFO(d)) < PERIOD_BEGIN(curinf))
   1.223  	 		break;
   1.224  		else
   1.225 -			PRINT(4,"\tbehind domain %i (bop= %llu)\n",
   1.226 -			      curinf->owner->id, PERIOD_BEGIN(curinf));
   1.227 +			PRINT(4,"\tbehind domain %i.%i (bop= %llu)\n",
   1.228 +			      curinf->exec_domain->domain->id,
   1.229 +			      curinf->exec_domain->eid, PERIOD_BEGIN(curinf));
   1.230  	}
   1.231  	/*cur now contains the element, before which we'll enqueue*/
   1.232  	PRINT(3,"\tlist_add to %x\n",cur->prev);
   1.233  	list_add(LIST(d),cur->prev);
   1.234 -
   1.235  }
   1.236  
   1.237  /* adds a domain to the queue of processes which have started their current
   1.238 @@ -267,40 +272,40 @@ static inline void __add_to_waitqueue_so
   1.239     on this list is running on the processor, if the list is empty the idle
   1.240     task will run. As we are implementing EDF, this list is sorted by deadlines.
   1.241   */ 
   1.242 -static inline void __add_to_runqueue_sort(struct domain *d) {
   1.243 +static inline void __add_to_runqueue_sort(struct exec_domain *d) {
   1.244  	struct list_head     *cur;
   1.245 -	struct sedf_dom_info *curinf;
   1.246 +	struct sedf_edom_info *curinf;
   1.247  
   1.248 -	PRINT(3,"Adding domain %i (deadl= %llu) to runq\n", d->id,
   1.249 -	      DOM_INFO(d)->absdead);	
   1.250 +	PRINT(3,"Adding domain %i.%i (deadl= %llu) to runq\n", d->domain->id,
   1.251 +	      d->eid, EDOM_INFO(d)->deadl_abs);	
   1.252  	      
   1.253  	/*iterate through all elements to find our "hole"*/
   1.254  	list_for_each(cur, RUNQ(d->processor)) {
   1.255 -		curinf = list_entry(cur, struct sedf_dom_info, list);
   1.256 -		if (DOM_INFO(d)->absdead < curinf->absdead)
   1.257 +		curinf = list_entry(cur, struct sedf_edom_info, list);
   1.258 +		if (EDOM_INFO(d)->deadl_abs < curinf->deadl_abs)
   1.259  	 		break;
   1.260  		else
   1.261 -			PRINT(4,"\tbehind domain %i (deadl= %llu)\n",
   1.262 -			      curinf->owner->id, curinf->absdead);
   1.263 +			PRINT(4,"\tbehind domain %i.%i (deadl= %llu)\n",
   1.264 +			      curinf->exec_domain->domain->id,
   1.265 +			      curinf->exec_domain->eid, curinf->deadl_abs);
   1.266  	}
   1.267  	
   1.268  	/*cur now contains the element, before which we'll enqueue*/
   1.269  	PRINT(3,"\tlist_add to %x\n",cur->prev);
   1.270  	list_add(LIST(d),cur->prev);
   1.271 -
   1.272  }
   1.273 -static inline int __task_on_queue(struct domain *d) {
   1.274 +static inline int __task_on_queue(struct exec_domain *d) {
   1.275  	return (((LIST(d))->next != NULL) && (LIST(d)->next != LIST(d)));
   1.276  }
   1.277  
   1.278 -/* Initialises the queues and creates the domain info cache */
   1.279 +/* Initialises the queues */
   1.280  static int sedf_init_scheduler() {
   1.281  	int i;
   1.282  	PRINT(2,"sedf_init_scheduler was called\n");
   1.283  	
   1.284  	for ( i = 0; i < NR_CPUS; i++ ) {
   1.285  		schedule_data[i].sched_priv = 
   1.286 -			xmalloc(sizeof(struct sedf_cpu_info));
   1.287 +			xmalloc(struct sedf_cpu_info);
   1.288  		if ( schedule_data[i].sched_priv == NULL )
   1.289  			return -1;
   1.290  		INIT_LIST_HEAD(WAITQ(i));
   1.291 @@ -308,46 +313,56 @@ static int sedf_init_scheduler() {
   1.292  		INIT_LIST_HEAD(EXTRAQ(i,EXTRA_PEN_Q));
   1.293  		INIT_LIST_HEAD(EXTRAQ(i,EXTRA_UTIL_Q));
   1.294  	}
   1.295 -	dom_info_cache = xmem_cache_create("SEDF dom info",
   1.296 +//TODO: Remove this stuff if things work!
   1.297 +	/*dom_info_cache = xmem_cache_create("SEDF dom info",
   1.298  		sizeof(struct sedf_dom_info), 0, 0, 0, NULL);
   1.299  	if ( dom_info_cache == NULL )
   1.300  	{
   1.301  		printk("Could not allocate SLAB cache.\n");
   1.302  		return -1;
   1.303 -	}
   1.304 +	}*/
   1.305  	
   1.306  	return 0;   
   1.307  }
   1.308  
   1.309  /* Allocates memory for per domain private scheduling data*/
   1.310 -static int sedf_alloc_task(struct domain *d) {
   1.311 -	PRINT(2,"sedf_alloc_task was called, domain-id %i\n",d->id);
   1.312 -	if ( (d->sched_priv = xmem_cache_alloc(dom_info_cache)) == NULL )
   1.313 +static int sedf_alloc_task(struct exec_domain *d) {
   1.314 +	PRINT(2,"sedf_alloc_task was called, domain-id %i.%i\n",d->domain->id,
   1.315 +	      d->eid);
   1.316 +	if (d->domain->sched_priv == NULL) {
   1.317 +		if ((d->domain->sched_priv = 
   1.318 +		     xmalloc(struct sedf_dom_info)) == NULL )
   1.319  		return -1;
   1.320 -	memset(d->sched_priv, 0, sizeof(struct sedf_dom_info));
   1.321 +		memset(d->domain->sched_priv, 0, sizeof(struct sedf_dom_info));
   1.322 +	}
   1.323 +	if ((d->ed_sched_priv = xmalloc(struct sedf_edom_info)) == NULL )
   1.324 +		return -1;
   1.325 +	memset(d->ed_sched_priv, 0, sizeof(struct sedf_edom_info));
   1.326  	return 0;
   1.327  }
   1.328  
   1.329  /* Setup the sedf_dom_info */
   1.330 -static void sedf_add_task(struct domain *d)
   1.331 +static void sedf_add_task(struct exec_domain *d)
   1.332  {
   1.333 -	struct sedf_dom_info *inf=DOM_INFO(d);
   1.334 -	inf->owner = d;
   1.335 +	struct sedf_edom_info *inf=EDOM_INFO(d);
   1.336 +	inf->exec_domain = d;
   1.337  	
   1.338 -	PRINT(2,"sedf_add_task was called, domain-id %i\n",d->id);
   1.339 -	if (d->id==0) {
   1.340 +	PRINT(2,"sedf_add_task was called, domain-id %i.%i\n",d->domain->id,
   1.341 +	      d->eid);
   1.342 +	      
   1.343 +	if (d->domain->id==0) {
   1.344  		/*set dom0 to something useful to boot the machine*/
   1.345  		inf->period    = MILLISECS(20);
   1.346  		inf->slice     = MILLISECS(15);
   1.347  		inf->latency   = 0;
   1.348 -		inf->absdead   = 0;
   1.349 +		inf->deadl_abs = 0;
   1.350  		inf->extra     = EXTRA_NONE;/*EXTRA_AWARE; */
   1.351  	}
   1.352  	else {
   1.353  		/*other domains run in best effort mode*/
   1.354  		inf->period    = MILLISECS(20);
   1.355  		inf->slice     = 0;
   1.356 -		inf->absdead   = 0;
   1.357 +		inf->deadl_abs = 0;
   1.358  		inf->latency   = 0;
   1.359  		inf->extra     = EXTRA_AWARE;
   1.360  	}
   1.361 @@ -360,31 +375,39 @@ static void sedf_add_task(struct domain 
   1.362  /* Frees memory used by domain info */
   1.363  static void sedf_free_task(struct domain *d)
   1.364  {
   1.365 +	int i;
   1.366  	PRINT(2,"sedf_free_task was called, domain-id %i\n",d->id);
   1.367  	ASSERT(d->sched_priv != NULL);
   1.368 -	xmem_cache_free(dom_info_cache, d->sched_priv);
   1.369 +	xfree(d->sched_priv);
   1.370 +	
   1.371 +	for (i = 0; i < MAX_VIRT_CPUS; i++)
   1.372 +        	if ( d->exec_domain[i] ) {
   1.373 +			ASSERT(d->exec_domain[i]->ed_sched_priv != NULL);
   1.374 +			xfree(d->exec_domain[i]->ed_sched_priv);
   1.375 +		}
   1.376  }
   1.377  
   1.378  /* Initialises idle task */
   1.379 -static int sedf_init_idle_task(struct domain *d) {
   1.380 -	PRINT(2,"sedf_init_idle_task was called, domain-id %i\n",d->id);
   1.381 +static int sedf_init_idle_task(struct exec_domain *d) {
   1.382 +	PRINT(2,"sedf_init_idle_task was called, domain-id %i.%i\n",
   1.383 +	      d->domain->id, d->eid);
   1.384  	if ( sedf_alloc_task(d) < 0 )
   1.385  		return -1;
   1.386  	
   1.387  	sedf_add_task(d);
   1.388 -	DOM_INFO(d)->absdead = 0;
   1.389 -	set_bit(DF_RUNNING, &d->flags);
   1.390 +	EDOM_INFO(d)->deadl_abs = 0;
   1.391 +	set_bit(EDF_RUNNING, &d->ed_flags);
   1.392  	/*the idle task doesn't have to turn up on any list...*/
   1.393  	return 0;
   1.394  }
   1.395  
   1.396  /* handles the rescheduling, bookkeeping of domains running in their realtime-time :)*/
   1.397 -static inline void desched_edf_dom (s_time_t now, struct domain* d) {
   1.398 -	struct sedf_dom_info* inf = DOM_INFO(d);
   1.399 +static inline void desched_edf_dom (s_time_t now, struct exec_domain* d) {
   1.400 +	struct sedf_edom_info* inf = EDOM_INFO(d);
   1.401  	/*current domain is running in real time mode*/
   1.402  	
   1.403  	/*update the domains cputime*/
   1.404 -	inf->cputime += now - inf->sched_start;
   1.405 +	inf->cputime += now - inf->sched_start_abs;
   1.406  
   1.407  	/*scheduling decisions, which don't remove the running domain
   1.408  	  from the runq*/
   1.409 @@ -392,9 +415,9 @@ static inline void desched_edf_dom (s_ti
   1.410  		return;
   1.411  		
   1.412  	__del_from_queue(d);
   1.413 -	/*if (__task_on_queue(current)) {
   1.414 -		PRINT(0,"domain %i was removed but still on run/waitq => "\
   1.415 -		        "HALT\n",current->id);
   1.416 +	/*if (__task_on_queue(d)) {
   1.417 +		PRINT(0,"domain %i.%i was removed but still on run/waitq => "\
   1.418 +		        "HALT\n",d->domain->id, d->eid);
   1.419  		sedf_dump_cpu_state(0);(*((int*)0))++;
   1.420  	}*/
   1.421  	
   1.422 @@ -406,7 +429,7 @@ static inline void desched_edf_dom (s_ti
   1.423  		if (inf->period < inf->period_orig) {
   1.424  			/*this domain runs in latency scaling or burst mode*/
   1.425  			#if (UNBLOCK == UNBLOCK_BURST)
   1.426 -			if (now - inf->absunblock >= 2 * inf->period)
   1.427 +			if (now - inf->unblock_abs >= 2 * inf->period)
   1.428  			#endif
   1.429  			{
   1.430  				inf->period *= 2; inf->slice *= 2;
   1.431 @@ -419,43 +442,44 @@ static inline void desched_edf_dom (s_ti
   1.432  			}
   1.433  		}
   1.434  		/*set next deadline*/
   1.435 -		inf->absdead += inf->period;
   1.436 +		inf->deadl_abs += inf->period;
   1.437  	}
   1.438 -	/*if (inf->absdead<now)
   1.439 -		printk("Domain %i exceeded it't deadline!!!! "\
   1.440 -		       "(now: %llu ddl: %llu)\n", current->id, now,
   1.441 -		       inf->absdead);*/
   1.442 +	/*if (inf->deadl_abs < now)
   1.443 +		printk("Domain %i.%i exceeded it't deadline!!!! "\
   1.444 +		       "(now: %llu ddl: %llu)\n", d->domain->id, d->eid, now,
   1.445 +		       inf->deadl_abs);*/
   1.446  		       
   1.447  	/*add a runnable domain to the waitqueue*/
   1.448  	if (domain_runnable(d))
   1.449  		__add_to_waitqueue_sort(d);
   1.450  	else {
   1.451 -		/*we have a blocked realtime task*/
   1.452 -		inf->absblock = now;
   1.453 +		/*we have a blocked realtime task -> remove it from exqs too*/
   1.454 +		inf->block_abs = now;
   1.455  		#if (EXTRA > EXTRA_OFF)
   1.456  		#if (EXTRA == EXTRA_BLOCK_WEIGHT)
   1.457 -		if (extraq_on(d,EXTRA_PEN_Q)) extraq_del(d,EXTRA_PEN_Q);
   1.458 +		if (extraq_on(d, EXTRA_PEN_Q)) extraq_del(d, EXTRA_PEN_Q);
   1.459  		#endif
   1.460 -		if (extraq_on(d,EXTRA_UTIL_Q)) extraq_del(d,EXTRA_UTIL_Q);
   1.461 +		if (extraq_on(d, EXTRA_UTIL_Q)) extraq_del(d, EXTRA_UTIL_Q);
   1.462  		#endif
   1.463  	}
   1.464  }
   1.465  
   1.466  /* Update all elements on the queues */
   1.467 -static inline void update_queues(
   1.468 -s_time_t now, struct list_head* runq, struct list_head* waitq) {
   1.469 +static inline void update_queues(s_time_t now, struct list_head* runq, 
   1.470 +struct list_head* waitq) {
   1.471  	struct list_head     *cur,*tmp;
   1.472 -	struct sedf_dom_info *curinf;
   1.473 +	struct sedf_edom_info *curinf;
   1.474  	
   1.475  	PRINT(3,"Updating waitq..\n");
   1.476  	/*check for the first elements of the waitqueue, whether their
   1.477  	  next period has already started*/
   1.478  	list_for_each_safe(cur, tmp, waitq) {
   1.479 -		curinf = list_entry(cur, struct sedf_dom_info, list);
   1.480 -		PRINT(4,"\tLooking @ dom %i\n", curinf->owner->id);
   1.481 +		curinf = list_entry(cur, struct sedf_edom_info, list);
   1.482 +		PRINT(4,"\tLooking @ dom %i.%i\n",
   1.483 +		      curinf->exec_domain->domain->id, curinf->exec_domain->eid);
   1.484  		if (PERIOD_BEGIN(curinf) <= now) {
   1.485 -			__del_from_queue(curinf->owner);
   1.486 -			__add_to_runqueue_sort(curinf->owner);
   1.487 +			__del_from_queue(curinf->exec_domain);
   1.488 +			__add_to_runqueue_sort(curinf->exec_domain);
   1.489  		}
   1.490  		else
   1.491  			break;
   1.492 @@ -465,48 +489,52 @@ s_time_t now, struct list_head* runq, st
   1.493  	/*process the runq, find domains that are on
   1.494  	  the runqueue which shouldn't be there*/
   1.495  	list_for_each_safe(cur, tmp, runq) {
   1.496 -		curinf = list_entry(cur,struct sedf_dom_info,list);
   1.497 -		PRINT(4,"\tLooking @ dom %i\n", curinf->owner->id);
   1.498 +		curinf = list_entry(cur,struct sedf_edom_info,list);
   1.499 +		PRINT(4,"\tLooking @ dom %i.%i\n",
   1.500 +		      curinf->exec_domain->domain->id, curinf->exec_domain->eid);
   1.501  		if (unlikely(curinf->slice == 0)) {
   1.502  			/*ignore domains with empty slice*/
   1.503 -			PRINT(4,"\tUpdating zero-slice domain %i\n",
   1.504 -			      curinf->owner->id);
   1.505 -			__del_from_queue(curinf->owner);
   1.506 +			PRINT(4,"\tUpdating zero-slice domain %i.%i\n",
   1.507 +			      curinf->exec_domain->domain->id,
   1.508 +			      curinf->exec_domain->eid);
   1.509 +			__del_from_queue(curinf->exec_domain);
   1.510  			
   1.511  			/*move them to their next period*/
   1.512 -			curinf->absdead += curinf->period;
   1.513 +			curinf->deadl_abs += curinf->period;
   1.514  			/*and put them back into the queue*/
   1.515 -			__add_to_waitqueue_sort(curinf->owner);
   1.516 +			__add_to_waitqueue_sort(curinf->exec_domain);
   1.517  		}
   1.518  		else {
   1.519 -			if (unlikely((curinf->absdead < now) ||
   1.520 +			if (unlikely((curinf->deadl_abs < now) ||
   1.521  			   (curinf->cputime > curinf->slice))) {
   1.522  				/*we missed the deadline or the slice was
   1.523  				  already finished... might hapen because
   1.524  				  of dom_adj.*/
   1.525 -				PRINT(4,"\tDomain %i exceeded it's deadline/"\
   1.526 +				PRINT(4,"\tDomain %i.%i exceeded it's deadline/"\
   1.527  				       "slice (%llu / %llu) now: %llu "\
   1.528 -				       "cputime: %llu\n", curinf->owner->id,
   1.529 -				       curinf->absdead, curinf->slice, now,
   1.530 +				       "cputime: %llu\n",
   1.531 +				       curinf->exec_domain->domain->id,
   1.532 +				       curinf->exec_domain->eid,
   1.533 +				       curinf->deadl_abs, curinf->slice, now,
   1.534  				       curinf->cputime);
   1.535 -				__del_from_queue(curinf->owner);
   1.536 +				__del_from_queue(curinf->exec_domain);
   1.537  				/*common case: we miss one period!*/
   1.538 -				curinf->absdead += curinf->period;
   1.539 +				curinf->deadl_abs += curinf->period;
   1.540  				
   1.541  				/*if we are still behind: modulo arithmetic,
   1.542  				  force deadline to be in future and
   1.543  				  aligned to period borders!*/
   1.544 -				if (unlikely(curinf->absdead < now))
   1.545 -					curinf->absdead += 
   1.546 -					  DIV_UP(now - curinf->absdead,
   1.547 +				if (unlikely(curinf->deadl_abs < now))
   1.548 +					curinf->deadl_abs += 
   1.549 +					  DIV_UP(now - curinf->deadl_abs,
   1.550  					     curinf->period) * curinf->period;
   1.551 -					     
   1.552 +				ASSERT(curinf->deadl_abs > now);
   1.553  				/*give a fresh slice*/
   1.554  				curinf->cputime = 0;
   1.555 -				if (PERIOD_BEGIN(curinf) < now)
   1.556 -					__add_to_waitqueue_sort(curinf->owner);
   1.557 +				if (PERIOD_BEGIN(curinf) > now)
   1.558 +				   __add_to_waitqueue_sort(curinf->exec_domain);
   1.559  				else
   1.560 -					__add_to_runqueue_sort(curinf->owner);
   1.561 +				   __add_to_runqueue_sort(curinf->exec_domain);
   1.562  			}
   1.563  			else
   1.564  				break;
   1.565 @@ -522,8 +550,8 @@ s_time_t now, struct list_head* runq, st
   1.566       weighted ext.: insert in sorted list by score
   1.567     if the domain is blocked / has regained its short-block-loss
   1.568     time it is not put on any queue */
   1.569 -static inline void desched_extra_dom(s_time_t now, struct domain* d) {
   1.570 -	struct sedf_dom_info	*inf = DOM_INFO(d);
   1.571 +static inline void desched_extra_dom(s_time_t now, struct exec_domain* d) {
   1.572 +	struct sedf_edom_info	*inf = EDOM_INFO(d);
   1.573  	int 			i    = extra_get_cur_q(inf);
   1.574  	
   1.575  	#if (EXTRA == EXTRA_SLICE_WEIGHT || EXTRA == EXTRA_BLOCK_WEIGHT)
   1.576 @@ -535,7 +563,7 @@ static inline void desched_extra_dom(s_t
   1.577  	/*fresh slice for the next run*/
   1.578  	inf->cputime = 0;
   1.579  	/*accumulate total extratime*/
   1.580 -	inf->extra_time_tot += now - inf->sched_start;
   1.581 +	inf->extra_time_tot += now - inf->sched_start_abs;
   1.582  	/*remove extradomain from head of the queue*/
   1.583  	extraq_del(d, i);
   1.584  
   1.585 @@ -551,11 +579,13 @@ static inline void desched_extra_dom(s_t
   1.586  		/*domain was running in L0 extraq*/
   1.587  		/*reduce block lost, probably more sophistication here!*/
   1.588  		/*inf->short_block_lost_tot -= EXTRA_QUANTUM;*/
   1.589 -		inf->short_block_lost_tot -= now - inf->sched_start;
   1.590 -		PRINT(3,"Domain %i: Short_block_lost: %lli\n", 
   1.591 -		      inf->owner->id, inf->short_block_lost_tot);
   1.592 +		inf->short_block_lost_tot -= now - inf->sched_start_abs;
   1.593 +		PRINT(3,"Domain %i.%i: Short_block_loss: %lli\n", 
   1.594 +		      inf->exec_domain->domain->id, inf->exec_domain->eid,
   1.595 +		      inf->short_block_lost_tot);
   1.596  		if (inf->short_block_lost_tot <= 0) {
   1.597 -			PRINT(4,"Domain %i compensated short block loss!\n");
   1.598 +			PRINT(4,"Domain %i.%i compensated short block loss!\n",
   1.599 +			  inf->exec_domain->domain->id, inf->exec_domain->eid);
   1.600  			/*we have (over-)compensated our block penalty*/
   1.601  			inf->short_block_lost_tot = 0;
   1.602  			/*we don't want a place on the penalty queue anymore!*/
   1.603 @@ -574,6 +604,7 @@ static inline void desched_extra_dom(s_t
   1.604  	{
   1.605  		/*domain was running in L1 extraq => score is inverse of
   1.606  		  utilization and is used somewhat incremental!*/
   1.607 +//TODO: Check for weights => use them for calculating the score!
   1.608  		if (inf->slice)
   1.609  			/*NB: use fixed point arithmetic with 10 bits*/
   1.610  			inf->score[EXTRA_UTIL_Q] = (inf->period << 10) /
   1.611 @@ -586,47 +617,47 @@ static inline void desched_extra_dom(s_t
   1.612  		/*add according to score: weighted round robin*/
   1.613  		extraq_add_sort_update(d, i, oldscore);
   1.614  	else {
   1.615 -		inf->absblock = now;
   1.616 +		inf->block_abs = now;
   1.617  		/*if (!__task_on_queue(d)) 
   1.618 -			printf("Oops... We attempt to remove d %i from the "\
   1.619 -			       "waitq, but it is not on :(\n",d->id);*/
   1.620 +			printf("Oops... We attempt to remove d %i.%i from the "\
   1.621 +			       "waitq, but it is not on :(\n", d->domain->id,
   1.622 +			        d->eid);*/
   1.623  		/*remove this blocked domain from the waitq!*/
   1.624  		__del_from_queue(d);				
   1.625  		/*make sure that we remove a blocked domain from the other
   1.626  		  extraq aswell (this caused hours of debugging!)*/
   1.627  		#if (EXTRA == EXTRA_BLOCK_WEIGHT)
   1.628  		if (i == EXTRA_PEN_Q) {
   1.629 -			if (extraq_on(d,EXTRA_UTIL_Q))
   1.630 -				extraq_del(d,EXTRA_UTIL_Q);
   1.631 +			if (extraq_on(d, EXTRA_UTIL_Q))
   1.632 +				extraq_del(d, EXTRA_UTIL_Q);
   1.633  		}
   1.634  		else {
   1.635 -			if (extraq_on(d,EXTRA_PEN_Q))
   1.636 -				extraq_del(d,EXTRA_PEN_Q);
   1.637 +			if (extraq_on(d, EXTRA_PEN_Q))
   1.638 +				extraq_del(d, EXTRA_PEN_Q);
   1.639  		}
   1.640  		#endif
   1.641  	}
   1.642  	#endif
   1.643  	/*if (!domain_runnable(d)) {
   1.644 -		if (extraq_on(d,EXTRA_UTIL_Q)) {
   1.645 -			PRINT(0,"domain %i is blocked but still on L1 "\
   1.646 -			        "xq=> HALT\n",d->id);
   1.647 +		if (extraq_on(d, EXTRA_UTIL_Q)) {
   1.648 +			PRINT(0,"domain %i.%i is blocked but still on L1 "\
   1.649 +			        "xq=> HALT\n",d->domain->id, d->eid);
   1.650  			sedf_dump_cpu_state(0);(*((int*)0))++;
   1.651  		}
   1.652  		if (__task_on_queue(d)) {
   1.653 -			PRINT(0,"domain %i is blocked but still on run/waitq"\
   1.654 -			        "=> HALT\n",d->id);
   1.655 +			PRINT(0,"domain %i.%i is blocked but still on run/waitq"\
   1.656 +			        "=> HALT\n",d->domain->id, d->eid);
   1.657  			sedf_dump_cpu_state(0);(*((int*)0))++;
   1.658  		}
   1.659  	}*/
   1.660  }
   1.661  #endif
   1.662  
   1.663 -
   1.664 -static inline task_slice_t sedf_do_extra_schedule
   1.665 -(s_time_t now, s_time_t end_xt, struct list_head *extraq[], int cpu) {
   1.666 -	task_slice_t 		ret;
   1.667 -	struct sedf_dom_info	*runinf;
   1.668 +static inline struct task_slice sedf_do_extra_schedule (s_time_t now, s_time_t end_xt, struct list_head *extraq[], int cpu) {
   1.669 +	struct task_slice 		ret;
   1.670 +	struct sedf_edom_info	*runinf;
   1.671  	
   1.672 +	/* Enough time left to use for extratime? */
   1.673  	if (end_xt - now < EXTRA_QUANTUM)
   1.674  		goto return_idle;
   1.675  #if (EXTRA == EXTRA_BLOCK_WEIGHT)
   1.676 @@ -634,9 +665,9 @@ static inline task_slice_t sedf_do_extra
   1.677  		/*we still have elements on the level 0 extraq 
   1.678  		  => let those run first!*/
   1.679  		runinf   = list_entry(extraq[EXTRA_PEN_Q]->next, 
   1.680 -		              struct sedf_dom_info, extralist[EXTRA_PEN_Q]);
   1.681 +		              struct sedf_edom_info, extralist[EXTRA_PEN_Q]);
   1.682  		runinf->extra |= EXTRA_RUN_PEN;
   1.683 -		ret.task = runinf->owner;
   1.684 +		ret.task = runinf->exec_domain;
   1.685  		ret.time = EXTRA_QUANTUM;
   1.686  #ifdef SEDF_STATS
   1.687  		runinf->pen_extra_slices++;
   1.688 @@ -646,9 +677,9 @@ static inline task_slice_t sedf_do_extra
   1.689  	if (!list_empty(extraq[EXTRA_UTIL_Q])) {
   1.690  		/*use elements from the normal extraqueue*/
   1.691  		runinf   = list_entry(extraq[EXTRA_UTIL_Q]->next,
   1.692 -		              struct sedf_dom_info,extralist[EXTRA_UTIL_Q]);
   1.693 +		              struct sedf_edom_info, extralist[EXTRA_UTIL_Q]);
   1.694  		runinf->extra |= EXTRA_RUN_UTIL;
   1.695 -		ret.task = runinf->owner;
   1.696 +		ret.task = runinf->exec_domain;
   1.697  		ret.time = EXTRA_QUANTUM;
   1.698  	}
   1.699  	else
   1.700 @@ -666,20 +697,20 @@ return_idle:
   1.701     -timeslice for the current period used up
   1.702     -domain on waitqueue has started it's period
   1.703     -and various others ;) in general: determine which domain to run next*/
   1.704 -static task_slice_t sedf_do_schedule(s_time_t now)
   1.705 +static struct task_slice sedf_do_schedule(s_time_t now)
   1.706  {
   1.707  	int                   cpu      = current->processor;
   1.708  	struct list_head     *runq     = RUNQ(cpu);
   1.709  	struct list_head     *waitq    = WAITQ(cpu);
   1.710  	#if (EXTRA > EXTRA_OFF)
   1.711 -	struct sedf_dom_info *inf      = DOM_INFO(current);
   1.712 -	struct list_head     *extraq[] = {EXTRAQ(cpu,EXTRA_PEN_Q),
   1.713 +	struct sedf_edom_info *inf     = EDOM_INFO(current);
   1.714 +	struct list_head     *extraq[] = {EXTRAQ(cpu, EXTRA_PEN_Q),
   1.715  	                                  EXTRAQ(cpu, EXTRA_UTIL_Q)};
   1.716  	#endif
   1.717 -	task_slice_t          ret;
   1.718 +	struct task_slice          ret;
   1.719  	/*int i = 0;*/
   1.720  	/*idle tasks don't need any of the following stuf*/
   1.721 -	if (is_idle_task(current))
   1.722 +	if (is_idle_task(current->domain))
   1.723  		goto check_waitq;
   1.724  	
   1.725  	#if (EXTRA > EXTRA_OFF)
   1.726 @@ -696,28 +727,31 @@ static task_slice_t sedf_do_schedule(s_t
   1.727  	}
   1.728  	/*if (!domain_runnable(current)) {
   1.729  		if (extraq_on(current,EXTRA_UTIL_Q)) {
   1.730 -			PRINT(0,"domain %i is blocked but still on L1 xq"\
   1.731 -			        " branch %i=> HALT\n", current->id, i);
   1.732 +			PRINT(0,"domain %i.%i is blocked but still on L1 xq"\
   1.733 +			        " branch %i=> HALT\n", current->domain->id,
   1.734 +				current->eid, i);
   1.735  			sedf_dump_cpu_state(0);(*((int*)0))++;
   1.736  		}
   1.737  		if (__task_on_queue(current)) {
   1.738 -			PRINT(0,"domain %i is blocked but still on run/waitq"\
   1.739 -			        " branch %i=> HALT\n",current->id,i);
   1.740 +			PRINT(0,"domain %i.%i is blocked but still on run/waitq"\
   1.741 +			        " branch %i=> HALT\n",current->domain->id,
   1.742 +				d->eid,i);
   1.743  			sedf_dump_cpu_state(0);(*((int*)0))++;
   1.744  		}
   1.745  	}*/
   1.746  check_waitq:
   1.747  	update_queues(now, runq, waitq);
   1.748  	
   1.749 -	/*now simply pick the first domain from the runqueue*/
   1.750 -	struct sedf_dom_info *runinf, *waitinf;
   1.751 +	/*now simply pick the first domain from the runqueue, which has the
   1.752 +	  earliest deadline, because the list is sorted*/
   1.753 +	struct sedf_edom_info *runinf, *waitinf;
   1.754  	
   1.755  	if (!list_empty(runq)) {
   1.756 -		runinf   = list_entry(runq->next,struct sedf_dom_info,list);
   1.757 -		ret.task = runinf->owner;
   1.758 +		runinf   = list_entry(runq->next,struct sedf_edom_info,list);
   1.759 +		ret.task = runinf->exec_domain;
   1.760  		if (!list_empty(waitq)) {
   1.761  			waitinf  = list_entry(waitq->next,
   1.762 -			               struct sedf_dom_info,list);
   1.763 +			               struct sedf_edom_info,list);
   1.764  			/*rerun scheduler, when scheduled domain reaches it's
   1.765  			  end of slice or the first domain from the waitqueue
   1.766  			  gets ready*/
   1.767 @@ -727,11 +761,12 @@ check_waitq:
   1.768  		else {
   1.769  			ret.time = runinf->slice - runinf->cputime;
   1.770  		}
   1.771 +		ASSERT(ret.time > now);
   1.772  		goto sched_done;
   1.773  	}
   1.774  	
   1.775  	if (!list_empty(waitq)) {
   1.776 -		waitinf  = list_entry(waitq->next,struct sedf_dom_info,list);
   1.777 +		waitinf  = list_entry(waitq->next,struct sedf_edom_info, list);
   1.778  		/*we could not find any suitable domain 
   1.779  		  => look for domains that are aware of extratime*/
   1.780  		#if (EXTRA > EXTRA_OFF)
   1.781 @@ -741,6 +776,7 @@ check_waitq:
   1.782  		ret.task = IDLETASK(cpu);
   1.783  		ret.time = PERIOD_BEGIN(waitinf) - now;
   1.784  		#endif
   1.785 +		ASSERT(ret.time > now);
   1.786  	}
   1.787  	else {
   1.788  		/*this could probably never happen, but one never knows...*/
   1.789 @@ -758,13 +794,13 @@ sched_done:
   1.790  		       ret.time);
   1.791  		ret.time = EXTRA_QUANTUM;
   1.792  	}
   1.793 -	DOM_INFO(ret.task)->sched_start=now;
   1.794 +	EDOM_INFO(ret.task)->sched_start_abs = now;
   1.795  	return ret;
   1.796  }
   1.797  
   1.798 -static void sedf_sleep(struct domain *d) {
   1.799 -	PRINT(2,"sedf_sleep was called, domain-id %i\n",d->id);
   1.800 -	if ( test_bit(DF_RUNNING, &d->flags) ) {
   1.801 +static void sedf_sleep(struct exec_domain *d) {
   1.802 +	PRINT(2,"sedf_sleep was called, domain-id %i.%i\n",d->domain->id, d->eid);
   1.803 +	if ( test_bit(EDF_RUNNING, &d->ed_flags) ) {
   1.804  #ifdef ADV_SCHED_HISTO
   1.805  		adv_sched_hist_start(d->processor);
   1.806  #endif
   1.807 @@ -856,15 +892,15 @@ static void sedf_sleep(struct domain *d)
   1.808   *      opposed to approaches 1,2a,2b
   1.809   */
   1.810  static inline void unblock_short_vcons
   1.811 -(struct sedf_dom_info* inf, s_time_t now) {
   1.812 -	inf->absdead += inf->period;
   1.813 +(struct sedf_edom_info* inf, s_time_t now) {
   1.814 +	inf->deadl_abs += inf->period;
   1.815  	inf->cputime = 0;
   1.816  }
   1.817  
   1.818 -static inline void unblock_short_cons(struct sedf_dom_info* inf, s_time_t now)
   1.819 +static inline void unblock_short_cons(struct sedf_edom_info* inf, s_time_t now)
   1.820  {
   1.821  	/*treat blocked time as consumed by the domain*/
   1.822 -	inf->cputime += now - inf->absblock;	
   1.823 +	inf->cputime += now - inf->block_abs;	
   1.824  	if (inf->cputime + EXTRA_QUANTUM > inf->slice) {
   1.825  		/*we don't have a reasonable amount of time in 
   1.826  		  our slice left :( => start in next period!*/
   1.827 @@ -875,7 +911,7 @@ static inline void unblock_short_cons(st
   1.828  		inf->short_cont++;
   1.829  #endif
   1.830  }
   1.831 -static inline void unblock_short_extra_support (struct sedf_dom_info* inf,
   1.832 +static inline void unblock_short_extra_support (struct sedf_edom_info* inf,
   1.833     s_time_t now) {
   1.834  	/*this unblocking scheme tries to support the domain, by assigning it
   1.835  	   a priority in extratime distribution according to the loss of time
   1.836 @@ -883,10 +919,12 @@ static inline void unblock_short_extra_s
   1.837  	s_time_t pen;
   1.838  	
   1.839  	/*no more realtime execution in this period!*/
   1.840 -	inf->absdead += inf->period;
   1.841 -	if (likely(inf->absblock)) {
   1.842 +	inf->deadl_abs += inf->period;
   1.843 +	if (likely(inf->block_abs)) {
   1.844  		//treat blocked time as consumed by the domain*/
   1.845 -		/*inf->cputime += now - inf->absblock;*/	
   1.846 +		/*inf->cputime += now - inf->block_abs;*/
   1.847 +		/*penalty is time the domain would have
   1.848 +		  had if it continued to run */
   1.849  		pen = (inf->slice - inf->cputime);
   1.850  		if (pen < 0) pen = 0;
   1.851  		/*accumulate all penalties over the periods*/
   1.852 @@ -901,9 +939,9 @@ static inline void unblock_short_extra_s
   1.853  #ifdef SEDF_STATS
   1.854  			inf->pen_extra_blocks++;
   1.855  #endif
   1.856 -			if (extraq_on(inf->owner, EXTRA_PEN_Q))
   1.857 +			if (extraq_on(inf->exec_domain, EXTRA_PEN_Q))
   1.858  				/*remove domain for possible resorting!*/
   1.859 -				extraq_del(inf->owner, EXTRA_PEN_Q);
   1.860 +				extraq_del(inf->exec_domain, EXTRA_PEN_Q);
   1.861  			else
   1.862  				/*remember that we want to be on the penalty q
   1.863  				  so that we can continue when we (un-)block
   1.864 @@ -911,39 +949,39 @@ static inline void unblock_short_extra_s
   1.865  				inf->extra |= EXTRA_WANT_PEN_Q;
   1.866  			
   1.867  			/*(re-)add domain to the penalty extraq*/
   1.868 -			extraq_add_sort_update(inf->owner,
   1.869 +			extraq_add_sort_update(inf->exec_domain,
   1.870  					 EXTRA_PEN_Q, 0);
   1.871  		}
   1.872  	}
   1.873  	/*give it a fresh slice in the next period!*/
   1.874  	inf->cputime = 0;
   1.875  }
   1.876 -static inline void unblock_long_vcons(struct sedf_dom_info* inf, s_time_t now)
   1.877 +static inline void unblock_long_vcons(struct sedf_edom_info* inf, s_time_t now)
   1.878  {
   1.879  	/* align to next future period */
   1.880 -	inf->absdead += ((now - inf->absdead) / inf->period + 1)
   1.881 +	inf->deadl_abs += (DIV_UP(now - inf->deadl_abs, inf->period) +1)
   1.882  	                 * inf->period;
   1.883  	inf->cputime = 0;
   1.884  }
   1.885  
   1.886 -static inline void unblock_long_cons_a (struct sedf_dom_info* inf,
   1.887 +static inline void unblock_long_cons_a (struct sedf_edom_info* inf,
   1.888     s_time_t now) {
   1.889  	/*treat the time the domain was blocked in the
   1.890  	  CURRENT period as consumed by the domain*/
   1.891 -	inf->cputime = (now - inf->absdead) % inf->period;	
   1.892 +	inf->cputime = (now - inf->deadl_abs) % inf->period;	
   1.893  	if (inf->cputime + EXTRA_QUANTUM > inf->slice) {
   1.894  		/*we don't have a reasonable amount of time in our slice
   1.895  		  left :( => start in next period!*/
   1.896  		unblock_long_vcons(inf, now);
   1.897  	}
   1.898  }
   1.899 -static inline void unblock_long_cons_b(struct sedf_dom_info* inf,s_time_t now) {
   1.900 +static inline void unblock_long_cons_b(struct sedf_edom_info* inf,s_time_t now) {
   1.901  	/*Conservative 2b*/
   1.902  	/*Treat the unblocking time as a start of a new period */
   1.903 -	inf->absdead = now + inf->period;
   1.904 +	inf->deadl_abs = now + inf->period;
   1.905  	inf->cputime = 0;
   1.906  }
   1.907 -static inline void unblock_long_cons_c(struct sedf_dom_info* inf,s_time_t now) {
   1.908 +static inline void unblock_long_cons_c(struct sedf_edom_info* inf,s_time_t now) {
   1.909  	if (likely(inf->latency)) {
   1.910  		/*scale the slice and period accordingly to the latency hint*/
   1.911  		/*reduce period temporarily to the latency hint*/
   1.912 @@ -954,7 +992,7 @@ static inline void unblock_long_cons_c(s
   1.913  		/*scale slice accordingly, so that utilisation stays the same*/
   1.914  		inf->slice = (inf->period * inf->slice_orig)
   1.915  		            / inf->period_orig;
   1.916 -		inf->absdead = now + inf->period;
   1.917 +		inf->deadl_abs = now + inf->period;
   1.918  		inf->cputime = 0;
   1.919  	}	
   1.920  	else {
   1.921 @@ -963,10 +1001,10 @@ static inline void unblock_long_cons_c(s
   1.922  	}
   1.923  }
   1.924  /*a new idea of dealing with short blocks: burst period scaling*/
   1.925 -static inline void unblock_short_burst(struct sedf_dom_info* inf, s_time_t now)
   1.926 +static inline void unblock_short_burst(struct sedf_edom_info* inf, s_time_t now)
   1.927  {
   1.928  	/*treat blocked time as consumed by the domain*/
   1.929 -	inf->cputime += now - inf->absblock;
   1.930 +	inf->cputime += now - inf->block_abs;
   1.931  	
   1.932  	if (inf->cputime + EXTRA_QUANTUM <= inf->slice) {
   1.933  		/*if we can still use some time in the current slice
   1.934 @@ -979,11 +1017,11 @@ static inline void unblock_short_burst(s
   1.935  	else {
   1.936  		/*we don't have a reasonable amount of time in
   1.937  		  our slice left => switch to burst mode*/
   1.938 -		if (likely(inf->absunblock)) {
   1.939 +		if (likely(inf->unblock_abs)) {
   1.940  			/*set the period-length to the current blocking
   1.941  			  interval, possible enhancements: average over last
   1.942  			  blocking intervals, user-specified minimum,...*/
   1.943 -			inf->period = now - inf->absunblock;
   1.944 +			inf->period = now - inf->unblock_abs;
   1.945  			/*check for overflow on multiplication*/
   1.946  			ASSERT((inf->period < ULONG_MAX) 
   1.947  			    && (inf->slice_orig < ULONG_MAX));
   1.948 @@ -992,18 +1030,18 @@ static inline void unblock_short_burst(s
   1.949  			inf->slice = (inf->period * inf->slice_orig)
   1.950  			            / inf->period_orig;
   1.951  			/*set new (shorter) deadline*/
   1.952 -			inf->absdead += inf->period;
   1.953 +			inf->deadl_abs += inf->period;
   1.954  		}
   1.955  		else {
   1.956  			/*in case we haven't unblocked before
   1.957  			  start in next period!*/
   1.958  			inf->cputime=0;
   1.959 -			inf->absdead += inf->period;
   1.960 +			inf->deadl_abs += inf->period;
   1.961  		}
   1.962  	}
   1.963 -	inf->absunblock = now;
   1.964 +	inf->unblock_abs = now;
   1.965  }
   1.966 -static inline void unblock_long_burst(struct sedf_dom_info* inf,s_time_t now) {
   1.967 +static inline void unblock_long_burst(struct sedf_edom_info* inf, s_time_t now) {
   1.968  	if (unlikely(inf->latency && (inf->period > inf->latency))) {
   1.969  		/*scale the slice and period accordingly to the latency hint*/
   1.970  		inf->period = inf->latency;
   1.971 @@ -1013,7 +1051,7 @@ static inline void unblock_long_burst(st
   1.972  		/*scale slice accordingly, so that utilisation stays the same*/
   1.973  		inf->slice = (inf->period * inf->slice_orig)
   1.974  		            / inf->period_orig;
   1.975 -		inf->absdead = now + inf->period;
   1.976 +		inf->deadl_abs = now + inf->period;
   1.977  		inf->cputime = 0;
   1.978  	}
   1.979  	else {
   1.980 @@ -1023,16 +1061,16 @@ static inline void unblock_long_burst(st
   1.981  		  when we are in sync with the device!*/
   1.982  		unblock_long_cons_b(inf, now);
   1.983  	}
   1.984 -	inf->absunblock = now;
   1.985 +	inf->unblock_abs = now;
   1.986  }
   1.987  
   1.988  #define DOMAIN_EDF 		1
   1.989  #define DOMAIN_EXTRA_PEN 	2
   1.990  #define DOMAIN_EXTRA_UTIL 	3
   1.991  #define DOMAIN_IDLE 		4
   1.992 -static inline int get_run_type(struct domain* d) {
   1.993 -	struct sedf_dom_info* inf = DOM_INFO(d);
   1.994 -	if (is_idle_task(d))
   1.995 +static inline int get_run_type(struct exec_domain* d) {
   1.996 +	struct sedf_edom_info* inf = EDOM_INFO(d);
   1.997 +	if (is_idle_task(d->domain))
   1.998  		return DOMAIN_IDLE;
   1.999  	if (inf->extra & EXTRA_RUN_PEN)
  1.1000  		return DOMAIN_EXTRA_PEN;
  1.1001 @@ -1049,11 +1087,11 @@ static inline int get_run_type(struct do
  1.1002    In the same class priorities are assigned as following:
  1.1003    	EDF: early deadline > late deadline
  1.1004    	L0 extra-time: lower score > higher score*/
  1.1005 -static inline int should_switch(struct domain* cur, struct domain* other,
  1.1006 -    s_time_t now) {
  1.1007 -	struct sedf_dom_info *cur_inf, *other_inf;
  1.1008 -	cur_inf   = DOM_INFO(cur);
  1.1009 -	other_inf = DOM_INFO(other);
  1.1010 +static inline int should_switch(struct exec_domain* cur,
  1.1011 +   struct exec_domain* other, s_time_t now) {
  1.1012 +	struct sedf_edom_info *cur_inf, *other_inf;
  1.1013 +	cur_inf   = EDOM_INFO(cur);
  1.1014 +	other_inf = EDOM_INFO(other);
  1.1015  	
  1.1016  	/*check whether we need to make an earlier sched-decision*/
  1.1017  	if ((PERIOD_BEGIN(other_inf) < 
  1.1018 @@ -1082,32 +1120,35 @@ static inline int should_switch(struct d
  1.1019  			return 1;
  1.1020  	}
  1.1021  }
  1.1022 -void sedf_wake(struct domain *d) {
  1.1023 +void sedf_wake(struct exec_domain *d) {
  1.1024  	s_time_t              now = NOW();
  1.1025 -	struct sedf_dom_info* inf = DOM_INFO(d);
  1.1026 +	struct sedf_edom_info* inf = EDOM_INFO(d);
  1.1027  	
  1.1028 -	PRINT(3,"sedf_wake was called, domain-id %i\n",d->id);
  1.1029 +	PRINT(3,"sedf_wake was called, domain-id %i.%i\n",d->domain->id, d->eid);
  1.1030  	
  1.1031 -	if (unlikely(is_idle_task(d)))
  1.1032 +	if (unlikely(is_idle_task(d->domain)))
  1.1033  		return;
  1.1034  	
  1.1035  	if ( unlikely(__task_on_queue(d)) ) {
  1.1036 -		PRINT(3,"\tdomain %i is already in some queue\n",d->id);
  1.1037 +		PRINT(3,"\tdomain %i.%i is already in some queue\n",
  1.1038 +		      d->domain->id, d->eid);
  1.1039  		return;
  1.1040  	}
  1.1041  	if ( unlikely(extraq_on(d,EXTRA_UTIL_Q) || extraq_on(d,EXTRA_PEN_Q)) ) {
  1.1042 -		PRINT(3,"\tdomain %i is already in the extraQ\n",d->id);
  1.1043 +		PRINT(3,"\tdomain %i.%i is already in the extraQ\n",
  1.1044 +		   d->domain->id, d->eid);
  1.1045  	}
  1.1046 -	if (unlikely(inf->absdead == 0))
  1.1047 +	if (unlikely(inf->deadl_abs == 0))
  1.1048  		/*initial setup of the deadline*/
  1.1049 -		inf->absdead = now + inf->slice;
  1.1050 +		inf->deadl_abs = now + inf->slice;
  1.1051  		
  1.1052 -	PRINT(3,"waking up domain %i (deadl= %llu period= %llu "\
  1.1053 -	        "now= %llu)\n",d->id,inf->absdead,inf->period,now);
  1.1054 +	PRINT(3,"waking up domain %i.%i (deadl= %llu period= %llu "\
  1.1055 +	        "now= %llu)\n", d->domain->id, d->eid, inf->deadl_abs,
  1.1056 +		 inf->period, now);
  1.1057  #ifdef SEDF_STATS	
  1.1058  	inf->block_tot++;
  1.1059  #endif
  1.1060 -	if (unlikely(now< PERIOD_BEGIN(inf))) {
  1.1061 +	if (unlikely(now < PERIOD_BEGIN(inf))) {
  1.1062  		PRINT(4,"extratime unblock\n");
  1.1063  		/*this might happen, imagine unblocking in extra-time!*/
  1.1064  		#if (EXTRA == EXTRA_BLOCK_WEIGHT)
  1.1065 @@ -1134,7 +1175,7 @@ void sedf_wake(struct domain *d) {
  1.1066  		/*This is very very unlikely, ie. might even be an error?!*/
  1.1067  	}		
  1.1068  	else {		
  1.1069 -		if (now < inf->absdead) {
  1.1070 +		if (now < inf->deadl_abs) {
  1.1071  			PRINT(4,"short unblocking\n");
  1.1072  			/*short blocking*/
  1.1073  #ifdef SEDF_STATS
  1.1074 @@ -1194,24 +1235,25 @@ void sedf_wake(struct domain *d) {
  1.1075  			
  1.1076  		}
  1.1077  	}
  1.1078 -	PRINT(3,"woke up domain %i (deadl= %llu period= %llu "\
  1.1079 -	        "now= %llu)\n",d->id,inf->absdead,inf->period,now);
  1.1080 +	PRINT(3,"woke up domain %i.%i (deadl= %llu period= %llu "\
  1.1081 +	        "now= %llu)\n", d->domain->id, d->eid, inf->deadl_abs,
  1.1082 +		inf->period, now);
  1.1083  	__add_to_waitqueue_sort(d);
  1.1084  	PRINT(3,"added to waitq\n");	
  1.1085  	
  1.1086  #ifdef SEDF_STATS
  1.1087  	/*do some statistics here...*/
  1.1088 -	if (inf->absblock != 0) {
  1.1089 -		inf->block_time_tot += now - inf->absblock;
  1.1090 +	if (inf->block_abs != 0) {
  1.1091 +		inf->block_time_tot += now - inf->block_abs;
  1.1092  		inf->penalty_time_tot +=
  1.1093 -		   PERIOD_BEGIN(inf) + inf->cputime - inf->absblock;
  1.1094 +		   PERIOD_BEGIN(inf) + inf->cputime - inf->block_abs;
  1.1095  	}
  1.1096  #endif
  1.1097  	/*sanity check: make sure each extra-aware domain IS on the util-q!*/
  1.1098  	/*if (inf->extra & EXTRA_AWARE) {
  1.1099  		if (!extraq_on(d, EXTRA_UTIL_Q))
  1.1100 -			printf("sedf_wake: domain %i is extra-aware, "\
  1.1101 -			       "but NOT on L1 extraq!\n",d->id);
  1.1102 +			printf("sedf_wake: domain %i.%i is extra-aware, "\
  1.1103 +			       "but NOT on L1 extraq!\n",d->domain->id, d->eid);
  1.1104  	}*/
  1.1105  	
  1.1106  	/*check whether the awakened task needs to invoke the do_schedule
  1.1107 @@ -1226,34 +1268,34 @@ void sedf_wake(struct domain *d) {
  1.1108  }
  1.1109  
  1.1110  /*Print a lot of use-{full, less} information about a domains in the system*/
  1.1111 -static void sedf_dump_domain(struct domain *d) {
  1.1112 -	printk("%u has=%c ", d->id,
  1.1113 -		test_bit(DF_RUNNING, &d->flags) ? 'T':'F');
  1.1114 +static void sedf_dump_domain(struct exec_domain *d) {
  1.1115 +	printk("%i.%i has=%c ", d->domain->id, d->eid,
  1.1116 +		test_bit(EDF_RUNNING, &d->ed_flags) ? 'T':'F');
  1.1117  	printk("p=%llu sl=%llu ddl=%llu w=%hu c=%llu sc=%i xtr(%s)=%llu",
  1.1118 -	  DOM_INFO(d)->period, DOM_INFO(d)->slice, DOM_INFO(d)->absdead,
  1.1119 -	  DOM_INFO(d)->weight, d->cpu_time, DOM_INFO(d)->score[EXTRA_UTIL_Q],
  1.1120 -	 (DOM_INFO(d)->extra & EXTRA_AWARE) ? "yes" : "no",
  1.1121 -	  DOM_INFO(d)->extra_time_tot);
  1.1122 +	  EDOM_INFO(d)->period, EDOM_INFO(d)->slice, EDOM_INFO(d)->deadl_abs,
  1.1123 +	  EDOM_INFO(d)->weight, d->cpu_time, EDOM_INFO(d)->score[EXTRA_UTIL_Q],
  1.1124 +	 (EDOM_INFO(d)->extra & EXTRA_AWARE) ? "yes" : "no",
  1.1125 +	  EDOM_INFO(d)->extra_time_tot);
  1.1126  	if (d->cpu_time !=0)
  1.1127 -		printf(" (%lu%)", (DOM_INFO(d)->extra_time_tot * 100)
  1.1128 +		printf(" (%lu%)", (EDOM_INFO(d)->extra_time_tot * 100)
  1.1129  		                 / d->cpu_time);
  1.1130  #ifdef SEDF_STATS
  1.1131 -	if (DOM_INFO(d)->block_time_tot!=0)
  1.1132 -		printf(" pen=%lu%", (DOM_INFO(d)->penalty_time_tot * 100) /
  1.1133 -		                     DOM_INFO(d)->block_time_tot);
  1.1134 -	if (DOM_INFO(d)->block_tot!=0)
  1.1135 +	if (EDOM_INFO(d)->block_time_tot!=0)
  1.1136 +		printf(" pen=%lu%", (EDOM_INFO(d)->penalty_time_tot * 100) /
  1.1137 +		                     EDOM_INFO(d)->block_time_tot);
  1.1138 +	if (EDOM_INFO(d)->block_tot!=0)
  1.1139  		printf("\n   blks=%lu sh=%lu (%lu%) (shc=%lu (%lu%) shex=%i "\
  1.1140  		       "shexsl=%i) l=%lu (%lu%) avg: b=%llu p=%llu",
  1.1141 -		    DOM_INFO(d)->block_tot, DOM_INFO(d)->short_block_tot,
  1.1142 -		   (DOM_INFO(d)->short_block_tot * 100) 
  1.1143 -		  / DOM_INFO(d)->block_tot, DOM_INFO(d)->short_cont,
  1.1144 -		   (DOM_INFO(d)->short_cont * 100) / DOM_INFO(d)->block_tot,
  1.1145 -		    DOM_INFO(d)->pen_extra_blocks,
  1.1146 -		    DOM_INFO(d)->pen_extra_slices,
  1.1147 -		    DOM_INFO(d)->long_block_tot,
  1.1148 -		   (DOM_INFO(d)->long_block_tot * 100) / DOM_INFO(d)->block_tot,
  1.1149 -		   (DOM_INFO(d)->block_time_tot) / DOM_INFO(d)->block_tot,
  1.1150 -		   (DOM_INFO(d)->penalty_time_tot) / DOM_INFO(d)->block_tot);
  1.1151 +		    EDOM_INFO(d)->block_tot, EDOM_INFO(d)->short_block_tot,
  1.1152 +		   (EDOM_INFO(d)->short_block_tot * 100) 
  1.1153 +		  / EDOM_INFO(d)->block_tot, EDOM_INFO(d)->short_cont,
  1.1154 +		   (EDOM_INFO(d)->short_cont * 100) / EDOM_INFO(d)->block_tot,
  1.1155 +		    EDOM_INFO(d)->pen_extra_blocks,
  1.1156 +		    EDOM_INFO(d)->pen_extra_slices,
  1.1157 +		    EDOM_INFO(d)->long_block_tot,
  1.1158 +		   (EDOM_INFO(d)->long_block_tot * 100) / EDOM_INFO(d)->block_tot,
  1.1159 +		   (EDOM_INFO(d)->block_time_tot) / EDOM_INFO(d)->block_tot,
  1.1160 +		   (EDOM_INFO(d)->penalty_time_tot) / EDOM_INFO(d)->block_tot);
  1.1161  #endif
  1.1162  	printf("\n");
  1.1163  }
  1.1164 @@ -1261,10 +1303,11 @@ static void sedf_dump_domain(struct doma
  1.1165  /*dumps all domains on hte specified cpu*/
  1.1166  static void sedf_dump_cpu_state(int i)
  1.1167  {
  1.1168 -	struct list_head *list, *queue, *tmp;
  1.1169 +	struct list_head      *list, *queue, *tmp;
  1.1170 +	struct sedf_edom_info *d_inf;
  1.1171 +	struct domain         *d;
  1.1172 +	struct exec_domain    *ed;
  1.1173  	int loop = 0;
  1.1174 -	struct sedf_dom_info *d_inf;
  1.1175 -	struct domain* d;
  1.1176  	
  1.1177  	printk("now=%llu\n",NOW());
  1.1178  	queue = RUNQ(i);
  1.1179 @@ -1272,8 +1315,8 @@ static void sedf_dump_cpu_state(int i)
  1.1180  		(unsigned long) queue->next, (unsigned long) queue->prev);
  1.1181  	list_for_each_safe ( list, tmp, queue ) {
  1.1182  		printk("%3d: ",loop++);
  1.1183 -		d_inf = list_entry(list, struct sedf_dom_info, list);
  1.1184 -		sedf_dump_domain(d_inf->owner);
  1.1185 +		d_inf = list_entry(list, struct sedf_edom_info, list);
  1.1186 +		sedf_dump_domain(d_inf->exec_domain);
  1.1187  	}
  1.1188  	
  1.1189  	queue = WAITQ(i); loop = 0;
  1.1190 @@ -1281,8 +1324,8 @@ static void sedf_dump_cpu_state(int i)
  1.1191  		(unsigned long) queue->next, (unsigned long) queue->prev);
  1.1192  	list_for_each_safe ( list, tmp, queue ) {
  1.1193  		printk("%3d: ",loop++);
  1.1194 -		d_inf = list_entry(list, struct sedf_dom_info, list);
  1.1195 -		sedf_dump_domain(d_inf->owner);
  1.1196 +		d_inf = list_entry(list, struct sedf_edom_info, list);
  1.1197 +		sedf_dump_domain(d_inf->exec_domain);
  1.1198  	}
  1.1199  	
  1.1200  	queue = EXTRAQ(i,EXTRA_PEN_Q); loop = 0;
  1.1201 @@ -1290,10 +1333,10 @@ static void sedf_dump_cpu_state(int i)
  1.1202  	       (unsigned long)queue, (unsigned long) queue->next,
  1.1203  	       (unsigned long) queue->prev);
  1.1204  	list_for_each_safe ( list, tmp, queue ) {
  1.1205 -		d_inf = list_entry(list, struct sedf_dom_info,
  1.1206 +		d_inf = list_entry(list, struct sedf_edom_info,
  1.1207  		                   extralist[EXTRA_PEN_Q]);
  1.1208  		printk("%3d: ",loop++);
  1.1209 -		sedf_dump_domain(d_inf->owner);
  1.1210 +		sedf_dump_domain(d_inf->exec_domain);
  1.1211  	}
  1.1212  	
  1.1213  	queue = EXTRAQ(i,EXTRA_UTIL_Q); loop = 0;
  1.1214 @@ -1301,36 +1344,40 @@ static void sedf_dump_cpu_state(int i)
  1.1215  	       (unsigned long)queue, (unsigned long) queue->next,
  1.1216  	       (unsigned long) queue->prev);
  1.1217  	list_for_each_safe ( list, tmp, queue )	{
  1.1218 -		d_inf = list_entry(list, struct sedf_dom_info,
  1.1219 +		d_inf = list_entry(list, struct sedf_edom_info,
  1.1220  		                   extralist[EXTRA_UTIL_Q]);
  1.1221  		printk("%3d: ",loop++);
  1.1222 -		sedf_dump_domain(d_inf->owner);
  1.1223 +		sedf_dump_domain(d_inf->exec_domain);
  1.1224  	}
  1.1225  	
  1.1226  	loop = 0;
  1.1227  	printk("\nnot on Q\n");
  1.1228 -	for_each_domain(d) {
  1.1229 -		if (!__task_on_queue(d) && (d->processor == i)) {
  1.1230 -			printk("%3d: ",loop++);
  1.1231 -			sedf_dump_domain(d);
  1.1232 +	for_each_domain(d)
  1.1233 +		for_each_exec_domain(d, ed)
  1.1234 +		{
  1.1235 +			if (!__task_on_queue(ed) && (ed->processor == i)) {
  1.1236 +				printk("%3d: ",loop++);
  1.1237 +				sedf_dump_domain(ed);
  1.1238 +			}
  1.1239  		}
  1.1240 -	}
  1.1241  }
  1.1242  /*Adjusts periods and slices of the domains accordingly to their weights*/
  1.1243 -static inline int sedf_adjust_weights(struct domain *p, 
  1.1244 -struct sched_adjdom_cmd *cmd) {
  1.1245 -	int sumw[NR_CPUS];
  1.1246 -	s_time_t sumt[NR_CPUS];
  1.1247 -	int cpu;
  1.1248 +static inline int sedf_adjust_weights(struct sched_adjdom_cmd *cmd) {
  1.1249 +	struct exec_domain *p;
  1.1250 +	struct domain      *d;
  1.1251 +	int                 sumw[NR_CPUS];
  1.1252 +	s_time_t            sumt[NR_CPUS];
  1.1253 +	int                 cpu;
  1.1254  	
  1.1255  	for (cpu=0; cpu < NR_CPUS; cpu++) {
  1.1256  		sumw[cpu] = 0;
  1.1257  		sumt[cpu] = 0;
  1.1258  	}
  1.1259  	/*sum up all weights*/
  1.1260 -	for_each_domain(p) {
  1.1261 -		if (DOM_INFO(p)->weight)
  1.1262 -			sumw[p->processor] += DOM_INFO(p)->weight;
  1.1263 +	for_each_domain(d)
  1.1264 +	  for_each_exec_domain(d, p) {
  1.1265 +		if (EDOM_INFO(p)->weight)
  1.1266 +			sumw[p->processor] += EDOM_INFO(p)->weight;
  1.1267  		else {
  1.1268  			/*don't modify domains who don't have a weight, but sum
  1.1269  			  up the time they need, projected to a WEIGHT_PERIOD,
  1.1270 @@ -1338,18 +1385,19 @@ struct sched_adjdom_cmd *cmd) {
  1.1271  			  domains*/
  1.1272  			/*check for overflows*/
  1.1273  			ASSERT((WEIGHT_PERIOD < ULONG_MAX) 
  1.1274 -			    && (DOM_INFO(p)->slice_orig < ULONG_MAX));
  1.1275 +			    && (EDOM_INFO(p)->slice_orig < ULONG_MAX));
  1.1276  			sumt[p->processor] += (WEIGHT_PERIOD *
  1.1277 -			    DOM_INFO(p)->slice_orig) / DOM_INFO(p)->period_orig;
  1.1278 +			    EDOM_INFO(p)->slice_orig) / EDOM_INFO(p)->period_orig;
  1.1279  		}
  1.1280  	}
  1.1281  	/*adjust all slices (and periods) to the new weight*/
  1.1282 -	for_each_domain(p) {
  1.1283 -		if (DOM_INFO(p)->weight) {
  1.1284 -			DOM_INFO(p)->period_orig = 
  1.1285 -			     DOM_INFO(p)->period = WEIGHT_PERIOD;
  1.1286 -			DOM_INFO(p)->slice_orig  =
  1.1287 -			      DOM_INFO(p)->slice = (DOM_INFO(p)->weight *
  1.1288 +	for_each_domain(d) 
  1.1289 +	  for_each_exec_domain(d, p) {
  1.1290 +		if (EDOM_INFO(p)->weight) {
  1.1291 +			EDOM_INFO(p)->period_orig = 
  1.1292 +			     EDOM_INFO(p)->period = WEIGHT_PERIOD;
  1.1293 +			EDOM_INFO(p)->slice_orig  =
  1.1294 +			      EDOM_INFO(p)->slice = (EDOM_INFO(p)->weight *
  1.1295  			      (WEIGHT_PERIOD -WEIGHT_SAFETY -
  1.1296  			       sumt[p->processor])) / sumw[p->processor];
  1.1297  		}
  1.1298 @@ -1359,6 +1407,8 @@ struct sched_adjdom_cmd *cmd) {
  1.1299  
  1.1300  /* set or fetch domain scheduling parameters */
  1.1301  static int sedf_adjdom(struct domain *p, struct sched_adjdom_cmd *cmd) {
  1.1302 +	struct exec_domain *ed;
  1.1303 +	
  1.1304  	PRINT(2,"sedf_adjdom was called, domain-id %i new period %llu "\
  1.1305  	        "new slice %llu\nlatency %llu extra:%s\n",
  1.1306  		p->id, cmd->u.sedf.period, cmd->u.sedf.slice,
  1.1307 @@ -1370,33 +1420,40 @@ static int sedf_adjdom(struct domain *p,
  1.1308  			return -EINVAL;
  1.1309  		/*weight driven domains*/
  1.1310  		if (cmd->u.sedf.weight) {
  1.1311 -			DOM_INFO(p)->weight = cmd->u.sedf.weight;
  1.1312 +			for_each_exec_domain(p, ed)
  1.1313 +				EDOM_INFO(ed)->weight = cmd->u.sedf.weight;
  1.1314  		}
  1.1315  		else {
  1.1316  			/*time driven domains*/
  1.1317 -			DOM_INFO(p)->weight = 0;
  1.1318 -			/* sanity checking! */
  1.1319 -			if(cmd->u.sedf.slice > cmd->u.sedf.period )
  1.1320 -				return -EINVAL;
  1.1321 -			DOM_INFO(p)->period_orig = 
  1.1322 -			   DOM_INFO(p)->period   = cmd->u.sedf.period;
  1.1323 -			DOM_INFO(p)->slice_orig  = 
  1.1324 -			   DOM_INFO(p)->slice    = cmd->u.sedf.slice;
  1.1325 +			for_each_exec_domain(p, ed) {
  1.1326 +				/* sanity checking! */
  1.1327 +				if(cmd->u.sedf.slice > cmd->u.sedf.period )
  1.1328 +					return -EINVAL;
  1.1329 +				EDOM_INFO(ed)->weight = 0;
  1.1330 +				EDOM_INFO(ed)->period_orig = 
  1.1331 +				EDOM_INFO(ed)->period   = cmd->u.sedf.period;
  1.1332 +				EDOM_INFO(ed)->slice_orig  = 
  1.1333 +				EDOM_INFO(ed)->slice    = cmd->u.sedf.slice;
  1.1334 +			}
  1.1335  		}
  1.1336 -		if (sedf_adjust_weights(p,cmd))
  1.1337 +		if (sedf_adjust_weights(cmd))
  1.1338  			return -EINVAL;
  1.1339 -		DOM_INFO(p)->extra       = (DOM_INFO(p)-> extra & ~EXTRA_AWARE)
  1.1340 -		    | (cmd->u.sedf.extratime & EXTRA_AWARE);
  1.1341 -		DOM_INFO(p)->latency     = cmd->u.sedf.latency;
  1.1342 -		extraq_check(p);
  1.1343 +			
  1.1344 +		for_each_exec_domain(p, ed) {
  1.1345 +			EDOM_INFO(ed)->extra  = (EDOM_INFO(ed)->extra &
  1.1346 +			  ~EXTRA_AWARE) | (cmd->u.sedf.extratime & EXTRA_AWARE);
  1.1347 +			EDOM_INFO(ed)->latency = cmd->u.sedf.latency;
  1.1348 +			extraq_check(ed);
  1.1349 +		}
  1.1350  	}
  1.1351  	else if ( cmd->direction == SCHED_INFO_GET )
  1.1352  	{
  1.1353 -		cmd->u.sedf.period    = DOM_INFO(p)->period;
  1.1354 -		cmd->u.sedf.slice     = DOM_INFO(p)->slice;
  1.1355 -		cmd->u.sedf.extratime = DOM_INFO(p)->extra & EXTRA_AWARE;
  1.1356 -		cmd->u.sedf.latency   = DOM_INFO(p)->latency;
  1.1357 -		cmd->u.sedf.weight    = DOM_INFO(p)->weight;
  1.1358 +		cmd->u.sedf.period    = EDOM_INFO(p->exec_domain[0])->period;
  1.1359 +		cmd->u.sedf.slice     = EDOM_INFO(p->exec_domain[0])->slice;
  1.1360 +		cmd->u.sedf.extratime = EDOM_INFO(p->exec_domain[0])->extra
  1.1361 +		                            & EXTRA_AWARE;
  1.1362 +		cmd->u.sedf.latency   = EDOM_INFO(p->exec_domain[0])->latency;
  1.1363 +		cmd->u.sedf.weight    = EDOM_INFO(p->exec_domain[0])->weight;
  1.1364  	}
  1.1365  	PRINT(2,"sedf_adjdom_finished\n");
  1.1366  	return 0;