From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932631AbdBHRUQ (ORCPT ); Wed, 8 Feb 2017 12:20:16 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38825 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754447AbdBHRUL (ORCPT ); Wed, 8 Feb 2017 12:20:11 -0500 From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: mhocko@suse.com, vbabka@suse.cz, 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 Subject: [PATCH 3/3] mm: Enable Buddy allocation isolation for CDM nodes Date: Wed, 8 Feb 2017 19:31:48 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170208140148.16049-1-khandual@linux.vnet.ibm.com> References: <20170208140148.16049-1-khandual@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020814-0012-0000-0000-000003B3A1EF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020814-0013-0000-0000-00001B34B96E Message-Id: <20170208140148.16049-4-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-08_09:,, 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-1702080138 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 #include #include +#include #include #include @@ -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; + } + } + if (cpusets_enabled() && (alloc_flags & ALLOC_CPUSET) && !__cpuset_zone_allowed(zone, gfp_mask)) -- 2.9.3