All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Zi Yan <zi.yan@cs.rutgers.edu>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Reale <ar@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [RFC PATCH 3/3] mm: unclutter THP migration
Date: Wed, 13 Dec 2017 15:20:35 +0300	[thread overview]
Message-ID: <20171213122035.av4kgn2lkbwk3ovn@node.shutemov.name> (raw)
In-Reply-To: <20171208161559.27313-4-mhocko@kernel.org>

On Fri, Dec 08, 2017 at 05:15:59PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> THP migration is hacked into the generic migration with rather
> surprising semantic. The migration allocation callback is supposed to
> check whether the THP can be migrated at once and if that is not the
> case then it allocates a simple page to migrate. unmap_and_move then
> fixes that up by spliting the THP into small pages while moving the
> head page to the newly allocated order-0 page. Remaning pages are moved
> to the LRU list by split_huge_page. The same happens if the THP
> allocation fails. This is really ugly and error prone [1].
> 
> I also believe that split_huge_page to the LRU lists is inherently
> wrong because all tail pages are not migrated. Some callers will just
> work around that by retrying (e.g. memory hotplug). There are other
> pfn walkers which are simply broken though. e.g. madvise_inject_error
> will migrate head and then advances next pfn by the huge page size.
> do_move_page_to_node_array, queue_pages_range (migrate_pages, mbind),
> will simply split the THP before migration if the THP migration is not
> supported then falls back to single page migration but it doesn't handle
> tail pages if the THP migration path is not able to allocate a fresh
> THP so we end up with ENOMEM and fail the whole migration which is
> a questionable behavior. Page compaction doesn't try to migrate large
> pages so it should be immune.
> 
> This patch tries to unclutter the situation by moving the special THP
> handling up to the migrate_pages layer where it actually belongs. We
> simply split the THP page into the existing list if unmap_and_move fails
> with ENOMEM and retry. So we will _always_ migrate all THP subpages and
> specific migrate_pages users do not have to deal with this case in a
> special way.
> 
> [1] http://lkml.kernel.org/r/20171121021855.50525-1-zi.yan@sent.com
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Looks good to me.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Zi Yan <zi.yan@cs.rutgers.edu>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Reale <ar@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [RFC PATCH 3/3] mm: unclutter THP migration
Date: Wed, 13 Dec 2017 15:20:35 +0300	[thread overview]
Message-ID: <20171213122035.av4kgn2lkbwk3ovn@node.shutemov.name> (raw)
In-Reply-To: <20171208161559.27313-4-mhocko@kernel.org>

On Fri, Dec 08, 2017 at 05:15:59PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> THP migration is hacked into the generic migration with rather
> surprising semantic. The migration allocation callback is supposed to
> check whether the THP can be migrated at once and if that is not the
> case then it allocates a simple page to migrate. unmap_and_move then
> fixes that up by spliting the THP into small pages while moving the
> head page to the newly allocated order-0 page. Remaning pages are moved
> to the LRU list by split_huge_page. The same happens if the THP
> allocation fails. This is really ugly and error prone [1].
> 
> I also believe that split_huge_page to the LRU lists is inherently
> wrong because all tail pages are not migrated. Some callers will just
> work around that by retrying (e.g. memory hotplug). There are other
> pfn walkers which are simply broken though. e.g. madvise_inject_error
> will migrate head and then advances next pfn by the huge page size.
> do_move_page_to_node_array, queue_pages_range (migrate_pages, mbind),
> will simply split the THP before migration if the THP migration is not
> supported then falls back to single page migration but it doesn't handle
> tail pages if the THP migration path is not able to allocate a fresh
> THP so we end up with ENOMEM and fail the whole migration which is
> a questionable behavior. Page compaction doesn't try to migrate large
> pages so it should be immune.
> 
> This patch tries to unclutter the situation by moving the special THP
> handling up to the migrate_pages layer where it actually belongs. We
> simply split the THP page into the existing list if unmap_and_move fails
> with ENOMEM and retry. So we will _always_ migrate all THP subpages and
> specific migrate_pages users do not have to deal with this case in a
> special way.
> 
> [1] http://lkml.kernel.org/r/20171121021855.50525-1-zi.yan@sent.com
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Looks good to me.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 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>

  reply	other threads:[~2017-12-13 12:20 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 12:48 [RFC PATCH] mm: unclutter THP migration Michal Hocko
2017-12-07 12:48 ` Michal Hocko
2017-12-07 14:10 ` Zi Yan
2017-12-07 14:34   ` Michal Hocko
2017-12-07 14:34     ` Michal Hocko
2017-12-08 16:15     ` [RFC PATCH 0/3] " Michal Hocko
2017-12-08 16:15       ` Michal Hocko
2017-12-08 16:15       ` [RFC PATCH 1/3] mm, numa: rework do_pages_move Michal Hocko
2017-12-08 16:15         ` Michal Hocko
2017-12-13 12:07         ` Kirill A. Shutemov
2017-12-13 12:07           ` Kirill A. Shutemov
2017-12-13 12:17           ` Michal Hocko
2017-12-13 12:17             ` Michal Hocko
2017-12-13 12:47             ` Kirill A. Shutemov
2017-12-13 12:47               ` Kirill A. Shutemov
2017-12-13 14:10               ` Michal Hocko
2017-12-13 14:10                 ` Michal Hocko
2017-12-13 14:27                 ` Kirill A. Shutemov
2017-12-13 14:27                   ` Kirill A. Shutemov
2017-12-13 14:39         ` Michal Hocko
2017-12-13 14:39           ` Michal Hocko
2017-12-14 15:35           ` Kirill A. Shutemov
2017-12-14 15:35             ` Kirill A. Shutemov
2017-12-15  9:28             ` Michal Hocko
2017-12-15  9:28               ` Michal Hocko
2017-12-15  9:51               ` Kirill A. Shutemov
2017-12-15  9:51                 ` Kirill A. Shutemov
2017-12-15  9:57                 ` Michal Hocko
2017-12-15  9:57                   ` Michal Hocko
2018-01-02 11:25         ` Anshuman Khandual
2018-01-02 11:25           ` Anshuman Khandual
2018-01-02 12:12           ` Michal Hocko
2018-01-02 12:12             ` Michal Hocko
2018-01-03  3:11             ` Anshuman Khandual
2018-01-03  3:11               ` Anshuman Khandual
2018-01-03  8:42         ` Anshuman Khandual
2018-01-03  8:42           ` Anshuman Khandual
2018-01-03  8:58           ` Michal Hocko
2018-01-03  8:58             ` Michal Hocko
2018-01-03  9:36             ` Anshuman Khandual
2018-01-03  9:36               ` Anshuman Khandual
2018-01-03  9:52               ` Michal Hocko
2018-01-03  9:52                 ` Michal Hocko
2017-12-08 16:15       ` [RFC PATCH 2/3] mm, migrate: remove reason argument from new_page_t Michal Hocko
2017-12-08 16:15         ` Michal Hocko
2017-12-27  2:12         ` Zi Yan
2017-12-29 11:32           ` Michal Hocko
2017-12-29 11:32             ` Michal Hocko
2017-12-08 16:15       ` [RFC PATCH 3/3] mm: unclutter THP migration Michal Hocko
2017-12-08 16:15         ` Michal Hocko
2017-12-13 12:20         ` Kirill A. Shutemov [this message]
2017-12-13 12:20           ` Kirill A. Shutemov
2017-12-27  2:19         ` Zi Yan
2017-12-29 11:36           ` Michal Hocko
2017-12-29 11:36             ` Michal Hocko
2017-12-29 15:45             ` Zi Yan
2017-12-31  9:07               ` Michal Hocko
2017-12-31  9:07                 ` Michal Hocko
2017-12-31 13:09                 ` Zi Yan
2017-12-19 12:07       ` [RFC PATCH 0/3] " Michal Hocko
2017-12-19 12:07         ` Michal Hocko

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=20171213122035.av4kgn2lkbwk3ovn@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=ar@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=vbabka@suse.cz \
    --cc=zi.yan@cs.rutgers.edu \
    /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.