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


Groups > linux.kernel > #1349339

Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common path

From Naoya Horiguchi <nao.horiguchi@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common path
Date 2016-03-03 17:30 +0100
Message-ID <r8Eiv-1kl-29@gated-at.bofh.it> (permalink)
References <r8wbg-3Mh-5@gated-at.bofh.it> <r8wbh-3Mh-33@gated-at.bofh.it> <r8z98-5Rb-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 03, 2016 at 01:50:58PM +0300, Kirill A. Shutemov wrote:
> On Thu, Mar 03, 2016 at 04:41:52PM +0900, Naoya Horiguchi wrote:
> > If one of callers of page migration starts to handle thp, memory management code
> > start to see pmd migration entry, so we need to prepare for it before enabling.
> > This patch changes various code point which checks the status of given pmds in
> > order to prevent race between thp migration and the pmd-related works.
> >
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > ---
> >  arch/x86/mm/gup.c  |  3 +++
> >  fs/proc/task_mmu.c | 25 +++++++++++++--------
> >  mm/gup.c           |  8 +++++++
> >  mm/huge_memory.c   | 66 ++++++++++++++++++++++++++++++++++++++++++++++++------
> >  mm/memcontrol.c    |  2 ++
> >  mm/memory.c        |  5 +++++
> >  6 files changed, 93 insertions(+), 16 deletions(-)
> >
> > diff --git v4.5-rc5-mmotm-2016-02-24-16-18/arch/x86/mm/gup.c v4.5-rc5-mmotm-2016-02-24-16-18_patched/arch/x86/mm/gup.c
> > index f8d0b5e..34c3d43 100644
> > --- v4.5-rc5-mmotm-2016-02-24-16-18/arch/x86/mm/gup.c
> > +++ v4.5-rc5-mmotm-2016-02-24-16-18_patched/arch/x86/mm/gup.c
> > @@ -10,6 +10,7 @@
> >  #include <linux/highmem.h>
> >  #include <linux/swap.h>
> >  #include <linux/memremap.h>
> > +#include <linux/swapops.h>
> >
> >  #include <asm/pgtable.h>
> >
> > @@ -210,6 +211,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
> >  		if (pmd_none(pmd))
> >  			return 0;
> >  		if (unlikely(pmd_large(pmd) || !pmd_present(pmd))) {
> > +			if (unlikely(is_pmd_migration_entry(pmd)))
> > +				return 0;
>
> Hm. I've expected to see bunch of pmd_none() to pmd_present() conversions.
> That's seems a right way guard the code. Otherwise we wound need even more
> checks once PMD-level swap is implemented.

Yes, I agree. I'll try some for this pmd_none/pmd_present issue.

Thanks,
Naoya

>
> I think we need to check for migration entires only if we have something
> to do with migration. In all other cases pmd_present() should be enough to
> bail out.

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


Thread

[PATCH v1 00/11] mm: page migration enhancement for thp Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 07/11] mm: hwpoison: fix race between unpoisoning and freeing migrate source page Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 11/11] mm: memory_hotplug: memory hotremove supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 11/11] mm: memory_hotplug: memory hotremove supports  thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 09:50 +0100
  [PATCH v1 10/11] mm: migrate: move_pages() supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 09/11] mm: mempolicy: mbind and migrate_pages support thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration kbuild test robot <lkp@intel.com> - 2016-03-03 10:30 +0100
    Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 11:50 +0100
      Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration Naoya Horiguchi <nao.horiguchi@gmail.com> - 2016-03-03 17:30 +0100
  [PATCH v1 02/11] mm: thp: introduce CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 02/11] mm: thp: introduce  CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 11:30 +0100
  [PATCH v1 05/11] mm: thp: check pmd migration entry in common path Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common  path "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 12:00 +0100
      Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common  path Naoya Horiguchi <nao.horiguchi@gmail.com> - 2016-03-03 17:30 +0100
  [PATCH v1 06/11] mm: soft-dirty: keep soft-dirty bits over thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100

csiph-web