Skip to content

Commit

Permalink
drm/amdkfd: GFP_NOIO while holding locks taken in MMU notifier
Browse files Browse the repository at this point in the history
When an MMU notifier runs in memory reclaim context, it can deadlock
trying to take locks that are already held in the thread causing the
memory reclaim. The solution is to avoid memory reclaim while holding
locks that are taken in MMU notifiers by using GFP_NOIO.

This commit fixes memory allocations done while holding the dqm->lock
which is needed in the MMU notifier (dqm->ops.evict_process_queues).

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
  • Loading branch information
Felix Kuehling authored and Oded Gabbay committed Mar 23, 2018
1 parent 6e08e09 commit d1853f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,
if (size > kfd->gtt_sa_num_of_chunks * kfd->gtt_sa_chunk_size)
return -ENOMEM;

*mem_obj = kmalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
*mem_obj = kmalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
if ((*mem_obj) == NULL)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;

mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
if (!mqd)
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;

mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
if (!mqd)
return NULL;

Expand Down

0 comments on commit d1853f4

Please sign in to comment.