Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332357
b: refs/heads/master
c: e0f3c3f
h: refs/heads/master
i:
  332355: 18da32b
v: v3
  • Loading branch information
Gavin Shan authored and Linus Torvalds committed Oct 9, 2012
1 parent e44fc83 commit 299e343
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21a92735f660eaecf69a6f2e777f18463760ec32
refs/heads/master: e0f3c3f78da29b114e7c1c68019036559f715948
22 changes: 11 additions & 11 deletions trunk/mm/mmu_notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,23 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn,
*/
BUG_ON(!srcu.per_cpu_ref);

ret = -ENOMEM;
mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), GFP_KERNEL);
if (unlikely(!mmu_notifier_mm))
goto out;

if (take_mmap_sem)
down_write(&mm->mmap_sem);
ret = mm_take_all_locks(mm);
if (unlikely(ret))
goto out_cleanup;
goto out;

if (!mm_has_notifiers(mm)) {
mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm),
GFP_KERNEL);
if (unlikely(!mmu_notifier_mm)) {
ret = -ENOMEM;
goto out_of_mem;
}
INIT_HLIST_HEAD(&mmu_notifier_mm->list);
spin_lock_init(&mmu_notifier_mm->lock);

mm->mmu_notifier_mm = mmu_notifier_mm;
mmu_notifier_mm = NULL;
}
atomic_inc(&mm->mm_count);

Expand All @@ -238,13 +239,12 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn,
hlist_add_head(&mn->hlist, &mm->mmu_notifier_mm->list);
spin_unlock(&mm->mmu_notifier_mm->lock);

out_of_mem:
mm_drop_all_locks(mm);
out_cleanup:
out:
if (take_mmap_sem)
up_write(&mm->mmap_sem);
/* kfree() does nothing if mmu_notifier_mm is NULL */
kfree(mmu_notifier_mm);
out:

BUG_ON(atomic_read(&mm->mm_users) <= 0);
return ret;
}
Expand Down

0 comments on commit 299e343

Please sign in to comment.