linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, david@redhat.com,
	anthony.yznaga@oracle.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm,memory_hotplug: Explicitly pass the head to isolate_huge_page
Date: Tue, 12 Feb 2019 14:45:49 +0100	[thread overview]
Message-ID: <20190212134546.gubfir6zzwrvmunr@d104.suse.de> (raw)
In-Reply-To: <20190212083329.GN15609@dhcp22.suse.cz>

On Tue, Feb 12, 2019 at 09:33:29AM +0100, Michal Hocko wrote:
> >  
> >  		if (PageHuge(page)) {
> >  			struct page *head = compound_head(page);
> > -			pfn = page_to_pfn(head) + (1<<compound_order(head)) - 1;
> >  			if (compound_order(head) > PFN_SECTION_SHIFT) {
> >  				ret = -EBUSY;
> >  				break;
> >  			}
> 
> Why are we doing this, btw? 

I assume you are referring to:

> >                     if (compound_order(head) > PFN_SECTION_SHIFT) {
> >                             ret = -EBUSY;
> >                             break;
> >                     }

I thought it was in case we stumble upon a gigantic page, and commit
(c8721bbbdd36 mm: memory-hotplug: enable memory hotplug to handle hugepage)
confirms it.

But I am not really sure if the above condition would still hold on powerpc,
I wanted to check it but it is a bit more tricky than it is in x86_64 because
of the different hugetlb sizes.
Could it be that the above condition is not true, but still the order of that
hugetlb page goes beyond MAX_ORDER? It is something I have to check.

Anyway, I think that a safer way to check this would be using hstate_is_gigantic(),
which checks whether the order of the hstate goes beyond MAX_ORDER.
In the end, I think that all we care about is if we can get the pages to migrate
to via the buddy allocator, since gigantic pages need to use another method.

Actually, alloc_migrate_huge_page() checks for it:

<---
static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
		int nid, nodemask_t *nmask)
{

	if (hstate_is_gigantic(h))
		return NULL;
--->

Another thing is that AFAICS, as long as the memblock we try to offline contains
a gigantic page, it will not be able to be offlined.
Moreover, the -EBUSY we return in that case is not checked anywhere, although that
is not really an issue because scan_movable_pages will skip it in the next loop.

Now, this is more rambling than anything:
Maybe I am missing half of the picture, but I have been thinking for a while whether
we could do better when it comes to gigantic pages vs hotplug.
I think that we could try to migrate those in case any of the other nodes
have a spare pre-allocated gigantic page.

-- 
Oscar Salvador
SUSE L3


  reply	other threads:[~2019-02-12 13:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  9:06 [PATCH] mm,memory_hotplug: Explicitly pass the head to isolate_huge_page Oscar Salvador
2019-02-11  8:58 ` David Hildenbrand
2019-02-12  8:33 ` Michal Hocko
2019-02-12 13:45   ` Oscar Salvador [this message]
2019-02-12 14:40     ` Michal Hocko
2019-02-13  0:13       ` Mike Kravetz
2019-02-13  8:13         ` Oscar Salvador
2019-02-13 12:33           ` Michal Hocko
2019-02-13 15:15             ` Oscar Salvador

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=20190212134546.gubfir6zzwrvmunr@d104.suse.de \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anthony.yznaga@oracle.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).