* [PATCH] mm: thp: minor lock simplification in __khugepaged_exit
@ 2011-06-10 23:33 Chris Wright
2011-06-12 10:32 ` Michal Hocko
2011-06-14 10:06 ` Johannes Weiner
0 siblings, 2 replies; 3+ messages in thread
From: Chris Wright @ 2011-06-10 23:33 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: linux-mm, linux-kernel, chrisw
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>
---
mm/huge_memory.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 615d974..a032ddd 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)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: thp: minor lock simplification in __khugepaged_exit
2011-06-10 23:33 [PATCH] mm: thp: minor lock simplification in __khugepaged_exit Chris Wright
@ 2011-06-12 10:32 ` Michal Hocko
2011-06-14 10:06 ` Johannes Weiner
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2011-06-12 10:32 UTC (permalink / raw)
To: Chris Wright; +Cc: Andrea Arcangeli, linux-mm, linux-kernel
On Fri 10-06-11 16:33:55, Chris Wright wrote:
> 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>
Nice cleanup.
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/huge_memory.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 615d974..a032ddd 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)
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: thp: minor lock simplification in __khugepaged_exit
2011-06-10 23:33 [PATCH] mm: thp: minor lock simplification in __khugepaged_exit Chris Wright
2011-06-12 10:32 ` Michal Hocko
@ 2011-06-14 10:06 ` Johannes Weiner
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2011-06-14 10:06 UTC (permalink / raw)
To: Chris Wright; +Cc: Andrea Arcangeli, linux-mm, linux-kernel
On Fri, Jun 10, 2011 at 04:33:55PM -0700, Chris Wright wrote:
> 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>
Acked-by: Johannes Weiner <jweiner@redhat.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-14 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 23:33 [PATCH] mm: thp: minor lock simplification in __khugepaged_exit Chris Wright
2011-06-12 10:32 ` Michal Hocko
2011-06-14 10:06 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox