From: Dan Williams <dan.j.williams@intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Sasha Levin <sasha.levin@oracle.com>,
Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH 2/4] thp: fix regression in handling mlocked pages in __split_huge_pmd()
Date: Thu, 24 Dec 2015 10:51:43 -0800 [thread overview]
Message-ID: <CAPcyv4iRPEw7tPT7bCBX+0eYbrTU679moLZ+zff1RXUvoDmCoA@mail.gmail.com> (raw)
In-Reply-To: <1450957883-96356-3-git-send-email-kirill.shutemov@linux.intel.com>
On Thu, Dec 24, 2015 at 3:51 AM, Kirill A. Shutemov
<kirill.shutemov@linux.intel.com> wrote:
> This patch fixes regression caused by patch
> "mm, dax: dax-pmd vs thp-pmd vs hugetlbfs-pmd"
>
> The patch makes pmd_trans_huge() check and "page = pmd_page(*pmd)" after
> __split_huge_pmd_locked(). It can never succeed, since the pmd already
> points to a page table. As result the page is never get munlocked.
>
> It causes crashes like this:
> http://lkml.kernel.org/r/5661FBB6.6050307@oracle.com
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Reported-by: Sasha Levin <sasha.levin@oracle.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
> mm/huge_memory.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 99f2a0ecb621..1a988d9b86ef 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3024,14 +3024,12 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
> ptl = pmd_lock(mm, pmd);
> if (unlikely(!pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)))
> goto out;
> - __split_huge_pmd_locked(vma, pmd, haddr, false);
> -
> - if (pmd_trans_huge(*pmd))
> - page = pmd_page(*pmd);
> - if (page && PageMlocked(page))
> + page = pmd_page(*pmd);
> + if (PageMlocked(page))
> get_page(page);
> else
> page = NULL;
> + __split_huge_pmd_locked(vma, pmd, haddr, false);
Since dax pmd mappings may not have a backing struct page I think this
additionally needs the following:
8<-----
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 4eae97325e95..c4eccfa836f4 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3025,11 +3025,13 @@ void __split_huge_pmd(struct vm_area_struct
*vma, pmd_t *pmd,
ptl = pmd_lock(mm, pmd);
if (unlikely(!pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)))
goto out;
- page = pmd_page(*pmd);
- if (PageMlocked(page))
- get_page(page);
- else
- page = NULL;
+ else if (pmd_trans_huge(*pmd)) {
+ page = pmd_page(*pmd);
+ if (PageMlocked(page))
+ get_page(page);
+ else
+ page = NULL;
+ }
__split_huge_pmd_locked(vma, pmd, haddr, false);
out:
spin_unlock(ptl);
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-12-24 18:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 11:51 [PATCH 0/4] THP updates Kirill A. Shutemov
2015-12-24 11:51 ` [PATCH 1/4] thp: add debugfs handle to split all huge pages Kirill A. Shutemov
2016-01-05 9:44 ` Vlastimil Babka
2015-12-24 11:51 ` [PATCH 2/4] thp: fix regression in handling mlocked pages in __split_huge_pmd() Kirill A. Shutemov
2015-12-24 18:51 ` Dan Williams [this message]
2015-12-24 22:56 ` Kirill A. Shutemov
2015-12-25 1:10 ` Sasha Levin
2015-12-25 1:12 ` Dan Williams
2015-12-25 1:17 ` Sasha Levin
2015-12-28 12:58 ` Kirill A. Shutemov
2015-12-24 11:51 ` [PATCH 3/4] mm: stop __munlock_pagevec_fill() if THP enounted Kirill A. Shutemov
2015-12-25 1:09 ` Sasha Levin
2015-12-28 23:22 ` Andrew Morton
2015-12-29 11:27 ` Kirill A. Shutemov
2016-01-05 10:18 ` Vlastimil Babka
2015-12-24 11:51 ` [PATCH 4/4] thp: increase split_huge_page() success rate Kirill A. Shutemov
2015-12-28 23:30 ` Andrew Morton
2015-12-29 20:57 ` Kirill A. Shutemov
2016-01-05 10:22 ` Vlastimil Babka
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=CAPcyv4iRPEw7tPT7bCBX+0eYbrTU679moLZ+zff1RXUvoDmCoA@mail.gmail.com \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=sasha.levin@oracle.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