Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757266AbcJXEdE (ORCPT ); Mon, 24 Oct 2016 00:33:04 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54371 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757148AbcJXEcj (ORCPT ); Mon, 24 Oct 2016 00:32:39 -0400 From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: mhocko@suse.com, js1304@gmail.com, vbabka@suse.cz, mgorman@suse.de, minchan@kernel.org, akpm@linux-foundation.org, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com Subject: [RFC 6/8] mm: Make VM_CDM marked VMAs non migratable Date: Mon, 24 Oct 2016 10:01:55 +0530 X-Mailer: git-send-email 2.1.0 In-Reply-To: <1477283517-2504-1-git-send-email-khandual@linux.vnet.ibm.com> References: <1477283517-2504-1-git-send-email-khandual@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16102404-0008-0000-0000-0000036FEBCA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16102404-0009-0000-0000-0000102F4A3E Message-Id: <1477283517-2504-7-git-send-email-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-23_18:,, 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-1609300000 definitions=main-1610240081 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1209 Lines: 43 Auto NUMA does migratability check on any given VMA before scanning it for marking purpose. For now if the coherent device memory has been faulted in or migrated into a process VMA, it should not be part of the auto NUMA migration scheme. The check is based on VM_CDM flag. Signed-off-by: Anshuman Khandual --- include/linux/mempolicy.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 5e5b296..09d4b70 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -171,9 +171,26 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol); extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); +#ifdef CONFIG_COHERENT_DEVICE +static bool is_cdm_vma(struct vm_area_struct *vma) +{ + if (vma->vm_flags & VM_CDM) + return true; + return false; +} +#else +static bool is_cdm_vma(struct vm_area_struct *vma) +{ + return false; +} +#endif + /* Check if a vma is migratable */ static inline bool vma_migratable(struct vm_area_struct *vma) { + if (is_cdm_vma(vma)) + return false; + if (vma->vm_flags & (VM_IO | VM_PFNMAP)) return false; -- 2.1.0