Commit d788e80a8c83ecdbdd55b6e985cced9cfe3a815b
Committed by
Linus Torvalds
1 parent
1bb36fbd4d
Exists in
master
and in
38 other branches
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>
Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff
mm/huge_memory.c
... | ... | @@ -1596,14 +1596,13 @@ |
1596 | 1596 | list_del(&mm_slot->mm_node); |
1597 | 1597 | free = 1; |
1598 | 1598 | } |
1599 | + spin_unlock(&khugepaged_mm_lock); | |
1599 | 1600 | |
1600 | 1601 | if (free) { |
1601 | - spin_unlock(&khugepaged_mm_lock); | |
1602 | 1602 | clear_bit(MMF_VM_HUGEPAGE, &mm->flags); |
1603 | 1603 | free_mm_slot(mm_slot); |
1604 | 1604 | mmdrop(mm); |
1605 | 1605 | } else if (mm_slot) { |
1606 | - spin_unlock(&khugepaged_mm_lock); | |
1607 | 1606 | /* |
1608 | 1607 | * This is required to serialize against |
1609 | 1608 | * khugepaged_test_exit() (which is guaranteed to run |
... | ... | @@ -1614,8 +1613,7 @@ |
1614 | 1613 | */ |
1615 | 1614 | down_write(&mm->mmap_sem); |
1616 | 1615 | up_write(&mm->mmap_sem); |
1617 | - } else | |
1618 | - spin_unlock(&khugepaged_mm_lock); | |
1616 | + } | |
1619 | 1617 | } |
1620 | 1618 | |
1621 | 1619 | static void release_pte_page(struct page *page) |