mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-10 14:43:54 +08:00
drm/i915/userptr: Store i915 backpointer for i915_mm_struct
Since we only ever use the drm_i915_private from the stored i915_mm_struct->dev, save some electrons by storing the right backpointer. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1459864801-28606-3-git-send-email-chris@chris-wilson.co.uk
This commit is contained in:
parent
40313f0cd0
commit
f470b19095
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
struct i915_mm_struct {
|
struct i915_mm_struct {
|
||||||
struct mm_struct *mm;
|
struct mm_struct *mm;
|
||||||
struct drm_device *dev;
|
struct drm_i915_private *i915;
|
||||||
struct i915_mmu_notifier *mn;
|
struct i915_mmu_notifier *mn;
|
||||||
struct hlist_node node;
|
struct hlist_node node;
|
||||||
struct kref kref;
|
struct kref kref;
|
||||||
@ -250,13 +250,13 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
|
|||||||
return mn;
|
return mn;
|
||||||
|
|
||||||
down_write(&mm->mm->mmap_sem);
|
down_write(&mm->mm->mmap_sem);
|
||||||
mutex_lock(&to_i915(mm->dev)->mm_lock);
|
mutex_lock(&mm->i915->mm_lock);
|
||||||
if ((mn = mm->mn) == NULL) {
|
if ((mn = mm->mn) == NULL) {
|
||||||
mn = i915_mmu_notifier_create(mm->mm);
|
mn = i915_mmu_notifier_create(mm->mm);
|
||||||
if (!IS_ERR(mn))
|
if (!IS_ERR(mn))
|
||||||
mm->mn = mn;
|
mm->mn = mn;
|
||||||
}
|
}
|
||||||
mutex_unlock(&to_i915(mm->dev)->mm_lock);
|
mutex_unlock(&mm->i915->mm_lock);
|
||||||
up_write(&mm->mm->mmap_sem);
|
up_write(&mm->mm->mmap_sem);
|
||||||
|
|
||||||
return mn;
|
return mn;
|
||||||
@ -373,7 +373,7 @@ i915_gem_userptr_init__mm_struct(struct drm_i915_gem_object *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
kref_init(&mm->kref);
|
kref_init(&mm->kref);
|
||||||
mm->dev = obj->base.dev;
|
mm->i915 = to_i915(obj->base.dev);
|
||||||
|
|
||||||
mm->mm = current->mm;
|
mm->mm = current->mm;
|
||||||
atomic_inc(¤t->mm->mm_count);
|
atomic_inc(¤t->mm->mm_count);
|
||||||
@ -408,7 +408,7 @@ __i915_mm_struct_free(struct kref *kref)
|
|||||||
|
|
||||||
/* Protected by dev_priv->mm_lock */
|
/* Protected by dev_priv->mm_lock */
|
||||||
hash_del(&mm->node);
|
hash_del(&mm->node);
|
||||||
mutex_unlock(&to_i915(mm->dev)->mm_lock);
|
mutex_unlock(&mm->i915->mm_lock);
|
||||||
|
|
||||||
INIT_WORK(&mm->work, __i915_mm_struct_free__worker);
|
INIT_WORK(&mm->work, __i915_mm_struct_free__worker);
|
||||||
schedule_work(&mm->work);
|
schedule_work(&mm->work);
|
||||||
|
Loading…
Reference in New Issue
Block a user