Commit 471f3902 authored by Jason Gunthorpe's avatar Jason Gunthorpe

drm/amdkfd: use mmu_notifier_put

The sequence of mmu_notifier_unregister_no_release(),
mmu_notifier_call_srcu() is identical to mmu_notifier_put() with the
free_notifier callback.

As this is the last user of those APIs, converting it means we can drop
them.

Link: https://lore.kernel.org/r/20190806231548.25242-11-jgg@ziepe.caReviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 0029cab3
...@@ -686,9 +686,6 @@ struct kfd_process { ...@@ -686,9 +686,6 @@ struct kfd_process {
/* We want to receive a notification when the mm_struct is destroyed */ /* We want to receive a notification when the mm_struct is destroyed */
struct mmu_notifier mmu_notifier; struct mmu_notifier mmu_notifier;
/* Use for delayed freeing of kfd_process structure */
struct rcu_head rcu;
unsigned int pasid; unsigned int pasid;
unsigned int doorbell_index; unsigned int doorbell_index;
......
...@@ -486,11 +486,9 @@ static void kfd_process_ref_release(struct kref *ref) ...@@ -486,11 +486,9 @@ static void kfd_process_ref_release(struct kref *ref)
queue_work(kfd_process_wq, &p->release_work); queue_work(kfd_process_wq, &p->release_work);
} }
static void kfd_process_destroy_delayed(struct rcu_head *rcu) static void kfd_process_free_notifier(struct mmu_notifier *mn)
{ {
struct kfd_process *p = container_of(rcu, struct kfd_process, rcu); kfd_unref_process(container_of(mn, struct kfd_process, mmu_notifier));
kfd_unref_process(p);
} }
static void kfd_process_notifier_release(struct mmu_notifier *mn, static void kfd_process_notifier_release(struct mmu_notifier *mn,
...@@ -542,12 +540,12 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, ...@@ -542,12 +540,12 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn,
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
mmu_notifier_unregister_no_release(&p->mmu_notifier, mm); mmu_notifier_put(&p->mmu_notifier);
mmu_notifier_call_srcu(&p->rcu, &kfd_process_destroy_delayed);
} }
static const struct mmu_notifier_ops kfd_process_mmu_notifier_ops = { static const struct mmu_notifier_ops kfd_process_mmu_notifier_ops = {
.release = kfd_process_notifier_release, .release = kfd_process_notifier_release,
.free_notifier = kfd_process_free_notifier,
}; };
static int kfd_process_init_cwsr_apu(struct kfd_process *p, struct file *filep) static int kfd_process_init_cwsr_apu(struct kfd_process *p, struct file *filep)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment