Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756241AbcK2HJ2 convert rfc822-to-8bit (ORCPT ); Tue, 29 Nov 2016 02:09:28 -0500 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:50881 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753188AbcK2HJZ (ORCPT ); Tue, 29 Nov 2016 02:09:25 -0500 From: Naoya Horiguchi To: Anshuman Khandual CC: "linux-mm@kvack.org" , "Kirill A. Shutemov" , Hugh Dickins , "Andrew Morton" , Dave Hansen , Andrea Arcangeli , Mel Gorman , Michal Hocko , "Vlastimil Babka" , Pavel Emelyanov , Zi Yan , Balbir Singh , "linux-kernel@vger.kernel.org" , "Naoya Horiguchi" Subject: Re: [PATCH v2 10/12] mm: mempolicy: mbind and migrate_pages support thp migration Thread-Topic: [PATCH v2 10/12] mm: mempolicy: mbind and migrate_pages support thp migration Thread-Index: AQHSOU87MNRnvUgl8UyoJSrPmq98T6DpJQkAgAXv/AA= Date: Tue, 29 Nov 2016 07:07:34 +0000 Message-ID: <20161129070734.GB8686@hori1.linux.bs1.fc.nec.co.jp> References: <1478561517-4317-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1478561517-4317-11-git-send-email-n-horiguchi@ah.jp.nec.com> <58382E28.9060706@linux.vnet.ibm.com> In-Reply-To: <58382E28.9060706@linux.vnet.ibm.com> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.128.101.15] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <36C2641DB6F1824ABD83048884B48EDB@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1549 Lines: 49 On Fri, Nov 25, 2016 at 05:57:20PM +0530, Anshuman Khandual wrote: > On 11/08/2016 05:01 AM, Naoya Horiguchi wrote: ... > > @@ -497,30 +541,15 @@ 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, ret; > > + int ret; > > pte_t *pte; > > spinlock_t *ptl; > > > > - 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, false, NULL); > > - } 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; > > - } > > - } else { > > - spin_unlock(ptl); > > - } > > + ptl = pmd_trans_huge_lock(pmd, vma); > > + if (ptl) { > > + ret = queue_pages_pmd(pmd, ptl, addr, end, walk); > > + if (ret) > > + return 0; > > } > > I wonder if we should introduce pte_entry function along with pmd_entry > function as we are first looking for trans huge PMDs either for direct > addition into the migration list or splitting it before looking for PTEs. Most of pagewalk users don't define pte_entry because of performance reason (to avoid the overhead of PTRS_PER_PMD function calls). But that could be a nice cleanup if we have a workaround. Thanks, Naoya Horiguchi