From 97141d2421c8bdb5650c2819676b6a835b25a0e2 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 23 Nov 2004 00:20:19 +0000 Subject: [PATCH] Clean-up several memory leaks. --- src/plugins/select/bluegene/bluegene.c | 42 ++++++++++++++----- src/plugins/select/bluegene/bluegene.h | 9 ++-- src/plugins/select/bluegene/partition_sys.c | 14 ++----- src/plugins/select/bluegene/select_bluegene.c | 20 ++++----- 4 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c index 940306fa277..de12771978b 100644 --- a/src/plugins/select/bluegene/bluegene.c +++ b/src/plugins/select/bluegene/bluegene.c @@ -243,7 +243,7 @@ static void _process_config(void) itr = list_iterator_create(bgl_list); while ((bgl_part = (bgl_record_t*) list_next(itr))) { - /** + /* * _parse_request() will fill up the partition_t's * bl_coord, tr_coord, dimensions, and size */ @@ -253,7 +253,7 @@ static void _process_config(void) error("_process_config: error parsing request %s", bgl_part->nodes); else { - /** + /* * bgl_part->conn_type should have been extracted in * copy_slurm_partition_list */ @@ -356,6 +356,10 @@ static int _copy_slurm_partition_list(List slurm_part_list) return rc; } +/* + * Read and process the bluegene.conf configuration file so to interpret what + * partitions are static/dynamic, torus/mesh, etc. + */ extern int read_bgl_conf(void) { DEF_TIMERS; @@ -609,7 +613,7 @@ static bgl_conf_record_t* _find_config_by_nodes(char* nodes) nodes); } -/** nodes example: 000x111 */ +/* Compare node list in bgl_conf_record against node list string */ static int _listfindf_conf_part_record(bgl_conf_record_t* record, char *nodes) { return (!strcasecmp(record->nodes, nodes)); @@ -737,9 +741,6 @@ extern int init_bgl(void) bp_size.X, bp_size.Y, bp_size.Z); #endif - /* FIXME: for testing purposes */ - init_bgl_partition_num(); - info("BlueGene plugin loaded successfully"); return SLURM_SUCCESS; @@ -756,6 +757,25 @@ extern void fini_bgl(void) list_destroy(bgl_conf_list); bgl_conf_list = NULL; } + if (bgl_init_part_list) { + list_destroy(bgl_init_part_list); + bgl_init_part_list = NULL; + } + + xfree(bluegene_blrts); + xfree(bluegene_linux); + xfree(bluegene_mloader); + xfree(bluegene_ramdisk); + xfree(bluegene_serial); + +#ifdef USE_BGL_FILES +/* FIXME: rm_free_BGL() is consistenly generating a segfault, even + * immediately following a rm_get_BGL() - Jette 11/22/04 */ + if (bgl) { + rm_free_BGL(bgl); + bgl = NULL; + } +#endif } extern void print_bgl_record(bgl_record_t* record) @@ -833,7 +853,7 @@ extern char* convert_node_use(rm_partition_mode_t pt) return ""; } -/** +/* * finds the best match for a given job request * * IN - int spec right now holds the place for some type of @@ -926,13 +946,14 @@ static int _find_best_partition_match(struct job_record* job_ptr, /* check the connection type specified matches */ /***********************************************/ if ((conn_type != record->conn_type) - && (conn_type != RM_NAV)) { - debug("bgl partition %s conn-type not usable", record->nodes); + && (conn_type != RM_NAV)) { + debug("bgl partition %s conn-type not usable", + record->nodes); continue; } /***********************************************/ - /* check the node_use specified matches */ + /* check the node_use specified matches */ /***********************************************/ if (node_use != record->node_use) { debug("bgl partition %s node-use not usable", record->nodes); @@ -1083,6 +1104,7 @@ extern int submit_job(struct job_record *job_ptr, bitstr_t *slurm_part_bitmap, static void _update_bgl_node_bitmap(void) { #ifdef USE_BGL_FILES +/* Original logic from Dan Phung */ int bp_num,i; rm_BP_t *my_bp; rm_BP_state_t bp_state; diff --git a/src/plugins/select/bluegene/bluegene.h b/src/plugins/select/bluegene/bluegene.h index c36f82da98d..28bd55c39a4 100644 --- a/src/plugins/select/bluegene/bluegene.h +++ b/src/plugins/select/bluegene/bluegene.h @@ -63,7 +63,7 @@ extern char *bluegene_blrts; extern char *bluegene_linux; extern char *bluegene_mloader; extern char *bluegene_ramdisk; -extern char *bluegene_serialL; +extern char *bluegene_serial; extern List bgl_init_part_list; /* Initial bgl partition state */ typedef int lifecycle_type_t; @@ -82,11 +82,11 @@ typedef struct bgl_record { rm_partition_mode_t node_use; /* either COPROCESSOR or VIRTUAL */ } bgl_record_t; -/** +/* * bgl_conf_record is used to store the elements read from the config * file from init(). */ -typedef struct bgl_conf_record{ +typedef struct bgl_conf_record { char* nodes; rm_connection_type_t conn_type;/* Mesh or Torus or NAV */ rm_partition_mode_t node_use; @@ -94,8 +94,7 @@ typedef struct bgl_conf_record{ /* * Read and process the bluegene.conf configuration file so to interpret what - * partitions are static, dynamic, etc. - * + * partitions are static/dynamic, torus/mesh, etc. */ extern int read_bgl_conf(void); diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c index 67b5554c539..1d447bc17fd 100755 --- a/src/plugins/select/bluegene/partition_sys.c +++ b/src/plugins/select/bluegene/partition_sys.c @@ -41,11 +41,6 @@ # include "bgl_switch_connections.h" #endif -/****************************/ -/* for testing purposes */ -uint16_t bgl_partition_number; -/****************************/ - #ifdef _UNIT_TEST_ extern void * lsd_fatal_error(char *file, int line, char *mesg){} extern void * lsd_nomem_error(char *file, int line, char *mesg){} @@ -1030,11 +1025,6 @@ extern void debug(const char *fmt, ...) } #endif -extern void init_bgl_partition_num(void) -{ - bgl_partition_number = 0; -} - /* * Download from CMCS the initial BGL partition information */ @@ -1133,6 +1123,10 @@ static void _part_list_del(void *object) xfree(part_ptr->bgl_part_id); xfree(part_ptr->nodes); xfree(part_ptr->slurm_part_id); + if (part_ptr->bitmap) { + bit_free(part_ptr->bitmap); + part_ptr->bitmap = NULL; + } if (part_ptr->hostlist) hostlist_destroy(part_ptr->hostlist); xfree(part_ptr); diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/select_bluegene.c index 36f9ad7f1e9..fec8efbe345 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/select_bluegene.c @@ -176,9 +176,9 @@ static void _cancel_thread (pthread_t thread_id) { int i; - for (i=0; i<4; i++) { + for (i=0; i<8; i++) { if (pthread_cancel(thread_id)) - return; + return; /* pthread now gone */ usleep(1000); } error("Could not kill bluegene select pthread"); @@ -204,18 +204,16 @@ extern int fini ( void ) * node selection API. */ -/** - * this is called periodically by slurmctld when - * - new nodes are added - * - new configuration file is loaded +/* + * Called by slurmctld when a new configuration file is loaded + * or scontrol is used to change partition configuration */ -extern int select_p_part_init(List part_list) + extern int select_p_part_init(List part_list) { xassert(part_list); if (read_bgl_conf()) return SLURM_ERROR; - /* create_static_partitions */ if (create_static_partitions(part_list)) { /* error in creating the static partitions, so * partitions referenced by submitted jobs won't @@ -229,22 +227,20 @@ extern int select_p_part_init(List part_list) return SLURM_SUCCESS; } +/* We rely upon DB2 to save and restore BlueGene state */ extern int select_p_state_save(char *dir_name) { - /* no-op for static partitions */ return SLURM_SUCCESS; } extern int select_p_state_restore(char *dir_name) { - /* no-op for static partitions */ return SLURM_SUCCESS; } +/* All initialization is performed by select_p_part_init() */ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) { - /* This is a no-op. - * All initialization is performed by select_p_part_init() */ return SLURM_SUCCESS; } -- GitLab