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


Groups > linux.kernel > #1580454

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

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Anshuman Khandual <khandual@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 3/3] mm: Enable Buddy allocation isolation for CDM nodes
Date Tue, 14 Feb 2017 11:20:01 +0100
Message-ID <taInf-wj-7@gated-at.bofh.it> (permalink)
References <t9gjn-23D-3@gated-at.bofh.it> <t9gjo-23D-37@gated-at.bofh.it> <taGEN-7Nt-11@gated-at.bofh.it>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Tm-As-Mml disable
X-Content-Scanned Fidelis XPS MAILER
X-Cbid 17021410-0048-0000-0000-000002055454
X-Ibm-Av-Detection SAVI=unused REMOTE=unused XFE=unused
X-Cbparentid 17021410-0049-0000-0000-000047878941
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-02-14_05:,, signatures=0
X-Proofpoint-Spam-Details rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702140104
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 67
Organization linux.* mail to news gateway
X-Original-Cc mhocko@suse.com, mgorman@suse.de, minchan@kernel.org, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, srikar@linux.vnet.ibm.com, haren@linux.vnet.ibm.com, jglisse@redhat.com, dave.hansen@intel.com, dan.j.williams@intel.com
X-Original-Date Tue, 14 Feb 2017 15:44:40 +0530
X-Original-Message-ID <aed94333-7cd7-958e-ff8c-78a6cf05fe45@linux.vnet.ibm.com>
X-Original-References <20170210100640.26927-1-khandual@linux.vnet.ibm.com> <20170210100640.26927-4-khandual@linux.vnet.ibm.com> <44bbca4e-af5a-805c-c74b-28e684026611@suse.cz>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1580454

Show key headers only | View raw


On 02/14/2017 01:58 PM, Vlastimil Babka wrote:
> On 02/10/2017 11:06 AM, 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 | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 84d61bb..392c24a 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,21 @@ 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;
>> +			}
>> +		}
> 
> With the current cpuset implementation, this will have a subtle corner
> case when allocating from a cpuset that allows the cdm node, and there
> is no (task or vma) mempolicy applied for the allocation. In the fast
> path (__alloc_pages_nodemask()) we'll set ac->nodemask to
> current->mems_allowed, so your code will wrongly assume that this
> ac->nodemask is a policy that allows the CDM node. Probably not what you
> want?

You are right, its a problem and not what we want. We can make the
function get_page_from_freelist() take another parameter "orig_nodemask"
which gets passed into __alloc_pages_nodemask() in the first place. So
inside zonelist iterator we can compare orig_nodemask with current
ac.nodemask to figure out if cpuset swapping of nodemask happened and
skip CDM node if necessary. Thats a viable solution IMHO.

> 
> This might change if we decide to fix the cpuset vs mempolicy issues [1]
> so your input on that topic with your recent experience with all the
> alternative CDM isolation implementations would be useful. Thanks.
> 
> [1] http://www.spinics.net/lists/linux-mm/msg121760.html

Sure, will look into the details.

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


Thread

[PATCH V2 0/3] Define coherent device memory node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-10 11:10 +0100
  [PATCH V2 3/3] mm: Enable Buddy allocation isolation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-10 11:10 +0100
    Re: [PATCH V2 3/3] mm: Enable Buddy allocation isolation for CDM  nodes Vlastimil Babka <vbabka@suse.cz> - 2017-02-14 09:30 +0100
      Re: [PATCH V2 3/3] mm: Enable Buddy allocation isolation for CDM  nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-14 11:20 +0100
        Re: [PATCH V2 3/3] mm: Enable Buddy allocation isolation for CDM  nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-15 05:30 +0100
  [PATCH V2 1/3] mm: Define coherent device memory (CDM) node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-10 11:10 +0100
    Re: [PATCH V2 1/3] mm: Define coherent device memory (CDM) node John Hubbard <jhubbard@nvidia.com> - 2017-02-13 05:10 +0100
      Re: [PATCH V2 1/3] mm: Define coherent device memory (CDM) node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-14 09:20 +0100
        Re: [PATCH V2 1/3] mm: Define coherent device memory (CDM) node John Hubbard <jhubbard@nvidia.com> - 2017-02-15 03:10 +0100
  Re: [PATCH V2 0/3] Define coherent device memory node Vlastimil Babka <vbabka@suse.cz> - 2017-02-13 16:40 +0100
    Re: [PATCH V2 0/3] Define coherent device memory node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-02-14 08:00 +0100

csiph-web