@@ -100,14 +100,19 @@ enum {
100
100
};
101
101
102
102
typedef struct {
103
- lListElem *category; /* ref to the category */
104
- lListElem *cache; /* ref to the cache object in th category */
105
- bool use_category; /* if true: use the category
106
- with immediate dispatch runs only and only if there is more than a single job of that category
107
- prevents 'skip_host_list' and 'skip_queue_list' be used with reservation */
108
- bool mod_category; /* if true: update the category with new messages, queues, and hosts */
109
- u_long32 *possible_pe_slots; /* stores all possible slots settings for a pe job with ranges */
110
- bool is_pe_slots_rev; /* if it is true, the possible_pe_slots are stored in the category */
103
+ lListElem *category; /* ref to the category */
104
+ lListElem *cache; /* ref to the cache object in the category */
105
+ bool use_category; /* if true: use the category
106
+ * with immediate dispatch runs only and only if there is more than a single job of that category
107
+ * prevents 'skip_host_list' and 'skip_queue_list' be used with reservation
108
+ */
109
+ bool mod_category; /* if true: update the category with new messages, queues, and hosts */
110
+ u_long32 *possible_pe_slots; /* stores all possible slots settings for a pe job with ranges
111
+ * it is stored in the job category cache, attribute CCT_pe_job_slots
112
+ * and is *not* freed with the category_use_t object
113
+ * (unless is_pe_slots_rev == false which means: it is not referenced in the cache)
114
+ */
115
+ bool is_pe_slots_rev; /* if it is true, the possible_pe_slots are stored in the category */
111
116
} category_use_t ;
112
117
113
118
static void
@@ -882,7 +887,6 @@ parallel_reservation_max_time_slots(sge_assignment_t *best, int *available_slots
882
887
static dispatch_t
883
888
parallel_maximize_slots_pe (sge_assignment_t *best, int *available_slots)
884
889
{
885
-
886
890
int min_slots, max_slots;
887
891
int max_pe_slots;
888
892
int first, last;
@@ -893,7 +897,7 @@ parallel_maximize_slots_pe(sge_assignment_t *best, int *available_slots)
893
897
const char *pe_name = best->pe_name ;
894
898
bool is_first = true ;
895
899
int old_logging = 0 ;
896
- category_use_t use_category;
900
+ category_use_t use_category{} ;
897
901
u_long32 max_slotsp = 0 ;
898
902
int current = 0 ;
899
903
int match_current = 0 ;
@@ -953,6 +957,9 @@ parallel_maximize_slots_pe(sge_assignment_t *best, int *available_slots)
953
957
}
954
958
if (max_slotsp == 0 ) {
955
959
DPRINTF (" no slots in PE %s available for job " sge_u32" \n " , pe_name, best->job_id );
960
+ if (!use_category.is_pe_slots_rev ) {
961
+ sge_free (&(use_category.possible_pe_slots ));
962
+ }
956
963
DRETURN (DISPATCH_NEVER_CAT);
957
964
}
958
965
@@ -3712,6 +3719,7 @@ add_pe_slots_to_category(category_use_t *use_category, u_long32 *max_slotsp, lLi
3712
3719
use_category->is_pe_slots_rev = true ;
3713
3720
} else {
3714
3721
use_category->is_pe_slots_rev = false ;
3722
+
3715
3723
}
3716
3724
} else {
3717
3725
use_category->is_pe_slots_rev = true ;
@@ -3749,15 +3757,18 @@ static void fill_category_use_t(const sge_assignment_t *a, category_use_t *use_c
3749
3757
3750
3758
use_category->category = (lListElem *)lGetRef (job, JB_category);
3751
3759
if (use_category->category != nullptr ) {
3760
+ // the category cache is stored in the job category object and contains an element per pe
3752
3761
use_category->cache = lGetElemStrRW (lGetList (use_category->category , CT_cache), CCT_pe_name, pe_name);
3753
3762
if (use_category->cache == nullptr ) {
3763
+ // there is no cache yet, create it
3754
3764
use_category->cache = lCreateElem (CCT_Type);
3755
3765
3756
3766
lSetString (use_category->cache , CCT_pe_name, pe_name);
3757
3767
lSetList (use_category->cache , CCT_ignore_queues, lCreateList (nullptr , CTI_Type));
3758
3768
lSetList (use_category->cache , CCT_ignore_hosts, lCreateList (nullptr , CTI_Type));
3759
3769
lSetList (use_category->cache , CCT_job_messages, lCreateList (nullptr , MES_Type));
3760
3770
3771
+ // store the cache in the job category
3761
3772
if (lGetList (use_category->category , CT_cache) == nullptr ) {
3762
3773
lSetList (use_category->category , CT_cache, lCreateList (" pe_cache" , CCT_Type));
3763
3774
}
@@ -3769,6 +3780,7 @@ static void fill_category_use_t(const sge_assignment_t *a, category_use_t *use_c
3769
3780
use_category->use_category = a->start == DISPATCH_TIME_NOW &&
3770
3781
lGetUlong (use_category->category , CT_refcount) > MIN_JOBS_IN_CATEGORY;
3771
3782
} else {
3783
+ // we have a job without category (does this case exist at all?)
3772
3784
use_category->cache = nullptr ;
3773
3785
use_category->mod_category = false ;
3774
3786
use_category->use_category = false ;
0 commit comments