linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ning Qu <quning@google.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	linux-fsdevel@vger.kernel.org, Hugh Dickins <hughd@google.com>,
	Mel Gorman <mgorman@suse.de>, Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>, Jan Kara <jack@suse.cz>,
	Dave Hansen <dave@sr71.net>,
	linux-mm@kvack.org, Hillf Danton <dhillf@gmail.com>,
	Ning Qu <quning@google.com>
Subject: Re: [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache.
Date: Fri, 9 Aug 2013 22:22:14 -0700	[thread overview]
Message-ID: <CACz4_2csQVrBqcfFTwbjgxCkEDY-Q6Ta4f5dVemM==ae4U8U2Q@mail.gmail.com> (raw)
In-Reply-To: <CACQD4-6_AmsDu6q_ChaiTCZNZ6zghJdWzZTmD1JQhLCkfMeeNA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

Oh, sorry about that. Let me see what's going on here.

Best wishes,
-- 
Ning Qu (曲宁) | Software Engineer | quning@google.com | +1-408-418-6066


On Fri, Aug 9, 2013 at 2:34 PM, Ning Qu <quning@google.com> 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>
> ---
>  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
>

[-- Attachment #2: Type: text/html, Size: 4037 bytes --]

  reply	other threads:[~2013-08-10  5:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 21:34 [PATCH] thp: Fix deadlock situation in vma_adjust with huge page in page cache Ning Qu
2013-08-10  5:22 ` Ning Qu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-08-10  6:28 Ning Qu
2013-08-12 13:55 ` Kirill A. Shutemov
2013-08-12 16:42   ` Ning Qu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACz4_2csQVrBqcfFTwbjgxCkEDY-Q6Ta4f5dVemM==ae4U8U2Q@mail.gmail.com' \
    --to=quning@google.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@sr71.net \
    --cc=dhillf@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).