summaryrefslogtreecommitdiff
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorChris Wright <chrisw@sous-sol.org>2011-07-25 17:12:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 20:57:09 -0700
commitd788e80a8c83ecdbdd55b6e985cced9cfe3a815b (patch)
treed287900bc24e17b7d65f1f57b9c59901040ea01d /mm/huge_memory.c
parent1bb36fbd4d58ec3fab4dab5ed39a2af492c263ea (diff)
downloadlinux-stable-d788e80a8c83ecdbdd55b6e985cced9cfe3a815b.tar.gz
linux-stable-d788e80a8c83ecdbdd55b6e985cced9cfe3a815b.tar.bz2
linux-stable-d788e80a8c83ecdbdd55b6e985cced9cfe3a815b.zip
mm/huge_memory.c: minor lock simplification in __khugepaged_exit
The lock is released first thing in all three branches. Simplify this by unconditionally releasing lock and remove else clause which was only there to be sure lock was released. Signed-off-by: Chris Wright <chrisw@sous-sol.org> Reviewed-by: Michal Hocko <mhocko@suse.cz> Cc: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Johannes Weiner <jweiner@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 81532f297fd2..e2d1587be269 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1596,14 +1596,13 @@ void __khugepaged_exit(struct mm_struct *mm)
list_del(&mm_slot->mm_node);
free = 1;
}
+ spin_unlock(&khugepaged_mm_lock);
if (free) {
- spin_unlock(&khugepaged_mm_lock);
clear_bit(MMF_VM_HUGEPAGE, &mm->flags);
free_mm_slot(mm_slot);
mmdrop(mm);
} else if (mm_slot) {
- spin_unlock(&khugepaged_mm_lock);
/*
* This is required to serialize against
* khugepaged_test_exit() (which is guaranteed to run
@@ -1614,8 +1613,7 @@ void __khugepaged_exit(struct mm_struct *mm)
*/
down_write(&mm->mmap_sem);
up_write(&mm->mmap_sem);
- } else
- spin_unlock(&khugepaged_mm_lock);
+ }
}
static void release_pte_page(struct page *page)