drm/amdkfd: Use prange->list head for insert_list
There are seven list_heads in struct svm_range: list, update_list, remove_list, insert_list, svm_bo_list, deferred_list, child_list. This patch and the next one remove two of them that are redundant. The insert_list head was only used for new ranges that are not on the svms->list yet. So we can use that list head for keeping track of new ranges before they get added, and use list_move_tail to move them to the svms->list when ready. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Philip Yang <Philip.Yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
9b7a4de9f1
commit
ef3b4137aa
@ -107,7 +107,7 @@ static void svm_range_add_to_svms(struct svm_range *prange)
|
||||
pr_debug("svms 0x%p prange 0x%p [0x%lx 0x%lx]\n", prange->svms,
|
||||
prange, prange->start, prange->last);
|
||||
|
||||
list_add_tail(&prange->list, &prange->svms->list);
|
||||
list_move_tail(&prange->list, &prange->svms->list);
|
||||
prange->it_node.start = prange->start;
|
||||
prange->it_node.last = prange->last;
|
||||
interval_tree_insert(&prange->it_node, &prange->svms->objects);
|
||||
@ -296,7 +296,6 @@ svm_range *svm_range_new(struct svm_range_list *svms, uint64_t start,
|
||||
INIT_LIST_HEAD(&prange->list);
|
||||
INIT_LIST_HEAD(&prange->update_list);
|
||||
INIT_LIST_HEAD(&prange->remove_list);
|
||||
INIT_LIST_HEAD(&prange->insert_list);
|
||||
INIT_LIST_HEAD(&prange->svm_bo_list);
|
||||
INIT_LIST_HEAD(&prange->deferred_list);
|
||||
INIT_LIST_HEAD(&prange->child_list);
|
||||
@ -1018,7 +1017,7 @@ svm_range_split_tail(struct svm_range *prange,
|
||||
int r = svm_range_split(prange, prange->start, new_last, &tail);
|
||||
|
||||
if (!r)
|
||||
list_add(&tail->insert_list, insert_list);
|
||||
list_add(&tail->list, insert_list);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1030,7 +1029,7 @@ svm_range_split_head(struct svm_range *prange,
|
||||
int r = svm_range_split(prange, new_start, prange->last, &head);
|
||||
|
||||
if (!r)
|
||||
list_add(&head->insert_list, insert_list);
|
||||
list_add(&head->list, insert_list);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1899,7 +1898,7 @@ svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size,
|
||||
}
|
||||
|
||||
list_add(&old->remove_list, remove_list);
|
||||
list_add(&prange->insert_list, insert_list);
|
||||
list_add(&prange->list, insert_list);
|
||||
list_add(&prange->update_list, update_list);
|
||||
|
||||
if (node->start < start) {
|
||||
@ -1931,7 +1930,7 @@ svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size,
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_add(&prange->insert_list, insert_list);
|
||||
list_add(&prange->list, insert_list);
|
||||
list_add(&prange->update_list, update_list);
|
||||
}
|
||||
|
||||
@ -1946,13 +1945,13 @@ svm_range_add(struct kfd_process *p, uint64_t start, uint64_t size,
|
||||
r = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
list_add(&prange->insert_list, insert_list);
|
||||
list_add(&prange->list, insert_list);
|
||||
list_add(&prange->update_list, update_list);
|
||||
}
|
||||
|
||||
out:
|
||||
if (r)
|
||||
list_for_each_entry_safe(prange, tmp, insert_list, insert_list)
|
||||
list_for_each_entry_safe(prange, tmp, insert_list, list)
|
||||
svm_range_free(prange);
|
||||
|
||||
return r;
|
||||
@ -3236,7 +3235,7 @@ svm_range_set_attr(struct kfd_process *p, uint64_t start, uint64_t size,
|
||||
goto out;
|
||||
}
|
||||
/* Apply changes as a transaction */
|
||||
list_for_each_entry_safe(prange, next, &insert_list, insert_list) {
|
||||
list_for_each_entry_safe(prange, next, &insert_list, list) {
|
||||
svm_range_add_to_svms(prange);
|
||||
svm_range_add_notifier_locked(mm, prange);
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ struct svm_work_list_item {
|
||||
* @list: link list node, used to scan all ranges of svms
|
||||
* @update_list:link list node used to add to update_list
|
||||
* @remove_list:link list node used to add to remove list
|
||||
* @insert_list:link list node used to add to insert list
|
||||
* @mapping: bo_va mapping structure to create and update GPU page table
|
||||
* @npages: number of pages
|
||||
* @dma_addr: dma mapping address on each GPU for system memory physical page
|
||||
@ -114,7 +113,6 @@ struct svm_range {
|
||||
struct list_head list;
|
||||
struct list_head update_list;
|
||||
struct list_head remove_list;
|
||||
struct list_head insert_list;
|
||||
uint64_t npages;
|
||||
dma_addr_t *dma_addr[MAX_GPU_INSTANCE];
|
||||
struct ttm_resource *ttm_res;
|
||||
|
Loading…
x
Reference in New Issue
Block a user