diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-04-18 23:18:32 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-04-18 23:18:32 -0400 |
commit | c6d04216a123f8e0b50eb78bbb1eaf646a1ca4e0 (patch) | |
tree | c6db90c6fd95a308db4849abebcb09a0dafaedd8 /litmus/kfmlp_lock.c | |
parent | 149ef3b424a49e6b928c5e23fea83380ed95ea38 (diff) |
Added hooks for IKGLP affinity and a little logic.
simple IKGLP is already done. it does:
1) auto gpu de/registration.
2) distruption amongst simultanous users across queues
3) calls default IKGLP routines when appropriate.
Remaining work:
1) FQ advisement.
2) Donor stealing advisement.
3) Donee selection advisement.
Diffstat (limited to 'litmus/kfmlp_lock.c')
-rw-r--r-- | litmus/kfmlp_lock.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/litmus/kfmlp_lock.c b/litmus/kfmlp_lock.c index d0a6bd364c43..0b64977789a6 100644 --- a/litmus/kfmlp_lock.c +++ b/litmus/kfmlp_lock.c | |||
@@ -5,13 +5,13 @@ | |||
5 | #include <litmus/sched_plugin.h> | 5 | #include <litmus/sched_plugin.h> |
6 | #include <litmus/fdso.h> | 6 | #include <litmus/fdso.h> |
7 | 7 | ||
8 | #include <litmus/kfmlp_lock.h> | ||
9 | |||
10 | #if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA) | 8 | #if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA) |
11 | #include <litmus/gpu_affinity.h> | 9 | #include <litmus/gpu_affinity.h> |
12 | #include <litmus/nvidia_info.h> | 10 | #include <litmus/nvidia_info.h> |
13 | #endif | 11 | #endif |
14 | 12 | ||
13 | #include <litmus/kfmlp_lock.h> | ||
14 | |||
15 | static inline int kfmlp_get_idx(struct kfmlp_semaphore* sem, | 15 | static inline int kfmlp_get_idx(struct kfmlp_semaphore* sem, |
16 | struct kfmlp_queue* queue) | 16 | struct kfmlp_queue* queue) |
17 | { | 17 | { |
@@ -508,6 +508,10 @@ struct litmus_lock* kfmlp_new(struct litmus_lock_ops* ops, void* __user args) | |||
508 | 508 | ||
509 | sem->shortest_queue = &sem->queues[0]; | 509 | sem->shortest_queue = &sem->queues[0]; |
510 | 510 | ||
511 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
512 | sem->aff_obs = NULL; | ||
513 | #endif | ||
514 | |||
511 | return &sem->litmus_lock; | 515 | return &sem->litmus_lock; |
512 | } | 516 | } |
513 | 517 | ||
@@ -584,7 +588,7 @@ static struct affinity_observer* kfmlp_aff_obs_new(struct affinity_observer_ops* | |||
584 | } | 588 | } |
585 | 589 | ||
586 | if(aff_args.nr_simult_users > NV_MAX_SIMULT_USERS) { | 590 | if(aff_args.nr_simult_users > NV_MAX_SIMULT_USERS) { |
587 | TRACE_CUR("System does not support #simult_users >%d. %d requested.\n", | 591 | TRACE_CUR("System does not support #simult_users > %d. %d requested.\n", |
588 | NV_MAX_SIMULT_USERS, aff_args.nr_simult_users); | 592 | NV_MAX_SIMULT_USERS, aff_args.nr_simult_users); |
589 | return(NULL); | 593 | return(NULL); |
590 | } | 594 | } |
@@ -628,7 +632,6 @@ static struct affinity_observer* kfmlp_aff_obs_new(struct affinity_observer_ops* | |||
628 | // attach observer to the lock | 632 | // attach observer to the lock |
629 | spin_lock_irqsave(&sem->lock, flags); | 633 | spin_lock_irqsave(&sem->lock, flags); |
630 | sem->aff_obs = kfmlp_aff; | 634 | sem->aff_obs = kfmlp_aff; |
631 | //kfmlp_aff->shortest_queue = &kfmlp_aff->q_info[kfmlp_get_idx(sem, sem->shortest_queue)]; | ||
632 | spin_unlock_irqrestore(&sem->lock, flags); | 635 | spin_unlock_irqrestore(&sem->lock, flags); |
633 | 636 | ||
634 | return &kfmlp_aff->obs; | 637 | return &kfmlp_aff->obs; |
@@ -646,20 +649,20 @@ static int gpu_replica_to_resource(struct kfmlp_affinity* aff, | |||
646 | 649 | ||
647 | // Smart KFMLP Affinity | 650 | // Smart KFMLP Affinity |
648 | 651 | ||
649 | static inline struct kfmlp_queue_info* kfmlp_aff_find_shortest(struct kfmlp_affinity* aff) | 652 | //static inline struct kfmlp_queue_info* kfmlp_aff_find_shortest(struct kfmlp_affinity* aff) |
650 | { | 653 | //{ |
651 | struct kfmlp_semaphore *sem = kfmlp_from_lock(aff->obs.lock); | 654 | // struct kfmlp_semaphore *sem = kfmlp_from_lock(aff->obs.lock); |
652 | struct kfmlp_queue_info *shortest = &aff->q_info[0]; | 655 | // struct kfmlp_queue_info *shortest = &aff->q_info[0]; |
653 | int i; | 656 | // int i; |
654 | 657 | // | |
655 | for(i = 1; i < sem->num_resources; ++i) { | 658 | // for(i = 1; i < sem->num_resources; ++i) { |
656 | if(aff->q_info[i].estimated_len < shortest->estimated_len) { | 659 | // if(aff->q_info[i].estimated_len < shortest->estimated_len) { |
657 | shortest = &aff->q_info[i]; | 660 | // shortest = &aff->q_info[i]; |
658 | } | 661 | // } |
659 | } | 662 | // } |
660 | 663 | // | |
661 | return(shortest); | 664 | // return(shortest); |
662 | } | 665 | //} |
663 | 666 | ||
664 | struct kfmlp_queue* gpu_kfmlp_advise_enqueue(struct kfmlp_affinity* aff, struct task_struct* t) | 667 | struct kfmlp_queue* gpu_kfmlp_advise_enqueue(struct kfmlp_affinity* aff, struct task_struct* t) |
665 | { | 668 | { |