linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Cristopher Lameter <cl@linux.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vmemmap, memory_hotplug: fallback to base pages for vmmap
Date: Tue, 11 Jul 2017 16:25:58 +0200	[thread overview]
Message-ID: <20170711142558.GE11936@dhcp22.suse.cz> (raw)
In-Reply-To: <20170711134204.20545-1-mhocko@kernel.org>

Ohh, scratch that. The patch is bogus. I have completely missed that
vmemmap_populate_hugepages already falls back to
vmemmap_populate_basepages. I have to revisit the bug report I have
received to see what happened apart from the allocation warning. Maybe
we just want to silent that warning.

Sorry about the noise!

On Tue 11-07-17 15:42:04, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> vmemmap_populate uses huge pages if the CPU supports them which is good
> and usually what we want. vmemmap_alloc_block will use the bootmem
> allocator in the early initialization so the allocation will most likely
> succeed. This is not the case for the memory hotplug though. Such an
> allocation can easily fail under memory pressure. Especially so when the
> kernel memory is restricted with movable_node parameter.
> 
> There is no real reason to fail the vmemmap_populate when
> vmemmap_populate_hugepages fails though. We can still fallback to
> vmemmap_populate_basepages and use base pages. The performance will not
> be optimal but this is much better than failing the memory hot add.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
>  arch/x86/mm/init_64.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 136422d7d539..e6e3c755b9cb 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1401,15 +1401,16 @@ static int __meminit vmemmap_populate_hugepages(unsigned long start,
>  int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
>  {
>  	struct vmem_altmap *altmap = to_vmem_altmap(start);
> -	int err;
> +	int err = -ENOMEM;
>  
>  	if (boot_cpu_has(X86_FEATURE_PSE))
>  		err = vmemmap_populate_hugepages(start, end, node, altmap);
>  	else if (altmap) {
>  		pr_err_once("%s: no cpu support for altmap allocations\n",
>  				__func__);
> -		err = -ENOMEM;
> -	} else
> +		return err;
> +	}
> +	if (err)
>  		err = vmemmap_populate_basepages(start, end, node);
>  	if (!err)
>  		sync_global_pgds(start, end - 1);
> -- 
> 2.11.0
> 

-- 
Michal Hocko
SUSE Labs

--
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-07-11 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 13:42 Michal Hocko
2017-07-11 14:25 ` Michal Hocko [this message]
2017-07-11 17:26   ` Johannes Weiner
2017-07-11 18:06     ` Christoph Lameter
2017-07-11 21:25     ` Michal Hocko
2017-07-11 21:45       ` Johannes Weiner
2017-07-12  9:03         ` 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=20170711142558.GE11936@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    /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