Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195185 > unrolled thread

Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE

Started byMel Gorman <mgorman@techsingularity.net>
First post2015-07-29 15:40 +0200
Last post2015-07-30 17:20 +0200
Articles 3 — 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.


Contents

  Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE Mel Gorman <mgorman@techsingularity.net> - 2015-07-29 15:40 +0200
    Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass  __GFP_THISNODE Christoph Lameter <cl@linux.com> - 2015-07-30 16:40 +0200
    Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE Johannes Weiner <hannes@cmpxchg.org> - 2015-07-30 17:20 +0200

#1195185 — Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE

FromMel Gorman <mgorman@techsingularity.net>
Date2015-07-29 15:40 +0200
SubjectRe: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE
Message-ID<pRzKr-15P-33@gated-at.bofh.it>
On Fri, Jul 24, 2015 at 04:45:23PM +0200, Vlastimil Babka wrote:
> The function alloc_pages_exact_node() was introduced in 6484eb3e2a81 ("page
> allocator: do not check NUMA node ID when the caller knows the node is valid")

No gold stars for that one.

> as an optimized variant of alloc_pages_node(), that doesn't allow the node id
> to be -1. Unfortunately the name of the function can easily suggest that the
> allocation is restricted to the given node and fails otherwise. In truth, the
> node is only preferred, unless __GFP_THISNODE is passed among the gfp flags.
> 
> The misleading name has lead to mistakes in the past, see 5265047ac301 ("mm,
> thp: really limit transparent hugepage allocation to local node") and
> b360edb43f8e ("mm, mempolicy: migrate_to_node should only migrate to node").
> 
> To prevent further mistakes and provide a convenience function for allocations
> truly restricted to a node, this patch makes alloc_pages_exact_node() pass
> __GFP_THISNODE to that effect. The previous implementation of

The change of what we have now is a good idea. What you have is a solid
improvement in my view but I see there are a few different suggestions
in the thread. Based on that I think it makes sense to just destroy
alloc_pages_exact_node. In the future "exact" in the allocator API will
mean "exactly this number of pages". Use your __alloc_pages_node helper
and specify __GFP_THISNODE if the caller requires that specific node.

> alloc_pages_exact_node() is copied as __alloc_pages_node() which implies it's
> an optimized variant of __alloc_pages_node() not intended for general usage.
> All three functions are described in the comment.
> 
> Existing callers of alloc_pages_exact_node() are adjusted as follows:
> - those that explicitly pass __GFP_THISNODE keep calling
>   alloc_pages_exact_node(), but the flag is removed from the call

__alloc_pages_node(__GFP_THISNODE) would be harder to get wrong in the future

> - others are converted to call __alloc_pages_node(). Some may still pass
>   __GFP_THISNODE if they serve as wrappers that get gfp_flags from higher
>   layers.
> 
> There's exception of sba_alloc_coherent() which open-codes the check for
> nid == -1, so it is converted to use alloc_pages_node() instead. This means
> it no longer performs some VM_BUG_ON checks, but otherwise the whole patch
> makes no functional changes.
> 

In general, checks for -1 should go away, particularly with new patches.
Use NUMA_NO_NODE.

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1196089 — Re: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE

FromChristoph Lameter <cl@linux.com>
Date2015-07-30 16:40 +0200
SubjectRe: [RFC v2 1/4] mm: make alloc_pages_exact_node pass __GFP_THISNODE
Message-ID<pRXa2-19k-35@gated-at.bofh.it>
In reply to#1195185
On Wed, 29 Jul 2015, Mel Gorman wrote:

> The change of what we have now is a good idea. What you have is a solid
> improvement in my view but I see there are a few different suggestions
> in the thread. Based on that I think it makes sense to just destroy
> alloc_pages_exact_node. In the future "exact" in the allocator API will
> mean "exactly this number of pages". Use your __alloc_pages_node helper
> and specify __GFP_THISNODE if the caller requires that specific node.

Yes please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1196118

FromJohannes Weiner <hannes@cmpxchg.org>
Date2015-07-30 17:20 +0200
Message-ID<pRXMJ-28D-1@gated-at.bofh.it>
In reply to#1195185
On Wed, Jul 29, 2015 at 02:30:43PM +0100, Mel Gorman wrote:
> The change of what we have now is a good idea. What you have is a solid
> improvement in my view but I see there are a few different suggestions
> in the thread. Based on that I think it makes sense to just destroy
> alloc_pages_exact_node. In the future "exact" in the allocator API will
> mean "exactly this number of pages". Use your __alloc_pages_node helper
> and specify __GFP_THISNODE if the caller requires that specific node.

+1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web