Received: by 10.213.65.68 with SMTP id h4csp503743imn; Tue, 13 Mar 2018 11:06:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELuwKKag4GuYo18pCv3bV/AbbDKmf2v8sbt+y7k7q1ThuNnkOIZOmEV2FtA5EDDC3ehX3SMQ X-Received: by 2002:a17:902:bd8c:: with SMTP id q12-v6mr1370189pls.364.1520964393007; Tue, 13 Mar 2018 11:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520964392; cv=none; d=google.com; s=arc-20160816; b=u5DUHb71boan+3Szh2WuhzXpoiWezXQTNPNImmd0vcSZ8FhyCYUbqbQ7ExD99z5j7b CgbLfk7aKm8435lpZ627OKm7pJFSqQxuEYb7glyc90ENc5nApLemHI7LVzelDhpE/uuF KAYTRhCI7Ywrv1yXdC4QubcuXfYldD58u9PHmV1xBb0Te4mm2bdFoLJjc04dMSczBFZ/ sak44QTa8BUTa7F/t2KanT8oSFd/WZFpIevw9SXIAWkfqAA5lQ4/mWyEhcP+DgAeDGDM lmwH15H+hhAeds5unGUNaKO+SDmBfBmUZnMJNXAWYQ5o4iZ2QASEsU6cGqd3NESYqxF/ bxRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=PMKkXR+JK2exLbrcT9VEepHg1TSWvWfQVQT5wQjJiH0=; b=xgYRmoQJ1zoiCeRI5DcrNAv59cyWK4gX7BXAy4tb7XOzEkAdfCaWS9buIkN9OhIErP o8Jh0vjY2gLnb571oHhe0+cQfuNmWBtQaq+1clA9i91HMhR4lalLz8sYeQl9io93dAGU sA0/dJUNrY58WXI8OIFrVxrdnmpSC1mL8bb2cvr7sWILXuIJVG2n0/vArnDfR5qPD9n/ PIjrsu83t0yI2OZuzxq5wkZ4MaA+JHh9Es3X/DPJMVDJYLassg7ndf0e2SjiegXDu76u 6/eS3PHP2Pp6iQu1Z5qFwHMHU16WcCyqyiNHDUerZRO0bgNUDVQ1TPyjMeadrdJjGd7+ 9hXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si404193pgv.831.2018.03.13.11.06.18; Tue, 13 Mar 2018 11:06:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752977AbeCMSEb (ORCPT + 99 others); Tue, 13 Mar 2018 14:04:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48602 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752526AbeCMSAc (ORCPT ); Tue, 13 Mar 2018 14:00:32 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2DHsKqh041367 for ; Tue, 13 Mar 2018 14:00:32 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gpj5ckmt1-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 13 Mar 2018 14:00:31 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Mar 2018 18:00:29 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 Mar 2018 18:00:23 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2DI0MHN54394998; Tue, 13 Mar 2018 18:00:22 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AF5B4204B; Tue, 13 Mar 2018 17:52:38 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7191B42041; Tue, 13 Mar 2018 17:52:37 +0000 (GMT) Received: from nimbus.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.33]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 13 Mar 2018 17:52:37 +0000 (GMT) From: Laurent Dufour To: paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v9 12/24] mm/migrate: Pass vm_fault pointer to migrate_misplaced_page() Date: Tue, 13 Mar 2018 18:59:42 +0100 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520963994-28477-1-git-send-email-ldufour@linux.vnet.ibm.com> References: <1520963994-28477-1-git-send-email-ldufour@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031318-0020-0000-0000-0000040402A4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031318-0021-0000-0000-000042980299 Message-Id: <1520963994-28477-13-git-send-email-ldufour@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803130203 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org migrate_misplaced_page() is only called during the page fault handling so it's better to pass the pointer to the struct vm_fault instead of the vma. This way during the speculative page fault path the saved vma->vm_flags could be used. Signed-off-by: Laurent Dufour --- include/linux/migrate.h | 4 ++-- mm/memory.c | 2 +- mm/migrate.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index f2b4abbca55e..fd4c3ab7bd9c 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -126,14 +126,14 @@ static inline void __ClearPageMovable(struct page *page) #ifdef CONFIG_NUMA_BALANCING extern bool pmd_trans_migrating(pmd_t pmd); extern int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node); + struct vm_fault *vmf, int node); #else static inline bool pmd_trans_migrating(pmd_t pmd) { return false; } static inline int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node) + struct vm_fault *vmf, int node) { return -EAGAIN; /* can't migrate now */ } diff --git a/mm/memory.c b/mm/memory.c index 46fe92b93682..412014d5785b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3880,7 +3880,7 @@ static int do_numa_page(struct vm_fault *vmf) } /* Migrate to the requested node */ - migrated = migrate_misplaced_page(page, vma, target_nid); + migrated = migrate_misplaced_page(page, vmf, target_nid); if (migrated) { page_nid = target_nid; flags |= TNF_MIGRATED; diff --git a/mm/migrate.c b/mm/migrate.c index 5d0dc7b85f90..ad8692ca6a4f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1900,7 +1900,7 @@ bool pmd_trans_migrating(pmd_t pmd) * node. Caller is expected to have an elevated reference count on * the page that will be dropped by this function before returning. */ -int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, +int migrate_misplaced_page(struct page *page, struct vm_fault *vmf, int node) { pg_data_t *pgdat = NODE_DATA(node); @@ -1913,7 +1913,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, * with execute permissions as they are probably shared libraries. */ if (page_mapcount(page) != 1 && page_is_file_cache(page) && - (vma->vm_flags & VM_EXEC)) + (vmf->vma_flags & VM_EXEC)) goto out; /* -- 2.7.4