mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
drm/amdkfd: optimize svm range evict
It is to avoid unnecessary queue eviction when range is not mapped to gpu. Signed-off-by: Eric Huang <jinhuieric.huang@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
1f374171fd
commit
f72fc9bd22
|
|
@ -1778,8 +1778,12 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
|
|||
if (!p->xnack_enabled ||
|
||||
(prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED)) {
|
||||
int evicted_ranges;
|
||||
bool mapped = prange->mapped_to_gpu;
|
||||
|
||||
list_for_each_entry(pchild, &prange->child_list, child_list) {
|
||||
if (!pchild->mapped_to_gpu)
|
||||
continue;
|
||||
mapped = true;
|
||||
mutex_lock_nested(&pchild->lock, 1);
|
||||
if (pchild->start <= last && pchild->last >= start) {
|
||||
pr_debug("increment pchild invalid [0x%lx 0x%lx]\n",
|
||||
|
|
@ -1789,6 +1793,9 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
|
|||
mutex_unlock(&pchild->lock);
|
||||
}
|
||||
|
||||
if (!mapped)
|
||||
return r;
|
||||
|
||||
if (prange->start <= last && prange->last >= start)
|
||||
atomic_inc(&prange->invalid);
|
||||
|
||||
|
|
@ -3345,7 +3352,8 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,
|
|||
goto out_unlock_range;
|
||||
|
||||
if (migrated && (!p->xnack_enabled ||
|
||||
(prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED))) {
|
||||
(prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED)) &&
|
||||
prange->mapped_to_gpu) {
|
||||
pr_debug("restore_work will update mappings of GPUs\n");
|
||||
mutex_unlock(&prange->migrate_mutex);
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user