@@ -100,14 +100,19 @@ enum {
100100};
101101
102102typedef 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 */
111116} category_use_t ;
112117
113118static void
@@ -882,7 +887,6 @@ parallel_reservation_max_time_slots(sge_assignment_t *best, int *available_slots
882887static dispatch_t
883888parallel_maximize_slots_pe (sge_assignment_t *best, int *available_slots)
884889{
885-
886890 int min_slots, max_slots;
887891 int max_pe_slots;
888892 int first, last;
@@ -893,7 +897,7 @@ parallel_maximize_slots_pe(sge_assignment_t *best, int *available_slots)
893897 const char *pe_name = best->pe_name ;
894898 bool is_first = true ;
895899 int old_logging = 0 ;
896- category_use_t use_category;
900+ category_use_t use_category{} ;
897901 u_long32 max_slotsp = 0 ;
898902 int current = 0 ;
899903 int match_current = 0 ;
@@ -953,6 +957,9 @@ parallel_maximize_slots_pe(sge_assignment_t *best, int *available_slots)
953957 }
954958 if (max_slotsp == 0 ) {
955959 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+ }
956963 DRETURN (DISPATCH_NEVER_CAT);
957964 }
958965
@@ -3712,6 +3719,7 @@ add_pe_slots_to_category(category_use_t *use_category, u_long32 *max_slotsp, lLi
37123719 use_category->is_pe_slots_rev = true ;
37133720 } else {
37143721 use_category->is_pe_slots_rev = false ;
3722+
37153723 }
37163724 } else {
37173725 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
37493757
37503758 use_category->category = (lListElem *)lGetRef (job, JB_category);
37513759 if (use_category->category != nullptr ) {
3760+ // the category cache is stored in the job category object and contains an element per pe
37523761 use_category->cache = lGetElemStrRW (lGetList (use_category->category , CT_cache), CCT_pe_name, pe_name);
37533762 if (use_category->cache == nullptr ) {
3763+ // there is no cache yet, create it
37543764 use_category->cache = lCreateElem (CCT_Type);
37553765
37563766 lSetString (use_category->cache , CCT_pe_name, pe_name);
37573767 lSetList (use_category->cache , CCT_ignore_queues, lCreateList (nullptr , CTI_Type));
37583768 lSetList (use_category->cache , CCT_ignore_hosts, lCreateList (nullptr , CTI_Type));
37593769 lSetList (use_category->cache , CCT_job_messages, lCreateList (nullptr , MES_Type));
37603770
3771+ // store the cache in the job category
37613772 if (lGetList (use_category->category , CT_cache) == nullptr ) {
37623773 lSetList (use_category->category , CT_cache, lCreateList (" pe_cache" , CCT_Type));
37633774 }
@@ -3769,6 +3780,7 @@ static void fill_category_use_t(const sge_assignment_t *a, category_use_t *use_c
37693780 use_category->use_category = a->start == DISPATCH_TIME_NOW &&
37703781 lGetUlong (use_category->category , CT_refcount) > MIN_JOBS_IN_CATEGORY;
37713782 } else {
3783+ // we have a job without category (does this case exist at all?)
37723784 use_category->cache = nullptr ;
37733785 use_category->mod_category = false ;
37743786 use_category->use_category = false ;
0 commit comments