From fa43d7a6bb9b0e748f23529424ac5eebd849d9d7 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Mon, 23 Apr 2012 12:12:58 -0400 Subject: Donees cannot be amongst the top-m requests. --- litmus/ikglp_lock.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/litmus/ikglp_lock.c b/litmus/ikglp_lock.c index 1ce6572eddcb..1a5d674b26a5 100644 --- a/litmus/ikglp_lock.c +++ b/litmus/ikglp_lock.c @@ -1957,8 +1957,11 @@ static ikglp_donee_heap_node_t* pick_donee(struct ikglp_affinity* aff, struct ikglp_semaphore *sem = ikglp_from_lock(aff->obs.lock); struct task_struct *donee; ikglp_donee_heap_node_t *donee_node; + struct task_struct *mth_highest = ikglp_mth_highest(sem); - if(fq->owner && fq->donee_heap_node.donor_info != NULL) { + if(fq->owner && + fq->donee_heap_node.donor_info != NULL && + litmus->__compare(mth_highest, BASE, fq->owner, BASE)) { donee = fq->owner; donee_node = &(fq->donee_heap_node); *dist_from_head = 0; @@ -1979,8 +1982,9 @@ static ikglp_donee_heap_node_t* pick_donee(struct ikglp_affinity* aff, // the donee will be closer to obtaining a resource. list_for_each(pos, &fq->wait.task_list) { wait_queue_t *fq_wait = list_entry(pos, wait_queue_t, task_list); - if(!has_donor(fq_wait)) { - ikglp_wait_state_t *wait = container_of(fq_wait, ikglp_wait_state_t, fq_node); + ikglp_wait_state_t *wait = container_of(fq_wait, ikglp_wait_state_t, fq_node); + if(!has_donor(fq_wait) && + litmus->__compare(mth_highest, BASE, wait->task, BASE)) { donee = (struct task_struct*) fq_wait->private; donee_node = &wait->donee_heap_node; @@ -2019,8 +2023,9 @@ ikglp_donee_heap_node_t* gpu_ikglp_advise_donee_selection( struct task_struct* donor) { // Huristic strategy: Find the highest-priority donee that is waiting on - // a queue closest to our affinity. The donee CANNOT already have a donor - // (exception: donee is the lowest-prio task in the donee heap). + // a queue closest to our affinity. (1) The donee CANNOT already have a + // donor (exception: donee is the lowest-prio task in the donee heap). + // (2) Requests in 'top_m' heap are ineligible. // // Further strategy: amongst elible donees waiting for the same GPU, pick // the one closest to the head of the FIFO queue (including owners). @@ -2058,6 +2063,9 @@ ikglp_donee_heap_node_t* gpu_ikglp_advise_donee_selection( donee_node = NULL; distance = MIG_NONE; + // TODO: The below search logic may work well for locating nodes to steal + // when an FQ goes idle. Validate this code and apply it to stealing. + // begin search with affinity GPU. start = gpu_to_base_replica(aff, tsk_rt(donor)->last_gpu); i = start; -- cgit v1.2.2