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


Groups > linux.kernel > #1576745

Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes

From Vlastimil Babka <vbabka@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes
Date 2017-02-08 18:30 +0100
Message-ID <t8Ee6-3aO-13@gated-at.bofh.it> (permalink)
References <t8B6y-1k4-19@gated-at.bofh.it> <t8Ee5-3aO-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/08/2017 03:01 PM, Anshuman Khandual wrote:
> This implements allocation isolation for CDM nodes in buddy allocator by
> discarding CDM memory zones all the time except in the cases where the gfp
> flag has got __GFP_THISNODE or the nodemask contains CDM nodes in cases
> where it is non NULL (explicit allocation request in the kernel or user
> process MPOL_BIND policy based requests).
>
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  mm/page_alloc.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 40908de..7d8c82a 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -64,6 +64,7 @@
>  #include <linux/page_owner.h>
>  #include <linux/kthread.h>
>  #include <linux/memcontrol.h>
> +#include <linux/node.h>
>
>  #include <asm/sections.h>
>  #include <asm/tlbflush.h>
> @@ -2908,6 +2909,24 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
>  		struct page *page;
>  		unsigned long mark;
>
> +		/*
> +		 * CDM nodes get skipped if the requested gfp flag
> +		 * does not have __GFP_THISNODE set or the nodemask
> +		 * does not have any CDM nodes in case the nodemask
> +		 * is non NULL (explicit allocation requests from
> +		 * kernel or user process MPOL_BIND policy which has
> +		 * CDM nodes).
> +		 */
> +		if (is_cdm_node(zone->zone_pgdat->node_id)) {
> +			if (!(gfp_mask & __GFP_THISNODE)) {
> +				if (!ac->nodemask)
> +					continue;
> +
> +				if (!nodemask_has_cdm(*ac->nodemask))
> +					continue;

nodemask_has_cdm() looks quite expensive, combined with the loop here that's 
O(n^2). But I don't understand why you need it. If there is no cdm node in the 
nodemask, then we never reach this code with a cdm node, because the zonelist 
iterator already checks the nodemask? Am I missing something?

> +			}
> +		}
> +
>  		if (cpusets_enabled() &&
>  			(alloc_flags & ALLOC_CPUSET) &&
>  			!__cpuset_zone_allowed(zone, gfp_mask))
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] Define coherent device memory node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-08 15:10 +0100
  Re: [PATCH 0/3] Define coherent device memory node Balbir Singh <bsingharora@gmail.com> - 2017-02-08 17:50 +0100
  [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-08 18:30 +0100
    Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Vlastimil Babka <vbabka@suse.cz> - 2017-02-08 18:30 +0100
      Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-09 07:10 +0100
        Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Vlastimil Babka <vbabka@suse.cz> - 2017-02-09 09:50 +0100
          Re: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-09 13:00 +0100
  [PATCH 2/3] mm: Enable HugeTLB allocation isolation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-08 18:40 +0100

csiph-web