Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d788e80a authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds
Browse files

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: default avatarChris Wright <chrisw@sous-sol.org>
Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: default avatarJohannes Weiner <jweiner@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1bb36fbd
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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)