Skip to content

Commit

Permalink
UCS/ARBITER: Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Apr 4, 2019
1 parent e56425c commit 086f664
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
10 changes: 4 additions & 6 deletions src/ucs/datastruct/arbiter.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ void ucs_arbiter_group_push_head_elem_always(ucs_arbiter_t *arbiter,
ucs_arbiter_elem_t *tail = group->tail;
ucs_arbiter_elem_t *head;

elem->group = group; /* Always point to group */
elem->group = group; /* Always point to group */
elem->list.next = NULL; /* Not scheduled yet */

if (tail == NULL) {
elem->list.next = NULL; /* Not scheduled yet */
elem->next = elem; /* Connect to itself */
group->tail = elem; /* Update group tail */
elem->next = elem; /* Connect to itself */
group->tail = elem; /* Update group tail */
return;
}

Expand All @@ -88,8 +88,6 @@ void ucs_arbiter_group_push_head_elem_always(ucs_arbiter_t *arbiter,
if (head->list.next != NULL) {
ucs_assert(arbiter != NULL);
ucs_arbiter_group_head_replaced(arbiter, head, elem);
} else {
elem->list.next = NULL; /* Mark the new head as un-scheduled */
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/ucs/datastruct/arbiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ void ucs_arbiter_group_init(ucs_arbiter_group_t *group);
void ucs_arbiter_group_cleanup(ucs_arbiter_group_t *group);


/**
* Initialize an element object.
*
* @param [in] elem Element to initialize.
*/
static inline void ucs_arbiter_elem_init(ucs_arbiter_elem_t *elem)
{
elem->next = NULL;
}


/**
* Add a new work element to a group - internal function
*/
Expand Down Expand Up @@ -273,17 +284,6 @@ static inline void ucs_arbiter_group_desched(ucs_arbiter_t *arbiter,
}


/**
* Initialize an element object.
*
* @param [in] elem Element to initialize.
*/
static inline void ucs_arbiter_elem_init(ucs_arbiter_elem_t *elem)
{
elem->next = NULL;
}


/**
* @return Whether the element is queued in an arbiter group.
* (an element can't be queued more than once)
Expand Down

0 comments on commit 086f664

Please sign in to comment.