Skip to content

Commit

Permalink
UCT/SM/CUDA: CR Comments p1
Browse files Browse the repository at this point in the history
  • Loading branch information
brminich committed Dec 10, 2021
1 parent 8a986cc commit 782cbc6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/ucs/sys/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,8 +1526,7 @@ unsigned long ucs_sys_get_proc_create_time(const char *proc_stat_path)

size = ucs_read_file_str(stat, sizeof(stat), 1, proc_stat_path);
if (size < 0) {
ucs_diag("failed to read %s %m", proc_stat_path);
return 0ul;
goto err;
}

/* Start sscanf right after the executable name which may contain spaces or
Expand All @@ -1545,6 +1544,7 @@ unsigned long ucs_sys_get_proc_create_time(const char *proc_stat_path)

scan_err:
ucs_error("failed to scan %s", proc_stat_path);
err:
return 0ul;
}

Expand Down
7 changes: 2 additions & 5 deletions src/uct/base/uct_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,20 +799,17 @@ uct_ep_get_process_stat_proc_dir(char *buffer, size_t max_len, pid_t pid)
ucs_status_t uct_ep_keepalive_create(pid_t pid, uct_keepalive_info_t **ka_p)
{
uct_keepalive_info_t *ka;
ucs_status_t status;
int proc_len;

proc_len = uct_ep_get_process_stat_proc_dir(NULL, 0, pid);
if (proc_len <= 0) {
ucs_error("failed to get length to hold path to a process directory");
status = UCS_ERR_NO_MEMORY;
goto err;
}

ka = ucs_malloc(sizeof(*ka) + proc_len + 1, "keepalive");
if (ka == NULL) {
ucs_error("failed to allocate keepalive info");
status = UCS_ERR_NO_MEMORY;
goto err;
}

Expand All @@ -830,7 +827,7 @@ ucs_status_t uct_ep_keepalive_create(pid_t pid, uct_keepalive_info_t **ka_p)
err_free_ka:
ucs_free(ka);
err:
return status;
return UCS_ERR_NO_MEMORY;
}

static ucs_status_t uct_iface_schedule_ep_err(uct_ep_h ep, ucs_status_t status)
Expand Down Expand Up @@ -867,7 +864,7 @@ ucs_status_t uct_ep_keepalive_check(uct_ep_h ep, uct_keepalive_info_t **ka_p,
UCT_EP_KEEPALIVE_CHECK_PARAM(flags, comp);

if (*ka_p == NULL) {
status = uct_ep_keepalive_create(pid, ka_p);
status = uct_ep_keepalive_create(pid, ka_p);
} else {
ka = *ka_p;
start_time = ucs_sys_get_proc_create_time(ka->proc);
Expand Down
4 changes: 2 additions & 2 deletions src/uct/base/uct_iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ typedef struct uct_failed_iface {
* Keepalive info used by EP
*/
typedef struct uct_keepalive_info {
unsigned long start_time; /* Process start time */
char proc[]; /* Process owner proc dir */
unsigned long start_time; /* Process start time */
char proc[]; /* Process owner proc dir */
} uct_keepalive_info_t;


Expand Down

0 comments on commit 782cbc6

Please sign in to comment.