Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516667 > unrolled thread
| Started by | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| First post | 2016-11-08 00:40 +0100 |
| Last post | 2016-11-11 12:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 00:40 +0100
Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-10 09:40 +0100
Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-10 10:20 +0100
Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-11 04:20 +0100
Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-11-11 12:20 +0100
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2016-11-08 00:40 +0100 |
| Subject | [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing |
| Message-ID | <sB1Ga-1xZ-29@gated-at.bofh.it> |
TTU_MIGRATION is used to convert pte into migration entry until thp split
completes. This behavior conflicts with thp migration added later patches,
so let's introduce a new TTU flag specifically for freezing.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
include/linux/rmap.h | 1 +
mm/huge_memory.c | 2 +-
mm/rmap.c | 8 +++++---
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git v4.9-rc2-mmotm-2016-10-27-18-27/include/linux/rmap.h v4.9-rc2-mmotm-2016-10-27-18-27_patched/include/linux/rmap.h
index b46bb56..a2fa425 100644
--- v4.9-rc2-mmotm-2016-10-27-18-27/include/linux/rmap.h
+++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/include/linux/rmap.h
@@ -87,6 +87,7 @@ enum ttu_flags {
TTU_MUNLOCK = 4, /* munlock mode */
TTU_LZFREE = 8, /* lazy free mode */
TTU_SPLIT_HUGE_PMD = 16, /* split huge PMD if any */
+ TTU_SPLIT_FREEZE = 32, /* freeze pte under splitting thp */
TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
diff --git v4.9-rc2-mmotm-2016-10-27-18-27/mm/huge_memory.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/huge_memory.c
index 2d1d6bb..0509d17 100644
--- v4.9-rc2-mmotm-2016-10-27-18-27/mm/huge_memory.c
+++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/huge_memory.c
@@ -1794,7 +1794,7 @@ static void freeze_page(struct page *page)
VM_BUG_ON_PAGE(!PageHead(page), page);
if (PageAnon(page))
- ttu_flags |= TTU_MIGRATION;
+ ttu_flags |= TTU_SPLIT_FREEZE;
/* We only need TTU_SPLIT_HUGE_PMD once */
ret = try_to_unmap(page, ttu_flags | TTU_SPLIT_HUGE_PMD);
diff --git v4.9-rc2-mmotm-2016-10-27-18-27/mm/rmap.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/rmap.c
index 1ef3640..a4be307 100644
--- v4.9-rc2-mmotm-2016-10-27-18-27/mm/rmap.c
+++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/rmap.c
@@ -1449,7 +1449,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
if (flags & TTU_SPLIT_HUGE_PMD) {
split_huge_pmd_address(vma, address,
- flags & TTU_MIGRATION, page);
+ flags & TTU_SPLIT_FREEZE, page);
/* check if we have anything to do after split */
if (page_mapcount(page) == 0)
goto out;
@@ -1527,7 +1527,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
* will take care of the rest.
*/
dec_mm_counter(mm, mm_counter(page));
- } else if (IS_ENABLED(CONFIG_MIGRATION) && (flags & TTU_MIGRATION)) {
+ } else if (IS_ENABLED(CONFIG_MIGRATION) &&
+ (flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE))) {
swp_entry_t entry;
pte_t swp_pte;
/*
@@ -1649,7 +1650,8 @@ int try_to_unmap(struct page *page, enum ttu_flags flags)
* locking requirements of exec(), migration skips
* temporary VMAs until after exec() completes.
*/
- if ((flags & TTU_MIGRATION) && !PageKsm(page) && PageAnon(page))
+ if ((flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE))
+ && !PageKsm(page) && PageAnon(page))
rwc.invalid_vma = invalid_migration_vma;
if (flags & TTU_RMAP_LOCKED)
--
2.7.0
[toc] | [next] | [standalone]
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-11-10 09:40 +0100 |
| Subject | Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing |
| Message-ID | <sBT3Q-3a8-29@gated-at.bofh.it> |
| In reply to | #1516667 |
On 11/08/2016 05:01 AM, Naoya Horiguchi wrote: > TTU_MIGRATION is used to convert pte into migration entry until thp split > completes. This behavior conflicts with thp migration added later patches, Hmm, could you please explain why it conflicts with the PMD based migration without split ? Why TTU_MIGRATION cannot be used to freeze/hold on the PMD while it's being migrated ?
[toc] | [prev] | [next] | [standalone]
| From | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> |
|---|---|
| Date | 2016-11-10 10:20 +0100 |
| Subject | Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing |
| Message-ID | <sBTGx-3Ex-27@gated-at.bofh.it> |
| In reply to | #1518744 |
On Thu, Nov 10, 2016 at 02:01:56PM +0530, Anshuman Khandual wrote:
> On 11/08/2016 05:01 AM, Naoya Horiguchi wrote:
> > TTU_MIGRATION is used to convert pte into migration entry until thp split
> > completes. This behavior conflicts with thp migration added later patches,
>
> Hmm, could you please explain why it conflicts with the PMD based
> migration without split ? Why TTU_MIGRATION cannot be used to
> freeze/hold on the PMD while it's being migrated ?
try_to_unmap() is used both for thp split (via freeze_page()) and page
migration (via __unmap_and_move()). In freeze_page(), ttu_flag given for
head page is like below (assuming anonymous thp):
(TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
TTU_MIGRATION | TTU_SPLIT_HUGE_PMD)
and ttu_flag given for tail pages is:
(TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
TTU_MIGRATION)
__unmap_and_move() calls try_to_unmap() with ttu_flag:
(TTU_MIGRATION | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS)
Now I'm trying to insert a branch for thp migration at the top of
try_to_unmap_one() like below
static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
unsigned long address, void *arg)
{
...
if (flags & TTU_MIGRATION) {
if (!PageHuge(page) && PageTransCompound(page)) {
set_pmd_migration_entry(page, vma, address);
goto out;
}
}
, so try_to_unmap() for tail pages called by thp split can go into thp
migration code path (which converts *pmd* into migration entry), while
the expectation is to freeze thp (which converts *pte* into migration entry.)
I detected this failure as a "bad page state" error in a testcase where
split_huge_page() is called from queue_pages_pte_range().
Anyway, I'll add this explanation into the patch description in the next post.
Thanks,
Naoya Horiguchi
[toc] | [prev] | [next] | [standalone]
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-11-11 04:20 +0100 |
| Subject | Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing |
| Message-ID | <sCaxH-7dZ-9@gated-at.bofh.it> |
| In reply to | #1518772 |
On 11/10/2016 02:39 PM, Naoya Horiguchi wrote:
> On Thu, Nov 10, 2016 at 02:01:56PM +0530, Anshuman Khandual wrote:
>> > On 11/08/2016 05:01 AM, Naoya Horiguchi wrote:
>>> > > TTU_MIGRATION is used to convert pte into migration entry until thp split
>>> > > completes. This behavior conflicts with thp migration added later patches,
>> >
>> > Hmm, could you please explain why it conflicts with the PMD based
>> > migration without split ? Why TTU_MIGRATION cannot be used to
>> > freeze/hold on the PMD while it's being migrated ?
> try_to_unmap() is used both for thp split (via freeze_page()) and page
> migration (via __unmap_and_move()). In freeze_page(), ttu_flag given for
> head page is like below (assuming anonymous thp):
>
> (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
> TTU_MIGRATION | TTU_SPLIT_HUGE_PMD)
Right.
>
> and ttu_flag given for tail pages is:
>
> (TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | \
> TTU_MIGRATION)
Right.
>
> __unmap_and_move() calls try_to_unmap() with ttu_flag:
>
> (TTU_MIGRATION | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS)
>
> Now I'm trying to insert a branch for thp migration at the top of
> try_to_unmap_one() like below
>
>
> static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
> unsigned long address, void *arg)
> {
> ...
> if (flags & TTU_MIGRATION) {
> if (!PageHuge(page) && PageTransCompound(page)) {
> set_pmd_migration_entry(page, vma, address);
> goto out;
> }
> }
>
> , so try_to_unmap() for tail pages called by thp split can go into thp
> migration code path (which converts *pmd* into migration entry), while
> the expectation is to freeze thp (which converts *pte* into migration entry.)
Got it.
>
> I detected this failure as a "bad page state" error in a testcase where
> split_huge_page() is called from queue_pages_pte_range().
>
> Anyway, I'll add this explanation into the patch description in the next post.
Sure, thanks for the explanation.
[toc] | [prev] | [next] | [standalone]
| From | "Kirill A. Shutemov" <kirill@shutemov.name> |
|---|---|
| Date | 2016-11-11 12:20 +0100 |
| Subject | Re: [PATCH v2 03/12] mm: thp: introduce separate TTU flag for thp freezing |
| Message-ID | <sCi2d-3Bo-19@gated-at.bofh.it> |
| In reply to | #1516667 |
On Tue, Nov 08, 2016 at 08:31:48AM +0900, Naoya Horiguchi wrote: > TTU_MIGRATION is used to convert pte into migration entry until thp split > completes. This behavior conflicts with thp migration added later patches, > so let's introduce a new TTU flag specifically for freezing. > > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> -- Kirill A. Shutemov
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web