Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754414AbcKIV3S (ORCPT ); Wed, 9 Nov 2016 16:29:18 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36745 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbcKIV3Q (ORCPT ); Wed, 9 Nov 2016 16:29:16 -0500 Subject: Re: [PATCH v2 00/12] mm: page migration enhancement for thp To: Naoya Horiguchi References: <1478561517-4317-1-git-send-email-n-horiguchi@ah.jp.nec.com> <20161109045926.GB7770@hori1.linux.bs1.fc.nec.co.jp> 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 , "linux-kernel@vger.kernel.org" , Naoya Horiguchi From: Balbir Singh Message-ID: Date: Thu, 10 Nov 2016 08:28:54 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161109045926.GB7770@hori1.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3013 Lines: 90 On 09/11/16 15:59, Naoya Horiguchi wrote: > On Wed, Nov 09, 2016 at 01:32:04PM +1100, Balbir Singh wrote: >> On 08/11/16 10:31, Naoya Horiguchi wrote: >>> Hi everyone, >>> >>> I've updated thp migration patches for v4.9-rc2-mmotm-2016-10-27-18-27 >>> with feedbacks for ver.1. >>> >>> General description (no change since ver.1) >>> =========================================== >>> >>> This patchset enhances page migration functionality to handle thp migration >>> for various page migration's callers: >>> - mbind(2) >>> - move_pages(2) >>> - migrate_pages(2) >>> - cgroup/cpuset migration >>> - memory hotremove >>> - soft offline >>> >>> The main benefit is that we can avoid unnecessary thp splits, which helps us >>> avoid performance decrease when your applications handles NUMA optimization on >>> their own. >>> >>> The implementation is similar to that of normal page migration, the key point >>> is that we modify a pmd to a pmd migration entry in swap-entry like format. >>> >>> Changes / Notes >>> =============== >>> >>> - pmd_present() in x86 checks _PAGE_PRESENT, _PAGE_PROTNONE and _PAGE_PSE >>> bits together, which makes implementing thp migration a bit hard because >>> _PAGE_PSE bit is currently used by soft-dirty in swap-entry format. >>> I was advised to dropping _PAGE_PSE in pmd_present(), but I don't think >>> of the justification, so I keep it in this version. Instead, my approach >>> is to move _PAGE_SWP_SOFT_DIRTY to bit 6 (unused) and reserve bit 7 for >>> pmd non-present cases. >> >> Thanks, IIRC >> >> pmd_present = _PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE >> >> AutoNUMA balancing would change it to >> >> pmd_present = _PAGE_PROTNONE | _PAGE_PSE >> >> and PMD_SWP_SOFT_DIRTY would make it >> >> pmd_present = _PAGE_PSE >> >> What you seem to be suggesting in your comment is that >> >> pmd_present should be _PAGE_PRESENT | _PAGE_PROTNONE > > This (no _PAGE_PSE) was a possibile solution, and as I described I gave up > this solution, because I noticed that what I actually wanted was that > pmd_present() certainly returns false during thp migration and that's done > by moving _PAGE_SWP_SOFT_DIRTY. So > > pmd_present = _PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE > > is still correct in this patchset. > Thanks, I was wondering if there is any advantage or you felt its safer not to change pmd_present(). >> >> Isn't that good enough? >> >> For THP migration I guess we use >> >> _PAGE_PRESENT | _PAGE_PROTNONE | is_migration_entry(pmd) > > Though I might misread your notations, I hope that the following code > seems describe itself well. > > static inline int is_pmd_migration_entry(pmd_t pmd) > { > return !pmd_present(pmd) && is_migration_entry(pmd_to_swp_entry(pmd)); > } > Thanks, yes my notation is not the best. Balbir Singh.