All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Cristopher Lameter <cl@linux.com>,
	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: Wed, 12 Jul 2017 11:03:42 +0200	[thread overview]
Message-ID: <20170712090341.GE28912@dhcp22.suse.cz> (raw)
In-Reply-To: <20170711214541.GA11141@cmpxchg.org>

On Tue 11-07-17 17:45:41, Johannes Weiner wrote:
[...]
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index a56c3989f773..efd3f48c667c 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -52,18 +52,24 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
>  {
>  	/* If the main allocator is up use that, fallback to bootmem. */
>  	if (slab_is_available()) {
> +		unsigned int order;
> +		static int warned;
>  		struct page *page;
> +		gfp_t gfp_mask;
>  
> +		order = get_order(size);
> +		gfp_mask = GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT|__GFP_NOWARN;

why not do
		gfp_mask = GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT;
		if (warned)
			gfp_mask |= __GFP_NOWARN;

and get the actual allocation warning from the allocation context. Then
we can keep the warning vmemmap_populate_hugepages because that would be
more descriptive that what is going on.

Btw. __GFP_REPEAT has been replaced by __GFP_RETRY_MAYFAIL in mmotm
tree.

>  		if (node_state(node, N_HIGH_MEMORY))
> -			page = alloc_pages_node(
> -				node, GFP_KERNEL | __GFP_ZERO | __GFP_REPEAT,
> -				get_order(size));
> +			page = alloc_pages_node(node, gfp_mask, size);
>  		else
> -			page = alloc_pages(
> -				GFP_KERNEL | __GFP_ZERO | __GFP_REPEAT,
> -				get_order(size));
> +			page = alloc_pages(gfp_mask, size);
>  		if (page)
>  			return page_address(page);
> +		if (!warned) {
> +			warn_alloc(gfp_mask, NULL,
> +				   "vmemmap alloc failure: order:%u", order);
> +			warned = 1;
> +		}
>  		return NULL;
>  	} else
>  		return __earlyonly_bootmem_alloc(node, size, size,

-- 
Michal Hocko
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Cristopher Lameter <cl@linux.com>,
	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: Wed, 12 Jul 2017 11:03:42 +0200	[thread overview]
Message-ID: <20170712090341.GE28912@dhcp22.suse.cz> (raw)
In-Reply-To: <20170711214541.GA11141@cmpxchg.org>

On Tue 11-07-17 17:45:41, Johannes Weiner wrote:
[...]
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index a56c3989f773..efd3f48c667c 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -52,18 +52,24 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
>  {
>  	/* If the main allocator is up use that, fallback to bootmem. */
>  	if (slab_is_available()) {
> +		unsigned int order;
> +		static int warned;
>  		struct page *page;
> +		gfp_t gfp_mask;
>  
> +		order = get_order(size);
> +		gfp_mask = GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT|__GFP_NOWARN;

why not do
		gfp_mask = GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT;
		if (warned)
			gfp_mask |= __GFP_NOWARN;

and get the actual allocation warning from the allocation context. Then
we can keep the warning vmemmap_populate_hugepages because that would be
more descriptive that what is going on.

Btw. __GFP_REPEAT has been replaced by __GFP_RETRY_MAYFAIL in mmotm
tree.

>  		if (node_state(node, N_HIGH_MEMORY))
> -			page = alloc_pages_node(
> -				node, GFP_KERNEL | __GFP_ZERO | __GFP_REPEAT,
> -				get_order(size));
> +			page = alloc_pages_node(node, gfp_mask, size);
>  		else
> -			page = alloc_pages(
> -				GFP_KERNEL | __GFP_ZERO | __GFP_REPEAT,
> -				get_order(size));
> +			page = alloc_pages(gfp_mask, size);
>  		if (page)
>  			return page_address(page);
> +		if (!warned) {
> +			warn_alloc(gfp_mask, NULL,
> +				   "vmemmap alloc failure: order:%u", order);
> +			warned = 1;
> +		}
>  		return NULL;
>  	} else
>  		return __earlyonly_bootmem_alloc(node, size, size,

-- 
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-12  9:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 13:42 [PATCH] vmemmap, memory_hotplug: fallback to base pages for vmmap Michal Hocko
2017-07-11 13:42 ` Michal Hocko
2017-07-11 14:25 ` Michal Hocko
2017-07-11 14:25   ` Michal Hocko
2017-07-11 17:26   ` Johannes Weiner
2017-07-11 17:26     ` Johannes Weiner
2017-07-11 18:06     ` Christoph Lameter
2017-07-11 18:06       ` Christoph Lameter
2017-07-11 21:25     ` Michal Hocko
2017-07-11 21:25       ` Michal Hocko
2017-07-11 21:45       ` Johannes Weiner
2017-07-11 21:45         ` Johannes Weiner
2017-07-12  9:03         ` Michal Hocko [this message]
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=20170712090341.GE28912@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 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.