* [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache
@ 2013-08-10 6:28 Ning Qu
2013-08-12 13:55 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Ning Qu @ 2013-08-10 6:28 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Matthew Wilcox, Kirill A. Shutemov, linux-fsdevel, Hugh Dickins,
Mel Gorman, Al Viro, Andrew Morton, Andrea Arcangeli,
linux-kernel, Andi Kleen, Wu Fengguang, Jan Kara, Dave Hansen,
linux-mm, Hillf Danton, Ning Qu
In vma_adjust, the current code grabs i_mmap_mutex before calling
vma_adjust_trans_huge. This used to be fine until huge page in page
cache comes in. The problem is the underlying function
split_file_huge_page will also grab the i_mmap_mutex before splitting
the huge page in page cache. Obviously this is causing deadlock
situation.
This fix is to move the vma_adjust_trans_huge before grab the lock for
file, the same as what the function is currently doing for anonymous
memory.
Tested, everything works fine so far.
Signed-off-by: Ning Qu <quning@google.com>
---
mm/mmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 519ce78..accf1b3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -750,6 +750,8 @@ again: remove_next = 1 + (end > next->vm_end);
}
}
+ vma_adjust_trans_huge(vma, start, end, adjust_next);
+
if (file) {
mapping = file->f_mapping;
if (!(vma->vm_flags & VM_NONLINEAR)) {
@@ -773,8 +775,6 @@ again: remove_next = 1 + (end > next->vm_end);
}
}
- vma_adjust_trans_huge(vma, start, end, adjust_next);
-
anon_vma = vma->anon_vma;
if (!anon_vma && adjust_next)
anon_vma = next->anon_vma;
--
1.8.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache
2013-08-10 6:28 [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache Ning Qu
@ 2013-08-12 13:55 ` Kirill A. Shutemov
0 siblings, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2013-08-12 13:55 UTC (permalink / raw)
To: Ning Qu
Cc: Kirill A. Shutemov, Matthew Wilcox, Kirill A. Shutemov,
linux-fsdevel, Hugh Dickins, Mel Gorman, Al Viro, Andrew Morton,
Andrea Arcangeli, linux-kernel, Andi Kleen, Wu Fengguang,
Jan Kara, Dave Hansen, linux-mm, Hillf Danton, Ning Qu
Ning Qu wrote:
> In vma_adjust, the current code grabs i_mmap_mutex before calling
> vma_adjust_trans_huge. This used to be fine until huge page in page
> cache comes in. The problem is the underlying function
> split_file_huge_page will also grab the i_mmap_mutex before splitting
> the huge page in page cache. Obviously this is causing deadlock
> situation.
>
> This fix is to move the vma_adjust_trans_huge before grab the lock for
> file, the same as what the function is currently doing for anonymous
> memory.
>
> Tested, everything works fine so far.
>
> Signed-off-by: Ning Qu <quning@google.com>
Thanks, applied.
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache.
@ 2013-08-09 21:34 Ning Qu
0 siblings, 0 replies; 3+ messages in thread
From: Ning Qu @ 2013-08-09 21:34 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Matthew Wilcox, Kirill A. Shutemov, linux-fsdevel, Hugh Dickins,
Mel Gorman, Al Viro, Andrew Morton, Andrea Arcangeli,
linux-kernel, Andi Kleen, Wu Fengguang, Jan Kara, Dave Hansen,
linux-mm, Hillf Danton, Ning Qu
In vma_adjust, the current code grabs i_mmap_mutex before calling
vma_adjust_trans_huge. This used to be fine until huge page in page
cache comes in. The problem is the underlying function
split_file_huge_page will also grab the i_mmap_mutex before splitting
the huge page in page cache. Obviously this is causing deadlock
situation.
This fix is to move the vma_adjust_trans_huge before grab the lock for
file, the same as what the function is currently doing for anonymous
memory. Tested, everything works fine so far.
Signed-off-by: Ning Qu <quning@google.com>
---
mm/mmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 519ce78..accf1b3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -750,6 +750,8 @@ again: remove_next = 1 + (end > next->vm_end);
}
}
+ vma_adjust_trans_huge(vma, start, end, adjust_next);
+
if (file) {
mapping = file->f_mapping;
if (!(vma->vm_flags & VM_NONLINEAR)) {
@@ -773,8 +775,6 @@ again: remove_next = 1 + (end > next->vm_end);
}
}
- vma_adjust_trans_huge(vma, start, end, adjust_next);
-
anon_vma = vma->anon_vma;
if (!anon_vma && adjust_next)
anon_vma = next->anon_vma;
--
1.8.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-12 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-10 6:28 [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache Ning Qu
2013-08-12 13:55 ` Kirill A. Shutemov
-- strict thread matches above, loose matches on Subject: below --
2013-08-09 21:34 Ning Qu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®