Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1169860

Re: [PATCHv6 33/36] migrate_pages: try to split pages on qeueuing

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCHv6 33/36] migrate_pages: try to split pages on qeueuing
Date Mon, 22 Jun 2015 13:40:02 +0200
Message-ID <pE8f0-2pg-3@gated-at.bofh.it> (permalink)
References <pxkkW-7sr-9@gated-at.bofh.it> <pxkuB-7Ey-13@gated-at.bofh.it> <pA6Ya-1q8-5@gated-at.bofh.it>
X-Original-To Vlastimil Babka <vbabka@suse.cz>
Razorgate-Kas Rate: 5
Razorgate-Kas {RECEIVED: dynamic ip detected}
Razorgate-Kas Envelope from:
Razorgate-Kas Version: 5.5.3
Razorgate-Kas LuaCore: 80 2014-11-10_18-01-23 260f8afb9361da3c7edfd3a8e3a4ca908191ad29
Razorgate-Kas Method: none
Razorgate-Kas Lua profiles 69136 [Nov 12 2014]
Razorgate-Kas Status: not_detected
Dkim-Signature v=1; a=rsa-sha256; c=simple/simple; d=shutemov.name; s=default; t=1434972926; bh=BcUexVV1ZRavQRmyrBNWpbntr5QH66mCohZr7hD+liQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Yc0k5ApkfE7ySGahs6YySA82CEUyQfYGxrJRksyBPtJKuQpbvf/2xoYKOX1KrCHFE NvthM9tmT8VuDZrKt3ayUiojP1bfgJjCnqfQ/GTd6eUwU6VsC3HQsT4FrcX7Ap9gs8 j/Ew68oFDwCU9DugQu2wxnRyJDW+Xdmr7FnUpWgQ=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23.1 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 68
Organization linux.* mail to news gateway
X-Original-Cc "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Andrew Morton <akpm@linux-foundation.org>, Andrea Arcangeli <aarcange@redhat.com>, Hugh Dickins <hughd@google.com>, Dave Hansen <dave.hansen@intel.com>, Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>, Christoph Lameter <cl@gentwo.org>, Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>, Steve Capper <steve.capper@linaro.org>, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@suse.cz>, Jerome Marchand <jmarchan@redhat.com>, Sasha Levin <sasha.levin@oracle.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org
X-Original-Date Mon, 22 Jun 2015 14:35:25 +0300
X-Original-Message-ID <20150622113525.GE7934@node.dhcp.inet.fi>
X-Original-References <1433351167-125878-1-git-send-email-kirill.shutemov@linux.intel.com> <1433351167-125878-34-git-send-email-kirill.shutemov@linux.intel.com> <55795477.90808@suse.cz>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1169860

Show key headers only | View raw


On Thu, Jun 11, 2015 at 11:27:19AM +0200, Vlastimil Babka wrote:
> On 06/03/2015 07:06 PM, Kirill A. Shutemov wrote:
> >We are not able to migrate THPs. It means it's not enough to split only
> >PMD on migration -- we need to split compound page under it too.
> >
> >Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> >---
> >  mm/mempolicy.c | 37 +++++++++++++++++++++++++++++++++----
> >  1 file changed, 33 insertions(+), 4 deletions(-)
> >
> >diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> >index 528f6c467cf1..0b1499c2f890 100644
> >--- a/mm/mempolicy.c
> >+++ b/mm/mempolicy.c
> >@@ -489,14 +489,31 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
> >  	struct page *page;
> >  	struct queue_pages *qp = walk->private;
> >  	unsigned long flags = qp->flags;
> >-	int nid;
> >+	int nid, ret;
> >  	pte_t *pte;
> >  	spinlock_t *ptl;
> >
> >-	split_huge_pmd(vma, pmd, addr);
> >-	if (pmd_trans_unstable(pmd))
> >-		return 0;
> >+	if (pmd_trans_huge(*pmd)) {
> >+		ptl = pmd_lock(walk->mm, pmd);
> >+		if (pmd_trans_huge(*pmd)) {
> >+			page = pmd_page(*pmd);
> >+			if (is_huge_zero_page(page)) {
> >+				spin_unlock(ptl);
> >+				split_huge_pmd(vma, pmd, addr);
> >+			} else {
> >+				get_page(page);
> >+				spin_unlock(ptl);
> >+				lock_page(page);
> >+				ret = split_huge_page(page);
> >+				unlock_page(page);
> >+				put_page(page);
> >+				if (ret)
> >+					return 0;
> >+			}
> >+		}
> >+	}
> >
> >+retry:
> >  	pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
> >  	for (; addr != end; pte++, addr += PAGE_SIZE) {
> >  		if (!pte_present(*pte))
> >@@ -513,6 +530,18 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
> >  		nid = page_to_nid(page);
> >  		if (node_isset(nid, *qp->nmask) == !!(flags & MPOL_MF_INVERT))
> >  			continue;
> >+		if (PageTail(page) && PageAnon(page)) {
> 
> Hm, can it really happen that we stumble upon THP tail page here, without
> first stumbling upon it in the previous hunk above? If so, when?

The first hunk catch PMD-mapped THP and here we deal with PTE-mapped.
The scenario: fault in a THP, split PMD (not page) e.g. with mprotect()
and then try to migrate.

-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCHv6 33/36] migrate_pages: try to split pages on qeueuing Vlastimil Babka <vbabka@suse.cz> - 2015-06-11 11:30 +0200
  Re: [PATCHv6 33/36] migrate_pages: try to split pages on qeueuing "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-06-22 13:40 +0200

csiph-web