From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: linux-mm@kvack.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Hansen <dave.hansen@intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
Pavel Emelyanov <xemul@parallels.com>,
linux-kernel@vger.kernel.org,
Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common path
Date: Thu, 3 Mar 2016 13:50:58 +0300 [thread overview]
Message-ID: <20160303105058.GC30948@node.shutemov.name> (raw)
In-Reply-To: <1456990918-30906-6-git-send-email-n-horiguchi@ah.jp.nec.com>
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.
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.
--
Kirill A. Shutemov
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: linux-mm@kvack.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Hansen <dave.hansen@intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
Pavel Emelyanov <xemul@parallels.com>,
linux-kernel@vger.kernel.org,
Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common path
Date: Thu, 3 Mar 2016 13:50:58 +0300 [thread overview]
Message-ID: <20160303105058.GC30948@node.shutemov.name> (raw)
In-Reply-To: <1456990918-30906-6-git-send-email-n-horiguchi@ah.jp.nec.com>
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.
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.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2016-03-03 10:51 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 7:41 [PATCH v1 00/11] mm: page migration enhancement for thp Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 01/11] mm: mempolicy: add queue_pages_node_check() Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 02/11] mm: thp: introduce CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 10:24 ` Kirill A. Shutemov
2016-03-03 10:24 ` Kirill A. Shutemov
2016-03-07 0:58 ` Balbir Singh
2016-03-07 0:58 ` Balbir Singh
2016-03-07 6:28 ` Naoya Horiguchi
2016-03-07 6:28 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd migration Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 9:25 ` kbuild test robot
2016-03-03 9:25 ` kbuild test robot
2016-03-03 10:40 ` Kirill A. Shutemov
2016-03-03 10:40 ` Kirill A. Shutemov
2016-03-03 16:15 ` Naoya Horiguchi
2016-03-03 16:15 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 04/11] mm: thp: enable thp migration in generic path Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 05/11] mm: thp: check pmd migration entry in common path Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 10:50 ` Kirill A. Shutemov [this message]
2016-03-03 10:50 ` Kirill A. Shutemov
2016-03-03 16:15 ` Naoya Horiguchi
2016-03-03 16:15 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 06/11] mm: soft-dirty: keep soft-dirty bits over thp migration Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 07/11] mm: hwpoison: fix race between unpoisoning and freeing migrate source page Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 7:41 ` [PATCH v1 08/11] mm: hwpoison: soft offline supports thp migration Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 8:06 ` kbuild test robot
2016-03-03 8:06 ` kbuild test robot
2016-03-03 7:41 ` [PATCH v1 09/11] mm: mempolicy: mbind and migrate_pages support " Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 8:08 ` kbuild test robot
2016-03-03 8:08 ` kbuild test robot
2016-03-03 7:41 ` [PATCH v1 10/11] mm: migrate: move_pages() supports " Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 8:24 ` kbuild test robot
2016-03-03 8:24 ` kbuild test robot
2016-03-03 7:41 ` [PATCH v1 11/11] mm: memory_hotplug: memory hotremove " Naoya Horiguchi
2016-03-03 7:41 ` Naoya Horiguchi
2016-03-03 8:40 ` Naoya Horiguchi
2016-03-03 8:40 ` Naoya Horiguchi
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=20160303105058.GC30948@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=nao.horiguchi@gmail.com \
--cc=vbabka@suse.cz \
--cc=xemul@parallels.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.